Search in sources :

Example 1 with HTMLDocument

use of org.loboevolution.html.dom.HTMLDocument in project LoboEvolution by LoboEvolution.

the class PositionedRenderable method getSome.

private Point getSome() {
    final RCollection rparent = renderable.getParent();
    if (!isFixed && rparent.getModelNode() instanceof HTMLDocument) {
        Renderable htmlRenderable = renderable.findHtmlRenderable(rparent);
        if (htmlRenderable instanceof PositionedRenderable) {
            final PositionedRenderable htmlPR = (PositionedRenderable) htmlRenderable;
            htmlRenderable = htmlPR.renderable;
        }
        if (htmlRenderable instanceof RBlock) {
            final RBlock htmlBlock = ((RBlock) htmlRenderable);
            final Point htmlOffset = htmlBlock.bodyLayout.getOrigin();
            final Insets htmlInsets = htmlBlock.getInsetsMarginBorder(htmlBlock.hasHScrollBar, htmlBlock.hasVScrollBar);
            return new Point((int) htmlOffset.getX() - htmlInsets.left, (int) htmlOffset.getY() - htmlInsets.top);
        }
    }
    return null;
}
Also used : Insets(java.awt.Insets) HTMLDocument(org.loboevolution.html.dom.HTMLDocument) Point(java.awt.Point)

Example 2 with HTMLDocument

use of org.loboevolution.html.dom.HTMLDocument in project LoboEvolution by LoboEvolution.

the class HTMLDocumentTest method testCloneDocumentNode.

@Test
public void testCloneDocumentNode() {
    HTMLDocument doc = (HTMLDocument) document.cloneNode(false);
    assertNull(doc.getDoctype());
    assertNull(doc.getDocumentElement());
    assertSame(document.getImplementation(), doc.getImplementation());
}
Also used : HTMLDocument(org.loboevolution.html.dom.HTMLDocument) Test(org.junit.Test) LoboUnitTest(org.loboevolution.driver.LoboUnitTest)

Example 3 with HTMLDocument

use of org.loboevolution.html.dom.HTMLDocument in project LoboEvolution by LoboEvolution.

the class DelayedPair method helperGetPixelSize.

private Integer helperGetPixelSize(final String spec, final RenderState rs, final int errorValue, final int avail) {
    if (spec != null) {
        Window window = null;
        ModelNode node = getModelNode();
        if (node instanceof HTMLDocument) {
            HTMLDocumentImpl doc = (HTMLDocumentImpl) node;
            window = doc.getDefaultView();
        }
        return "auto".equals(spec) ? null : HtmlValues.getPixelSize(spec, rs, window, errorValue, avail);
    } else {
        return null;
    }
}
Also used : Window(org.loboevolution.html.node.js.Window) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HTMLDocument(org.loboevolution.html.dom.HTMLDocument) ModelNode(org.loboevolution.html.dom.nodeimpl.ModelNode)

Example 4 with HTMLDocument

use of org.loboevolution.html.dom.HTMLDocument in project LoboEvolution by LoboEvolution.

the class LinkRenderState method linkColor.

private Color linkColor() {
    if (rcontext != null) {
        boolean visited = rcontext.isVisitedLink(element);
        String vlink = null;
        String link = null;
        HTMLDocument doc = (HTMLDocument) element.getDocumentNode();
        if (doc != null) {
            HTMLBodyElement body = (HTMLBodyElement) doc.getBody();
            if (body != null) {
                vlink = body.getVLink();
                link = body.getLink();
            }
        }
        vlink = (vlink == null) ? COLOR_VISITED : vlink;
        link = (link == null) ? DEFAULT_COLOR : link;
        String colorText = visited ? vlink : link;
        AbstractCSSProperties props = this.getCssProperties();
        String color = props == null ? null : props.getColor();
        return ColorFactory.getInstance().getColor(color == null ? colorText : color);
    }
    return Color.BLUE;
}
Also used : HTMLDocument(org.loboevolution.html.dom.HTMLDocument) HTMLBodyElement(org.loboevolution.html.dom.HTMLBodyElement) AbstractCSSProperties(org.loboevolution.html.style.AbstractCSSProperties)

Aggregations

HTMLDocument (org.loboevolution.html.dom.HTMLDocument)4 Insets (java.awt.Insets)1 Point (java.awt.Point)1 Test (org.junit.Test)1 LoboUnitTest (org.loboevolution.driver.LoboUnitTest)1 HTMLBodyElement (org.loboevolution.html.dom.HTMLBodyElement)1 HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)1 ModelNode (org.loboevolution.html.dom.nodeimpl.ModelNode)1 Window (org.loboevolution.html.node.js.Window)1 AbstractCSSProperties (org.loboevolution.html.style.AbstractCSSProperties)1