use of com.gargoylesoftware.htmlunit.javascript.host.html.HTMLIFrameElement in project htmlunit by HtmlUnit.
the class WebClient method resolveWindow.
private WebWindow resolveWindow(final WebWindow opener, final String name) {
if (name == null || name.isEmpty() || TARGET_SELF.equals(name)) {
return opener;
}
if (TARGET_PARENT.equals(name)) {
return opener.getParentWindow();
}
if (TARGET_TOP.equals(name)) {
return opener.getTopWindow();
}
if (TARGET_BLANK.equals(name)) {
return null;
}
// first search for frame windows inside our window hierarchy
WebWindow window = opener;
while (true) {
final Page page = window.getEnclosedPage();
if (page != null && page.isHtmlPage()) {
try {
final FrameWindow frame = ((HtmlPage) page).getFrameByName(name);
final ScriptableObject scriptable = frame.getFrameElement().getScriptableObject();
if (scriptable instanceof HTMLIFrameElement) {
((HTMLIFrameElement) scriptable).onRefresh();
}
return frame;
} catch (final ElementNotFoundException e) {
// Fall through
}
}
if (window == window.getParentWindow()) {
// TODO: should getParentWindow() return null on top windows?
break;
}
window = window.getParentWindow();
}
try {
return getWebWindowByName(name);
} catch (final WebWindowNotFoundException e) {
// Fall through - a new window will be created below
}
return null;
}
use of com.gargoylesoftware.htmlunit.javascript.host.html.HTMLIFrameElement in project htmlunit by HtmlUnit.
the class ComputedCSSStyleDeclaration method getCalculatedHeight.
/**
* Returns the element's calculated height, taking both relevant CSS and the element's children into account.
* @return the element's calculated height, taking both relevant CSS and the element's children into account
*/
private int getCalculatedHeight() {
if (height_ != null) {
return height_.intValue();
}
final Element element = getElement();
if (element instanceof HTMLImageElement) {
height_ = ((HtmlImage) element.getDomNodeOrDie()).getHeightOrDefault();
return height_;
}
final boolean isInline = "inline".equals(getDisplay()) && !(element instanceof HTMLIFrameElement);
// height is ignored for inline elements
if (isInline || super.getHeight().isEmpty()) {
final int contentHeight = getContentHeight();
if (contentHeight > 0) {
height_ = Integer.valueOf(contentHeight);
return height_;
}
}
height_ = Integer.valueOf(getEmptyHeight());
return height_;
}
Aggregations