Top Description Inners Fields Constructors Methods
com.openhtmltopdf.layout

public Class BoxBuilder

extends Object
Class Inheritance
Imports
java.util.ArrayDeque, .ArrayList, .Collections, .Deque, .HashMap, .Iterator, .List, .Map, java.util.logging.Level, org.w3c.dom.Document, .Element, .Node, .Text, com.openhtmltopdf.bidi.BidiSplitter, .BidiTextRun, .ParagraphSplitter.Paragraph, com.openhtmltopdf.css.constants.CSSName, .IdentValue, .MarginBoxName, .PageElementPosition, com.openhtmltopdf.css.extend.ContentFunction, com.openhtmltopdf.css.newmatch.CascadedStyle, .PageInfo, com.openhtmltopdf.css.parser.CSSPrimitiveValue, .FSFunction, .PropertyValue, com.openhtmltopdf.css.sheet.PropertyDeclaration, .StylesheetInfo, com.openhtmltopdf.css.style.CalculatedStyle, .EmptyStyle, .FSDerivedValue, com.openhtmltopdf.layout.counter.AbstractCounterContext, .RootCounterContext, com.openhtmltopdf.newtable.TableBox, .TableCellBox, .TableColumn, .TableRowBox, .TableSectionBox, com.openhtmltopdf.render.AnonymousBlockBox, .BlockBox, .Box, .FloatedBoxData, .FlowingColumnBox, .FlowingColumnContainerBox, .InlineBox, com.openhtmltopdf.util.OpenUtil, .XRLog, .LogMessageId

This class is responsible for creating the box tree from the DOM. This is mostly just a one-to-one translation from the Element to an InlineBox or a BlockBox (or some subclass of BlockBox), but the tree is reorganized according to the CSS rules. This includes inserting anonymous block and inline boxes, anonymous table content, and :before and :after content. White space is also normalized at this point. Table columns and table column groups are added to the table which owns them, but are not created as regular boxes. Floated and absolutely positioned content is always treated as inline content for purposes of inserting anonymous block boxes and calculating the kind of content contained in a given block box.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
private static void
private static boolean
private static void
createAnonymousBlock(SharedContext c, Box parent, List<Styleable> inline, List<InlineBox> savedParents)

private static void
createAnonymousBlock(SharedContext c, Box parent, List<Styleable> inline, List<InlineBox> savedParents, IdentValue display)

private static void
createAnonymousTableContent(LayoutContext c, BlockBox source, IdentValue next, List<Styleable> childrenForAnonymous, List<Styleable> childrenWithAnonymous)

private static BlockBox
createBlockBox(CalculatedStyle style, BoxBuilder.ChildBoxInfo info, boolean generated)

private static Styleable
public static void
private static void
createChildren(LayoutContext c, BlockBox blockParent, Element parent, List<Styleable> children, BoxBuilder.ChildBoxInfo info, boolean inline)

private static void
private static void
private static BlockBox
createFootnoteBody(LayoutContext c, Element element, CalculatedStyle style)

Creates the footnote body to put at the bottom of the page inside a page's footnote area.

private static Element
createFootnoteCallAnchor(LayoutContext c, Element parent)

Used to create the anchor element to link to the footnote body for the footnote-call pseudo element.

private static Element
createFootnoteTarget(LayoutContext c, Element parent)

Creates an element with id for the footnote-marker pseudo element so we can link to it from the footnote-call pseduo element.

private static List<Styleable>

Returns:

The generated box(es). Typically one BlockBox or multiple inline boxes.
createGeneratedContent
(LayoutContext c, Element
The containing element where the pseudo element appears. For span::before the element would be a span.
element
,
String
Examples include before, after, footnote-call and footnote-marker.
peName
,
CalculatedStyle
The child style for this pseudo element. For span::before this would include all the styles set explicitly on ::before as well as those that inherit from span following the cascade rules.
style
,
PropertyValue
The values of the content CSS property.
property
,
BoxBuilder.ChildBoxInfo
In/out param. Whether the resultant box(es) contain block level content.
info
)

Creates generated content boxes for pseudo elements such as ::before.

private static List<Styleable>
private static List<Styleable>
private static InlineBox
createInlineBox(String text, Element parent, CalculatedStyle parentStyle, Text node)

private static void
private static TableCellBox
createMarginBox(LayoutContext c, CascadedStyle cascadedStyle, boolean alwaysCreate)

public static TableBox
createMarginTable(LayoutContext c, PageInfo pageInfo, MarginBoxName[] names, int height, int direction)

public static BlockBox
private static InlineBox

Returns:

the previousIB.
doBidi
(LayoutContext c, Text textNode, Element parent, CalculatedStyle parentStyle, InlineBox previousIB, List<Styleable> children)

Attempts to divide a Text node further into directional text runs, either LTR or RTL.

private static InlineBox
doFakeBidi(LayoutContext c, Text textNode, Element parent, CalculatedStyle parentStyle, InlineBox previousIB, List<Styleable> children)

private static String
private static IdentValue
private static IdentValue
public static BlockBox
private static void
insertAnonymousBlocks(SharedContext c, Box parent, List<Styleable> children, boolean layoutRunningBlocks)

private static void
private static boolean
private static boolean
public static boolean
private static boolean
isGeneratedElement(Element element)

Don't output elements that have been artificially created to support footnotes and content property images.

private static boolean
private static boolean
private static boolean
private static boolean
private static boolean
private static boolean
private static boolean
private static void
private static void
private static BoxBuilder.ChildBoxInfo
private static CounterFunction
private static boolean
private static void
rebalanceInlineContent(List<Styleable> content)

Makes sure that any InlineBox in content both starts and ends within content.

private static BlockBox
reorderTableContent(LayoutContext c, TableBox table)

Reorganizes a table so that the header is the first row group and the footer the last.

private static void
private static void
resolveChildTableContent(LayoutContext c, BlockBox parent, List<Styleable> children, BoxBuilder.ChildBoxInfo info, IdentValue target)

Handles the situation when we find table content, but our parent is not table related.

private static void
private static void
resolveTableContent(LayoutContext c, BlockBox parent, List<Styleable> children, BoxBuilder.ChildBoxInfo info)

Handles the situation when our current parent is table related.

private static InlineBox
private static void
splitParagraphs(LayoutContext c, Document document)

Split the document into paragraphs for use in analyzing bi-directional text runs.

private static void
private static List<Styleable>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait