Search in sources :

Example 1 with DocumentFragmentImpl

use of org.loboevolution.html.dom.domimpl.DocumentFragmentImpl in project LoboEvolution by LoboEvolution.

the class RBlockViewport method layoutChildren.

private void layoutChildren(NodeImpl node) {
    final NodeListImpl nodeList = node.getNodeList();
    if (nodeList != null) {
        nodeList.forEach(nd -> {
            final NodeImpl child = (NodeImpl) nd;
            final NodeType nodeType = child.getNodeType();
            switch(nodeType) {
                case TEXT_NODE:
                    layoutText(child);
                    break;
                case ELEMENT_NODE:
                    this.currentLine.addStyleChanger(new RStyleChanger(child));
                    final String nodeName = child.getNodeName().toUpperCase();
                    MarkupLayout ml = RLayout.elementLayout.get(HTMLTag.get(nodeName));
                    if (ml == null) {
                        ml = miscLayout;
                    }
                    ml.layoutMarkup(this, (HTMLElementImpl) child);
                    this.currentLine.addStyleChanger(new RStyleChanger(node));
                    break;
                case DOCUMENT_FRAGMENT_NODE:
                    final DocumentFragmentImpl fragment = (DocumentFragmentImpl) child;
                    fragment.getNodeList().forEach(fragNode -> {
                        final NodeImpl fragChild = (NodeImpl) fragNode;
                        layoutChildren(fragChild);
                    });
                    break;
                case COMMENT_NODE:
                case PROCESSING_INSTRUCTION_NODE:
                default:
                    break;
            }
        });
    }
}
Also used : DocumentFragmentImpl(org.loboevolution.html.dom.domimpl.DocumentFragmentImpl) NodeListImpl(org.loboevolution.html.dom.nodeimpl.NodeListImpl) NodeImpl(org.loboevolution.html.dom.nodeimpl.NodeImpl) NodeType(org.loboevolution.type.NodeType)

Aggregations

DocumentFragmentImpl (org.loboevolution.html.dom.domimpl.DocumentFragmentImpl)1 NodeImpl (org.loboevolution.html.dom.nodeimpl.NodeImpl)1 NodeListImpl (org.loboevolution.html.dom.nodeimpl.NodeListImpl)1 NodeType (org.loboevolution.type.NodeType)1