use of com.gargoylesoftware.htmlunit.javascript.host.ClientRectList in project htmlunit by HtmlUnit.
the class Range method getClientRects.
/**
* Retrieves a collection of rectangles that describes the layout of the contents of an object
* or range within the client. Each rectangle describes a single line.
* @return a collection of rectangles that describes the layout of the contents
*/
@JsxFunction
public ClientRectList getClientRects() {
final Window w = getWindow();
final ClientRectList rectList = new ClientRectList();
rectList.setParentScope(w);
rectList.setPrototype(getPrototype(rectList.getClass()));
// simple impl for now
for (final DomNode node : toW3C().containedNodes()) {
final ScriptableObject scriptable = node.getScriptableObject();
if (scriptable instanceof HTMLElement) {
final ClientRect rect = new ClientRect(0, 0, 1, 1);
rect.setParentScope(w);
rect.setPrototype(getPrototype(rect.getClass()));
rectList.add(rect);
}
}
return rectList;
}
Aggregations