Search in sources :

Example 1 with DOMRectListImpl

use of org.loboevolution.html.js.geom.DOMRectListImpl in project LoboEvolution by LoboEvolution.

the class ElementImpl method getClientRects.

/**
 * {@inheritDoc}
 */
@Override
public DOMRectList getClientRects() {
    DOMRectListImpl list = new DOMRectListImpl();
    AbstractCSSProperties style = ((HTMLElementImpl) this).getCurrentStyle();
    String display = Strings.isNotBlank(style.getDisplay()) ? style.getDisplay() : getAttribute("display");
    if (!"none".equals(display)) {
        for (Node n = getParentNode(); n != null; n = n.getPreviousSibling()) {
            if (!(n instanceof HTMLBodyElement) && !(n instanceof TextImpl) && !(n instanceof HTMLDocumentImpl)) {
                HTMLElementImpl p = (HTMLElementImpl) n;
                AbstractCSSProperties st = p.getStyle();
                display = st.getDisplay();
            }
        }
    }
    if (!"none".equals(display)) {
        list.add(getBoundingClientRect());
    }
    return list;
}
Also used : DOMRectListImpl(org.loboevolution.html.js.geom.DOMRectListImpl) HTMLBodyElement(org.loboevolution.html.dom.HTMLBodyElement) TextImpl(org.loboevolution.html.dom.nodeimpl.TextImpl)

Aggregations

HTMLBodyElement (org.loboevolution.html.dom.HTMLBodyElement)1 TextImpl (org.loboevolution.html.dom.nodeimpl.TextImpl)1 DOMRectListImpl (org.loboevolution.html.js.geom.DOMRectListImpl)1