Package com.openhtmltopdf.render
Class LineBox
- java.lang.Object
-
- com.openhtmltopdf.render.Box
-
- com.openhtmltopdf.render.LineBox
-
- All Implemented Interfaces:
InlinePaintable
,Styleable
,DisplayListItem
public class LineBox extends Box implements InlinePaintable
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
Fields Modifier and Type Field Description private int
_baseline
private boolean
_containsBlockLevelContent
private boolean
_containsContent
private boolean
_containsDynamicFunction
private int
_contentStart
private FloatDistances
_floatDistances
private boolean
_isEndsOnNL
private JustificationInfo
_justificationInfo
private MarkerData
_markerData
private java.util.List<Box>
_nonFlowContent
private int
_paintingHeight
private int
_paintingTop
private java.util.List<TextDecoration>
_textDecorations
private byte
direction
private static float
JUSTIFY_NON_SPACE_SHARE
private static float
JUSTIFY_SPACE_SHARE
private java.util.List<BlockBox>
referencedFootnoteBodies
-
Fields inherited from class com.openhtmltopdf.render.Box
CHILDREN_FLUX, DONE, DUMP_LAYOUT, DUMP_RENDER, FLUX, LINE_SEPARATOR, NOTHING
-
-
Constructor Summary
Constructors Constructor Description LineBox()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllChildren(java.util.List<? super Box> list, Layer layer)
void
addNonFlowContent(BlockBox box)
void
addReferencedFootnoteBody(BlockBox footnoteBody)
private void
adjustChildren(JustificationInfo info)
private void
adjustChildrenRTL(JustificationInfo info)
private void
afterChangePage(LayoutContext c)
void
align(boolean dynamic, CssContext c)
void
analyzePageBreaks(LayoutContext c, ContentLimitContainer container)
private void
beforeChangePage(LayoutContext c)
void
calcCanvasLocation()
void
calcChildLocations()
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, java.lang.StringBuilder buffer)
private CharCounts
countJustifiableChars()
java.lang.String
dump(LayoutContext c, java.lang.String indent, int which)
void
exportText(RenderingContext c, java.io.Writer writer)
Box
find(CssContext cssCtx, int absX, int absY, boolean findAnonymous)
InlineText
findTrailingText()
int
getBaseline()
int
getContentStart()
FloatDistances
getFloatDistances()
JustificationInfo
getJustificationInfo()
java.awt.Rectangle
getMarginEdge(CssContext cssCtx, int tx, int ty)
MarkerData
getMarkerData()
int
getMaxPaintingBottom()
int
getMinPaintingTop()
java.util.List<Box>
getNonFlowContent()
java.awt.Rectangle
getPaintingClipEdge(CssContext cssCtx)
int
getPaintingHeight()
int
getPaintingTop()
BlockBox
getParent()
Narrows the return type of LineBox to a BlockBox.java.util.List<BlockBox>
getReferencedFootnoteBodies()
Gets the list of footnote bodies which have calls in this line of text.java.util.List<TextDecoration>
getTextDecorations()
boolean
hasFootnotes()
boolean
hasNonTextContent(CssContext c)
boolean
intersects(CssContext cssCtx, java.awt.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, java.awt.Shape clip)
private boolean
intersectsLine(CssContext cssCtx, java.awt.Shape clip)
boolean
isContainsBlockLevelContent()
boolean
isContainsContent()
Whether this line contains any actual text content.boolean
isContainsDynamicFunction()
boolean
isContainsOnlyBlockLevelContent()
boolean
isContainsVisibleContent()
boolean
isEndsOnNL()
boolean
isFirstLine()
private boolean
isLastLineWithContent()
boolean
isLayedOutRTL()
boolean
isTerminalColumnBreak()
Is this box unbreakable in regards to column break opportunities?void
justify(CssContext c)
private void
lookForDynamicFunctions(RenderingContext c)
private boolean
overlapsFootnote(PageBox pageBox)
void
paintInline(RenderingContext c)
void
prunePendingInlineBoxes(LayoutContext c)
void
reset(LayoutContext c)
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(java.util.List<TextDecoration> textDecorations)
java.lang.String
toString()
void
trimTrailingSpace(LayoutContext c)
-
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 Detail
-
JUSTIFY_NON_SPACE_SHARE
private static final float JUSTIFY_NON_SPACE_SHARE
- See Also:
- Constant Field Values
-
JUSTIFY_SPACE_SHARE
private static final float JUSTIFY_SPACE_SHARE
- See Also:
- Constant Field Values
-
_containsContent
private boolean _containsContent
-
_containsBlockLevelContent
private boolean _containsBlockLevelContent
-
_isEndsOnNL
private boolean _isEndsOnNL
-
_floatDistances
private FloatDistances _floatDistances
-
_textDecorations
private java.util.List<TextDecoration> _textDecorations
-
_paintingTop
private int _paintingTop
-
_paintingHeight
private int _paintingHeight
-
_nonFlowContent
private java.util.List<Box> _nonFlowContent
-
_markerData
private MarkerData _markerData
-
_containsDynamicFunction
private boolean _containsDynamicFunction
-
_contentStart
private int _contentStart
-
_baseline
private int _baseline
-
_justificationInfo
private JustificationInfo _justificationInfo
-
direction
private byte direction
-
referencedFootnoteBodies
private java.util.List<BlockBox> referencedFootnoteBodies
-
-
Method Detail
-
dump
public java.lang.String dump(LayoutContext c, java.lang.String indent, int which)
-
getMarginEdge
public java.awt.Rectangle getMarginEdge(CssContext cssCtx, int tx, int ty)
- Overrides:
getMarginEdge
in classBox
-
paintInline
public void paintInline(RenderingContext c)
- Specified by:
paintInline
in interfaceInlinePaintable
-
lookForDynamicFunctions
private void lookForDynamicFunctions(RenderingContext c)
-
isFirstLine
public boolean isFirstLine()
-
prunePendingInlineBoxes
public void prunePendingInlineBoxes(LayoutContext c)
-
isContainsContent
public boolean isContainsContent()
Whether this line contains any actual text content.
-
setContainsContent
public void setContainsContent(boolean containsContent)
-
align
public void align(boolean dynamic, CssContext c)
-
justify
public void justify(CssContext c)
-
adjustChildren
private void adjustChildren(JustificationInfo info)
-
adjustChildrenRTL
private void adjustChildrenRTL(JustificationInfo info)
-
isLastLineWithContent
private boolean isLastLineWithContent()
-
countJustifiableChars
private CharCounts countJustifiableChars()
-
getFloatDistances
public FloatDistances getFloatDistances()
-
setFloatDistances
public void setFloatDistances(FloatDistances floatDistances)
-
isContainsBlockLevelContent
public boolean isContainsBlockLevelContent()
-
setContainsBlockLevelContent
public void setContainsBlockLevelContent(boolean containsBlockLevelContent)
-
intersects
public boolean intersects(CssContext cssCtx, java.awt.Shape clip)
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
private boolean intersectsLine(CssContext cssCtx, java.awt.Shape clip)
-
getPaintingClipEdge
public java.awt.Rectangle getPaintingClipEdge(CssContext cssCtx)
- Overrides:
getPaintingClipEdge
in classBox
-
intersectsInlineBlocks
private boolean intersectsInlineBlocks(CssContext cssCtx, java.awt.Shape clip)
-
getTextDecorations
public java.util.List<TextDecoration> getTextDecorations()
-
setTextDecorations
public void setTextDecorations(java.util.List<TextDecoration> textDecorations)
-
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()
-
getNonFlowContent
public java.util.List<Box> getNonFlowContent()
-
addNonFlowContent
public void addNonFlowContent(BlockBox box)
-
reset
public void reset(LayoutContext c)
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
public MarkerData getMarkerData()
-
setMarkerData
public void setMarkerData(MarkerData markerData)
-
isContainsDynamicFunction
public boolean isContainsDynamicFunction()
-
setContainsDynamicFunction
public void setContainsDynamicFunction(boolean containsPageCounter)
-
getContentStart
public int getContentStart()
-
setContentStart
public void setContentStart(int contentOffset)
-
findTrailingText
public InlineText findTrailingText()
-
trimTrailingSpace
public void trimTrailingSpace(LayoutContext c)
-
find
public Box find(CssContext cssCtx, int absX, int absY, boolean findAnonymous)
-
getBaseline
public int getBaseline()
-
setBaseline
public void setBaseline(int baseline)
-
isContainsOnlyBlockLevelContent
public boolean isContainsOnlyBlockLevelContent()
-
isContainsVisibleContent
public boolean isContainsVisibleContent()
-
collectText
public void collectText(RenderingContext c, java.lang.StringBuilder buffer)
- Overrides:
collectText
in classBox
-
exportText
public void exportText(RenderingContext c, java.io.Writer writer) throws java.io.IOException
- Overrides:
exportText
in classBox
- Throws:
java.io.IOException
-
analyzePageBreaks
public void analyzePageBreaks(LayoutContext c, ContentLimitContainer container)
- Overrides:
analyzePageBreaks
in classBox
-
checkPagePosition
public void checkPagePosition(LayoutContext c, boolean alwaysBreak)
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
private void afterChangePage(LayoutContext c)
-
beforeChangePage
private void beforeChangePage(LayoutContext c)
-
checkFootnoteReservedPage
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.
-
overlapsFootnote
private boolean overlapsFootnote(PageBox pageBox)
-
getJustificationInfo
public JustificationInfo getJustificationInfo()
-
setJustificationInfo
private void setJustificationInfo(JustificationInfo justificationInfo)
-
setDirectionality
public void setDirectionality(byte direction)
-
isLayedOutRTL
public boolean isLayedOutRTL()
-
hasNonTextContent
public boolean hasNonTextContent(CssContext c)
- 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
public java.util.List<BlockBox> 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
public void addReferencedFootnoteBody(BlockBox footnoteBody)
-
-