Class 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.
    • Field Detail

      • JUSTIFY_NON_SPACE_SHARE

        private static final float JUSTIFY_NON_SPACE_SHARE
        See Also:
        Constant Field Values
      • _containsContent

        private boolean _containsContent
      • _containsBlockLevelContent

        private boolean _containsBlockLevelContent
      • _isEndsOnNL

        private boolean _isEndsOnNL
      • _textDecorations

        private java.util.List<TextDecoration> _textDecorations
      • _paintingTop

        private int _paintingTop
      • _paintingHeight

        private int _paintingHeight
      • _nonFlowContent

        private java.util.List<Box> _nonFlowContent
      • _containsDynamicFunction

        private boolean _containsDynamicFunction
      • _contentStart

        private int _contentStart
      • _baseline

        private int _baseline
      • direction

        private byte direction
      • referencedFootnoteBodies

        private java.util.List<BlockBox> referencedFootnoteBodies
    • Constructor Detail

      • LineBox

        public LineBox()
    • Method Detail

      • dump

        public java.lang.String dump​(LayoutContext c,
                                     java.lang.String indent,
                                     int which)
        Specified by:
        dump in class Box
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Box
      • getMarginEdge

        public java.awt.Rectangle getMarginEdge​(CssContext cssCtx,
                                                int tx,
                                                int ty)
        Overrides:
        getMarginEdge in class Box
      • 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)
      • isLastLineWithContent

        private boolean isLastLineWithContent()
      • countJustifiableChars

        private CharCounts countJustifiableChars()
      • 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 class Box
      • intersectsLine

        private boolean intersectsLine​(CssContext cssCtx,
                                       java.awt.Shape clip)
      • 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()
      • addAllChildren

        public void addAllChildren​(java.util.List<? super Box> list,
                                   Layer layer)
      • 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 to BlockBox.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.
        Overrides:
        reset in class Box
      • 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)
        Overrides:
        find in class Box
      • getBaseline

        public int getBaseline()
      • setBaseline

        public void setBaseline​(int baseline)
      • isContainsOnlyBlockLevelContent

        public boolean isContainsOnlyBlockLevelContent()
      • isContainsVisibleContent

        public boolean isContainsVisibleContent()
      • exportText

        public void exportText​(RenderingContext c,
                               java.io.Writer writer)
                        throws java.io.IOException
        Overrides:
        exportText in class Box
        Throws:
        java.io.IOException
      • 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)
      • setJustificationInfo

        private void setJustificationInfo​(JustificationInfo justificationInfo)
      • setDirectionality

        public void setDirectionality​(byte direction)
      • isLayedOutRTL

        public boolean isLayedOutRTL()
      • isTerminalColumnBreak

        public boolean isTerminalColumnBreak()
        Description copied from class: Box
        Is this box unbreakable in regards to column break opportunities?
        Overrides:
        isTerminalColumnBreak in class Box
      • 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.
      • getParent

        public BlockBox getParent()
        Narrows the return type of LineBox to a BlockBox. Reduces the need to cast everywhere.
        Overrides:
        getParent in class Box