Class BlockBox

    • Field Detail

      • _listCounter

        private int _listCounter
      • _staticEquivalent

        private Box _staticEquivalent
      • _needPageClear

        private boolean _needPageClear
      • _inlineContent

        private java.util.List<Styleable> _inlineContent
      • _topMarginCalculated

        private boolean _topMarginCalculated
      • _bottomMarginCalculated

        private boolean _bottomMarginCalculated
      • _minWidth

        private int _minWidth
      • _maxWidth

        private int _maxWidth
      • _minMaxCalculated

        private boolean _minMaxCalculated
      • _dimensionsCalculated

        private boolean _dimensionsCalculated
      • _needShrinkToFitCalculatation

        private boolean _needShrinkToFitCalculatation
      • _childrenHeight

        private int _childrenHeight
      • _fromCaptionedTable

        private boolean _fromCaptionedTable
      • _isReplaced

        private boolean _isReplaced
    • Constructor Detail

      • BlockBox

        public BlockBox()
    • Method Detail

      • getExtraBoxDescription

        protected java.lang.String getExtraBoxDescription()
      • toString

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

        protected void appendPositioningInfo​(java.lang.StringBuilder result)
      • dump

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

        public boolean isListItem()
      • isInline

        public boolean isInline()
      • getLineBox

        public LineBox getLineBox()
      • getMarkerData

        public MarkerData getMarkerData()
      • setMarkerData

        public void setMarkerData​(MarkerData markerData)
      • createMarkerData

        public void createMarkerData​(LayoutContext c)
      • getListCounter

        public int getListCounter()
      • setListCounter

        public void setListCounter​(int listCounter)
      • setPersistentBFC

        public void setPersistentBFC​(PersistentBFC persistentBFC)
      • getStaticEquivalent

        public Box getStaticEquivalent()
      • setStaticEquivalent

        public void setStaticEquivalent​(Box staticEquivalent)
      • shouldBeReplaced

        public boolean shouldBeReplaced()
      • isReplaced

        public boolean isReplaced()
      • calcInitialFloatedCanvasLocation

        public void calcInitialFloatedCanvasLocation​(LayoutContext c)
      • isNeedPageClear

        public boolean isNeedPageClear()
      • setNeedPageClear

        public void setNeedPageClear​(boolean needPageClear)
      • alignToStaticEquivalent

        private void alignToStaticEquivalent()
      • positionAbsolute

        public void positionAbsolute​(CssContext cssCtx,
                                     int direction)
      • isPageBreakNeededBecauseOfMinHeight

        public boolean isPageBreakNeededBecauseOfMinHeight​(LayoutContext context)
        Using the css: -fs-page-break-min-height: 5cm; on a block element you can force a pagebreak before this block, if not enough space (e.g. 5cm in this case) is remaining on the current page for the block.
        Returns:
        true if a pagebreak is needed before this block because there is not enough space left on the current page.
      • positionAbsoluteOnPage

        public void positionAbsoluteOnPage​(LayoutContext c)
      • setReplacedElement

        public void setReplacedElement​(ReplacedElement replacedElement)
      • reset

        public void reset​(LayoutContext c)
        Description copied from class: Box
        Responsible for resetting the state of the box before a repeat call to 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
      • calcPinnedContentWidth

        private int calcPinnedContentWidth​(CssContext c)
      • calcPinnedHeight

        private int calcPinnedHeight​(CssContext c)
      • calcEffPageRelativeWidth

        private int calcEffPageRelativeWidth​(LayoutContext c)
      • createReplaced

        private void createReplaced​(LayoutContext c)
        Creates the replaced element as required. This method should be idempotent.
      • sizeReplacedElement

        private void sizeReplacedElement​(LayoutContext c,
                                         ReplacedElement re)
        Size a replaced element taking into account size properties including min/max, border-box/content-box and the natural size/aspect ratio of the replaced object. This method may be called multiple times so must be idempotent.
      • calcDimensions

        public void calcDimensions​(LayoutContext c)
      • calcDimensions

        protected void calcDimensions​(LayoutContext c,
                                      int cssWidth)
      • calcClearance

        private void calcClearance​(LayoutContext c)
      • calcExtraPageClearance

        private void calcExtraPageClearance​(LayoutContext c)
      • layout

        public void layout​(LayoutContext c,
                           int contentStart)
      • checkPopBfc

        protected void checkPopBfc​(LayoutContext c)
        Checks if this box established a block formatting context and if so removes the last bfc from the stack. See also checkPushBfc(LayoutContext)
      • checkPushBfc

        protected void checkPushBfc​(LayoutContext c)
        Checks if this box establishes a block formatting context and if so creates one and pushes it to the stack of bfcs. See also checkPopBfc(LayoutContext)
      • isAllowHeightToShrink

        protected boolean isAllowHeightToShrink()
      • getPageClearance

        protected int getPageClearance()
      • calcShrinkToFitWidthIfNeeded

        private void calcShrinkToFitWidthIfNeeded​(LayoutContext c)
      • applyCSSMinMaxWidth

        private void applyCSSMinMaxWidth​(CssContext c)
      • applyCSSMinMaxHeight

        private void applyCSSMinMaxHeight​(CssContext c)
      • ensureChildren

        public void ensureChildren​(LayoutContext c)
      • layoutChildren

        protected void layoutChildren​(LayoutContext c,
                                      int contentStart)
      • layoutInlineChildren

        protected void layoutInlineChildren​(LayoutContext c,
                                            int contentStart,
                                            int breakAtLine,
                                            boolean tryAgain)
      • satisfyWidowsAndOrphans

        private void satisfyWidowsAndOrphans​(LayoutContext c,
                                             int contentStart,
                                             boolean tryAgain)
        TERMINOLOGY: Orphans refers to the number of lines of content in this box before the first page break. Widows refers to the number of lines of content on the last page.

        METHOD AIM: This method aims (but can not guarantee) to satisfy the orphans and widows CSS properties. Each of these provide a number specifying a minimum number of content lines.

        HOW: By inserting page breaks, either before this box or between certain lines in this box.

        PREREQUISITES: That the content of this box is CONTENT_INLINE and layout has been done on this box. This means that the children of this box will consist entirely of LineBox objects.
      • setInlineContent

        public void setInlineContent​(java.util.List<Styleable> inlineContent)
        Inline content is created by the box builder. It is important to note that the inline content here is stored in the pre-layout state. Ie. It has not been flowed out into LineBox and InlineLayoutBox objects but is stored as InlineBox and block boxes that are laid out inline such as inline-block and inline-table.

        During layout inline-content is laid out into lines and so on but the inline content is left untouched so as to be able to run layout multiple times to satisfy constraints.

        This method should be called with setChildrenContentType(ContentType) set to BlockBox.ContentType.INLINE as block boxes can not contain mixed content.
      • isSkipWhenCollapsingMargins

        protected boolean isSkipWhenCollapsingMargins()
      • isMayCollapseMarginsWithChildren

        protected boolean isMayCollapseMarginsWithChildren()
      • collapseMargins

        protected void collapseMargins​(LayoutContext c)
      • isNoTopPaddingOrBorder

        private boolean isNoTopPaddingOrBorder​(LayoutContext c)
      • isNoBottomPaddingOrBorder

        private boolean isNoBottomPaddingOrBorder​(LayoutContext c)
      • isVerticalMarginsAdjoin

        private boolean isVerticalMarginsAdjoin​(LayoutContext c)
      • isTopMarginCalculated

        public boolean isTopMarginCalculated()
      • setTopMarginCalculated

        public void setTopMarginCalculated​(boolean topMarginCalculated)
      • isBottomMarginCalculated

        public boolean isBottomMarginCalculated()
      • setBottomMarginCalculated

        public void setBottomMarginCalculated​(boolean bottomMarginCalculated)
      • getCSSWidth

        protected int getCSSWidth​(CssContext c)
      • getCSSWidth

        protected int getCSSWidth​(CssContext c,
                                  boolean shrinkingToFit)
      • getCSSFitToWidth

        protected int getCSSFitToWidth​(CssContext c)
      • getCSSHeight

        protected int getCSSHeight​(CssContext c)
      • isAutoHeight

        public boolean isAutoHeight()
      • getCSSMinWidth

        private int getCSSMinWidth​(CssContext c)
      • getCSSMaxWidth

        private int getCSSMaxWidth​(CssContext c)
      • getCSSMinHeight

        private int getCSSMinHeight​(CssContext c)
      • getCSSMaxHeight

        private int getCSSMaxHeight​(CssContext c)
      • getContainingBlockCSSHeight

        private int getContainingBlockCSSHeight​(CssContext c)
      • calcShrinkToFitWidth

        private int calcShrinkToFitWidth​(LayoutContext c)
      • getAvailableWidth

        protected int getAvailableWidth​(LayoutContext c)
      • isFixedWidthAdvisoryOnly

        protected boolean isFixedWidthAdvisoryOnly()
      • calcMinMaxWidth

        public void calcMinMaxWidth​(LayoutContext c)
      • calcMinMaxWidthBlockChildren

        private void calcMinMaxWidthBlockChildren​(LayoutContext c)
      • calcMinMaxWidthInlineChildren

        private void calcMinMaxWidthInlineChildren​(LayoutContext c)
      • getMaxWidth

        public int getMaxWidth()
      • setMaxWidth

        protected void setMaxWidth​(int maxWidth)
      • getMinWidth

        public int getMinWidth()
      • setMinWidth

        protected void setMinWidth​(int minWidth)
      • getFirstLetterStyle

        public CascadedStyle getFirstLetterStyle()
      • setFirstLetterStyle

        public void setFirstLetterStyle​(CascadedStyle firstLetterStyle)
      • setFirstLineStyle

        public void setFirstLineStyle​(CascadedStyle firstLineStyle)
      • isMinMaxCalculated

        protected boolean isMinMaxCalculated()
      • setMinMaxCalculated

        protected void setMinMaxCalculated​(boolean minMaxCalculated)
      • setDimensionsCalculated

        protected void setDimensionsCalculated​(boolean dimensionsCalculated)
      • isDimensionsCalculated

        private boolean isDimensionsCalculated()
      • setNeedShrinkToFitCalculatation

        protected void setNeedShrinkToFitCalculatation​(boolean needShrinkToFitCalculatation)
      • isNeedShrinkToFitCalculatation

        private boolean isNeedShrinkToFitCalculatation()
      • calcInitialBreakAtLine

        protected int calcInitialBreakAtLine​(LayoutContext c)
      • isCurrentBreakAtLineContext

        public boolean isCurrentBreakAtLineContext​(LayoutContext c)
      • calcInlineBaseline

        public int calcInlineBaseline​(CssContext c)
      • findOffset

        public int findOffset​(Box box)
      • findLastNthLineBox

        public LineBox findLastNthLineBox​(int count)
      • findLastLineBox

        private LineBox findLastLineBox()
      • findFirstLineBox

        private LineBox findFirstLineBox()
      • isNeedsKeepWithInline

        public boolean isNeedsKeepWithInline​(LayoutContext c)
      • isFloated

        public boolean isFloated()
      • setFloatedBoxData

        public void setFloatedBoxData​(FloatedBoxData floatedBoxData)
      • getChildrenHeight

        public int getChildrenHeight()
      • setChildrenHeight

        protected void setChildrenHeight​(int childrenHeight)
      • isFromCaptionedTable

        public boolean isFromCaptionedTable()
      • setFromCaptionedTable

        public void setFromCaptionedTable​(boolean fromTable)
      • isInlineBlock

        protected boolean isInlineBlock()
        Overrides:
        isInlineBlock in class Box
      • isInMainFlow

        public boolean isInMainFlow()
      • isContainsInlineContent

        public boolean isContainsInlineContent​(LayoutContext c)
      • checkPageContext

        public boolean checkPageContext​(LayoutContext c)
      • isNeedsClipOnPaint

        public boolean isNeedsClipOnPaint​(CssContext c)