Package com.openhtmltopdf.render
Class LineBox
java.lang.Object
com.openhtmltopdf.render.Box
com.openhtmltopdf.render.LineBox
- All Implemented Interfaces:
InlinePaintable
,Styleable
,DisplayListItem
A line box contains a single line of text (or other inline content). It
is created during layout. It also tracks floated and absolute content
added while laying out the line.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openhtmltopdf.render.Box
Box.ChildIteratorOfType<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private boolean
private boolean
private boolean
private int
private FloatDistances
private boolean
private JustificationInfo
private MarkerData
private int
private int
private List
<TextDecoration> private byte
private static final float
private static final float
Fields inherited from class com.openhtmltopdf.render.Box
CHILDREN_FLUX, DONE, DUMP_LAYOUT, DUMP_RENDER, FLUX, LINE_SEPARATOR, NOTHING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllChildren
(List<? super Box> list, Layer layer) void
void
addReferencedFootnoteBody
(BlockBox footnoteBody) private void
private void
private void
void
align
(boolean dynamic, CssContext c) void
analyzePageBreaks
(LayoutContext c, ContentLimitContainer container) private void
void
void
private void
checkFootnoteReservedPage
(LayoutContext c, PageBox pageBoxAfter, boolean runHooks) Checks that the line box is not on a footnote reserved page and if so pushes it down to the first non-reserved page.void
checkPagePosition
(LayoutContext c, boolean alwaysBreak) Checks if this line box crosses a page break and if so moves it to the next page.void
collectText
(RenderingContext c, StringBuilder buffer) private CharCounts
dump
(LayoutContext c, String indent, int which) void
exportText
(RenderingContext c, Writer writer) find
(CssContext cssCtx, int absX, int absY, boolean findAnonymous) int
int
getMarginEdge
(CssContext cssCtx, int tx, int ty) int
int
getPaintingClipEdge
(CssContext cssCtx) int
int
Narrows the return type of LineBox to a BlockBox.Gets the list of footnote bodies which have calls in this line of text.boolean
boolean
boolean
intersects
(CssContext cssCtx, Shape clip) NOTE: This method does not consider any children of this box but does consider the transformation matrix of the containing layer.private boolean
intersectsInlineBlocks
(CssContext cssCtx, Shape clip) private boolean
intersectsLine
(CssContext cssCtx, Shape clip) boolean
boolean
Whether this line contains any actual text content.boolean
boolean
boolean
boolean
boolean
private boolean
boolean
boolean
Is this box unbreakable in regards to column break opportunities?void
private void
private boolean
overlapsFootnote
(PageBox pageBox) void
void
void
Responsible for resetting the state of the box before a repeat call toBlockBox.layout(LayoutContext)
or other layout methods.void
setBaseline
(int baseline) void
setContainsBlockLevelContent
(boolean containsBlockLevelContent) void
setContainsContent
(boolean containsContent) void
setContainsDynamicFunction
(boolean containsPageCounter) void
setContentStart
(int contentOffset) void
setDirectionality
(byte direction) void
setEndsOnNL
(boolean endsOnNL) void
setFloatDistances
(FloatDistances floatDistances) private void
setJustificationInfo
(JustificationInfo justificationInfo) void
setMarkerData
(MarkerData markerData) void
setPaintingHeight
(int paintingHeight) void
setPaintingTop
(int paintingTop) void
setTextDecorations
(List<TextDecoration> textDecorations) toString()
void
Methods inherited from class com.openhtmltopdf.render.Box
addAllChildren, addChild, addChildForLayout, ancestors, ancestorsWhile, calcChildPaintingInfo, calcPaintingInfo, connectChildrenToCurrentLayer, crossesPageBreak, detach, dumpBoxes, exportPageBoxText, findAncestor, findColumnBreakOpportunities, forcePageBreakAfter, forcePageBreakBefore, forcePageBreakBefore, getAbsoluteClipBox, getAbsX, getAbsY, getAccessibilityObject, getBorder, getBorderBox, getBorderBoxHeight, getBorderBoxWidth, getBorderEdge, getBorderSides, getBoxDimensions, getChild, getChildCount, getChildIterator, getChildIteratorOfType, getChildren, getChildrenClipEdge, getClipBox, getContainingBlock, getContainingBlockWidth, getContainingLayer, getContentAreaEdge, getContentWidth, getDocumentParent, getEffBackgroundColor, getEffectiveWidth, getElement, getElementBoxes, getHeight, getIndex, getLayer, getLeftMBP, getMargin, getMarginBorderPadding, getMarginEdge, getNext, getNextSibling, getPadding, getPaddingEdge, getPaddingWidth, getPaintingBorderEdge, getPaintingInfo, getPaintingPaddingEdge, getParentClipBox, getPrevious, getPreviousSibling, getPseudoElementOrClass, getRelativeOffset, getRightMBP, getState, getStyle, getStyleMargin, getStyleMargin, getTx, getTy, getWidth, getX, getY, hasRootElementBackground, initContainingLayer, isAnonymous, isBody, isContainedInMarginBox, isFirstChild, isInDocumentFlow, isInitialContainingBlock, isInlineBlock, isMarginAreaRoot, isRoot, isStyled, moveIfGreater, paintBackground, paintBorder, paintRootElementBackground, positionRelative, removeAllChildren, removeChild, removeChild, resetChildren, resetChildren, resetTopMargin, rootBox, setAbsX, setAbsY, setAccessiblityObject, setAnonymous, setBorderBoxHeight, setBorderBoxWidth, setBoxDimensions, setContainingBlock, setContainingLayer, setContentWidth, setElement, setHeight, setIndex, setLayer, setLeftMBP, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setParent, setPseudoElementOrClass, setRelativeOffset, setRightMBP, setState, setStyle, setTx, setTy, setX, setY, stateToString
-
Field Details
-
JUSTIFY_NON_SPACE_SHARE
private static final float JUSTIFY_NON_SPACE_SHARE- See Also:
-
JUSTIFY_SPACE_SHARE
private static final float JUSTIFY_SPACE_SHARE- See Also:
-
_containsContent
private boolean _containsContent -
_containsBlockLevelContent
private boolean _containsBlockLevelContent -
_isEndsOnNL
private boolean _isEndsOnNL -
_floatDistances
-
_textDecorations
-
_paintingTop
private int _paintingTop -
_paintingHeight
private int _paintingHeight -
_nonFlowContent
-
_markerData
-
_containsDynamicFunction
private boolean _containsDynamicFunction -
_contentStart
private int _contentStart -
_baseline
private int _baseline -
_justificationInfo
-
direction
private byte direction -
referencedFootnoteBodies
-
-
Constructor Details
-
LineBox
public LineBox()
-
-
Method Details
-
dump
-
toString
-
getMarginEdge
- Overrides:
getMarginEdge
in classBox
-
paintInline
- Specified by:
paintInline
in interfaceInlinePaintable
-
lookForDynamicFunctions
-
isFirstLine
public boolean isFirstLine() -
prunePendingInlineBoxes
-
isContainsContent
public boolean isContainsContent()Whether this line contains any actual text content. -
setContainsContent
public void setContainsContent(boolean containsContent) -
align
-
justify
-
adjustChildren
-
adjustChildrenRTL
-
isLastLineWithContent
private boolean isLastLineWithContent() -
countJustifiableChars
-
getFloatDistances
-
setFloatDistances
-
isContainsBlockLevelContent
public boolean isContainsBlockLevelContent() -
setContainsBlockLevelContent
public void setContainsBlockLevelContent(boolean containsBlockLevelContent) -
intersects
Description copied from class:Box
NOTE: This method does not consider any children of this box but does consider the transformation matrix of the containing layer.- Overrides:
intersects
in classBox
-
intersectsLine
-
getPaintingClipEdge
- Overrides:
getPaintingClipEdge
in classBox
-
intersectsInlineBlocks
-
getTextDecorations
-
setTextDecorations
-
getPaintingHeight
public int getPaintingHeight() -
setPaintingHeight
public void setPaintingHeight(int paintingHeight) -
getPaintingTop
public int getPaintingTop() -
setPaintingTop
public void setPaintingTop(int paintingTop) -
getMinPaintingTop
public int getMinPaintingTop() -
getMaxPaintingBottom
public int getMaxPaintingBottom() -
addAllChildren
-
getNonFlowContent
-
addNonFlowContent
-
reset
Description copied from class:Box
Responsible for resetting the state of the box before a repeat call toBlockBox.layout(LayoutContext)
or other layout methods.
Any layout operation that is not idempotent MUST be reset in this method. Layout may be called several times on the one box. -
calcCanvasLocation
public void calcCanvasLocation()- Specified by:
calcCanvasLocation
in classBox
-
calcChildLocations
public void calcChildLocations()- Overrides:
calcChildLocations
in classBox
-
getMarkerData
-
setMarkerData
-
isContainsDynamicFunction
public boolean isContainsDynamicFunction() -
setContainsDynamicFunction
public void setContainsDynamicFunction(boolean containsPageCounter) -
getContentStart
public int getContentStart() -
setContentStart
public void setContentStart(int contentOffset) -
findTrailingText
-
trimTrailingSpace
-
find
-
getBaseline
public int getBaseline() -
setBaseline
public void setBaseline(int baseline) -
isContainsOnlyBlockLevelContent
public boolean isContainsOnlyBlockLevelContent() -
isContainsVisibleContent
public boolean isContainsVisibleContent() -
collectText
- Overrides:
collectText
in classBox
-
exportText
- Overrides:
exportText
in classBox
- Throws:
IOException
-
analyzePageBreaks
- Overrides:
analyzePageBreaks
in classBox
-
checkPagePosition
Checks if this line box crosses a page break and if so moves it to the next page. Also takes care that in-flow lines do not overlap footnote content. -
afterChangePage
-
beforeChangePage
-
checkFootnoteReservedPage
Checks that the line box is not on a footnote reserved page and if so pushes it down to the first non-reserved page. -
overlapsFootnote
-
getJustificationInfo
-
setJustificationInfo
-
setDirectionality
public void setDirectionality(byte direction) -
isLayedOutRTL
public boolean isLayedOutRTL() -
hasNonTextContent
- Overrides:
hasNonTextContent
in classBox
-
isTerminalColumnBreak
public boolean isTerminalColumnBreak()Description copied from class:Box
Is this box unbreakable in regards to column break opportunities?- Overrides:
isTerminalColumnBreak
in classBox
-
isEndsOnNL
public boolean isEndsOnNL() -
setEndsOnNL
public void setEndsOnNL(boolean endsOnNL) -
getReferencedFootnoteBodies
Gets the list of footnote bodies which have calls in this line of text. Useful for moving those footnotes when this line is moved to a new page. -
hasFootnotes
public boolean hasFootnotes() -
addReferencedFootnoteBody
-
getParent
Narrows the return type of LineBox to a BlockBox. Reduces the need to cast everywhere.
-