/** * Given a relative URL (ie <tt>/foo</tt>), returns a fully-qualified URL based on * the URL that was used to load this page. * * @param relativeUrl the relative URL * @return the fully-qualified URL for the specified relative URL * @exception MalformedURLException if an error occurred when creating a URL object */ public URL getFullyQualifiedUrl(String relativeUrl) throws MalformedURLException { // to handle http: and http:/ in FF (Bug #474) if (hasFeature(URL_MISSING_SLASHES)) { boolean incorrectnessNotified = false; while (relativeUrl.startsWith("http:") && !relativeUrl.startsWith("http://")) { if (!incorrectnessNotified) { notifyIncorrectness("Incorrect URL \"" + relativeUrl + "\" has been corrected"); incorrectnessNotified = true; } relativeUrl = "http:/" + relativeUrl.substring(5); } } return WebClient.expandUrl(getBaseURL(), relativeUrl); }
/** * Given a relative URL (ie <tt>/foo</tt>), returns a fully-qualified URL based on * the URL that was used to load this page. * * @param relativeUrl the relative URL * @return the fully-qualified URL for the specified relative URL * @exception MalformedURLException if an error occurred when creating a URL object */ public URL getFullyQualifiedUrl(String relativeUrl) throws MalformedURLException { // to handle http: and http:/ in FF (Bug #474) if (hasFeature(URL_MISSING_SLASHES)) { boolean incorrectnessNotified = false; while (relativeUrl.startsWith("http:") && !relativeUrl.startsWith("http://")) { if (!incorrectnessNotified) { notifyIncorrectness("Incorrect URL \"" + relativeUrl + "\" has been corrected"); incorrectnessNotified = true; } relativeUrl = "http:/" + relativeUrl.substring(5); } } return WebClient.expandUrl(getBaseURL(), relativeUrl); }
/** * {@inheritDoc} */ @Override public DisplayStyle getDefaultStyleDisplay() { final HtmlPage page = getHtmlPageOrNull(); if (page.isQuirksMode() && page.hasFeature(HTMLDEFINITION_INLINE_IN_QUIRKS)) { return DisplayStyle.INLINE; } return super.getDefaultStyleDisplay(); } }
/** * {@inheritDoc} */ @Override public DisplayStyle getDefaultStyleDisplay() { final HtmlPage page = getHtmlPageOrNull(); if (page.isQuirksMode() && page.hasFeature(HTMLDEFINITION_INLINE_IN_QUIRKS)) { return DisplayStyle.INLINE; } return super.getDefaultStyleDisplay(); } }
final HtmlPage page, final boolean originalCall, final boolean checkInsideFrameOnly) { final boolean waitToLoad = page.hasFeature(PAGE_WAIT_LOAD_BEFORE_BODY); if (page.getEnclosingWindow() instanceof FrameWindow && originalCall && waitToLoad) { return;
final HtmlPage page, final boolean originalCall, final boolean checkInsideFrameOnly) { final boolean waitToLoad = page.hasFeature(PAGE_WAIT_LOAD_BEFORE_BODY); if (page.getEnclosingWindow() instanceof FrameWindow && originalCall && waitToLoad) { return;
final boolean keyGenAsSelect = "keygen".equals(tagLower) && page_.hasFeature(KEYGEN_AS_SELECT); if (keyGenAsSelect) { tagLower = "select"; body_ = (HtmlElement) newElement; else if ("meta".equals(tagLower) && page_.hasFeature(META_X_UA_COMPATIBLE)) { final HtmlMeta meta = (HtmlMeta) newElement; if ("X-UA-Compatible".equals(meta.getHttpEquivAttribute())) {
final boolean keyGenAsSelect = "keygen".equals(tagLower) && page_.hasFeature(KEYGEN_AS_SELECT); if (keyGenAsSelect) { tagLower = "select"; body_ = (HtmlElement) newElement; else if ("meta".equals(tagLower) && page_.hasFeature(META_X_UA_COMPATIBLE)) { final HtmlMeta meta = (HtmlMeta) newElement; if ("X-UA-Compatible".equals(meta.getHttpEquivAttribute())) {
/** * Sets the ready state on any deferred scripts, if necessary. */ private void setReadyStateOnDeferredScriptsIfNeeded() { if (getWebClient().getOptions().isJavaScriptEnabled() && hasFeature(JS_DEFERRED)) { final List<HtmlElement> elements = getDocumentElement().getElementsByTagName("script"); for (final HtmlElement e : elements) { if (e instanceof HtmlScript) { final HtmlScript script = (HtmlScript) e; if (script.isDeferred()) { script.setAndExecuteReadyState(READY_STATE_COMPLETE); } } } } }
/** * Sets the ready state on any deferred scripts, if necessary. */ private void setReadyStateOnDeferredScriptsIfNeeded() { if (getWebClient().getOptions().isJavaScriptEnabled() && hasFeature(JS_DEFERRED)) { final List<HtmlElement> elements = getDocumentElement().getElementsByTagName("script"); for (final HtmlElement e : elements) { if (e instanceof HtmlScript) { final HtmlScript script = (HtmlScript) e; if (script.isDeferred()) { script.setAndExecuteReadyState(READY_STATE_COMPLETE); } } } } }
if (hasFeature(EVENT_FOCUS_IN_FOCUS_OUT_BLUR)) { if (oldFocusedElement != null) { oldFocusedElement.fireEvent(Event.TYPE_FOCUS_OUT); && hasFeature(PAGE_SELECTION_RANGE_FROM_SELECTABLE_TEXT_INPUT)) { final SelectableTextInput sti = (SelectableTextInput) elementWithFocus_; setSelectionRange(new SimpleRange(sti, sti.getSelectionStart(), sti, sti.getSelectionEnd())); if (hasFeature(EVENT_FOCUS_FOCUS_IN_BLUR_OUT)) { if (oldFocusedElement != null) { oldFocusedElement.fireEvent(Event.TYPE_FOCUS_OUT);
/** * Executes any deferred scripts, if necessary. */ private void executeDeferredScriptsIfNeeded() { if (!getWebClient().getOptions().isJavaScriptEnabled()) { return; } if (hasFeature(JS_DEFERRED)) { final DomElement doc = getDocumentElement(); final List<HtmlElement> elements = doc.getElementsByTagName("script"); for (final HtmlElement e : elements) { if (e instanceof HtmlScript) { final HtmlScript script = (HtmlScript) e; if (script.isDeferred()) { script.executeScriptIfNeeded(); } } } } }
/** * Executes any deferred scripts, if necessary. */ private void executeDeferredScriptsIfNeeded() { if (!getWebClient().getOptions().isJavaScriptEnabled()) { return; } if (hasFeature(JS_DEFERRED)) { final DomElement doc = getDocumentElement(); final List<HtmlElement> elements = doc.getElementsByTagName("script"); for (final HtmlElement e : elements) { if (e instanceof HtmlScript) { final HtmlScript script = (HtmlScript) e; if (script.isDeferred()) { script.executeScriptIfNeeded(); } } } } }
if (hasFeature(EVENT_FOCUS_IN_FOCUS_OUT_BLUR)) { if (oldFocusedElement != null) { oldFocusedElement.fireEvent(Event.TYPE_FOCUS_OUT); && hasFeature(PAGE_SELECTION_RANGE_FROM_SELECTABLE_TEXT_INPUT)) { final SelectableTextInput sti = (SelectableTextInput) elementWithFocus_; setSelectionRange(new SimpleRange(sti, sti.getSelectionStart(), sti, sti.getSelectionEnd())); if (hasFeature(EVENT_FOCUS_FOCUS_IN_BLUR_OUT)) { if (oldFocusedElement != null) { oldFocusedElement.fireEvent(Event.TYPE_FOCUS_OUT);
if (hasFeature(FOCUS_BODY_ELEMENT_AT_START)) { setElementWithFocus(getBody());
if (hasFeature(FOCUS_BODY_ELEMENT_AT_START)) { setElementWithFocus(getBody());