Class Box

java.lang.Object
org.xhtmlrenderer.render.Box
All Implemented Interfaces:
Styleable
Direct Known Subclasses:
BlockBox, InlineLayoutBox, LineBox

public abstract class Box extends Object implements Styleable
  • Field Details

    • _element

      private @Nullable Element _element
    • _x

      private int _x
    • _y

      private int _y
    • _absY

      private int _absY
    • _absX

      private int _absX
    • _contentWidth

      private int _contentWidth
      Box width.
    • _rightMBP

      private int _rightMBP
    • _leftMBP

      private int _leftMBP
    • _height

      private int _height
    • _layer

      private @Nullable Layer _layer
    • _containingLayer

      private @Nullable Layer _containingLayer
    • _parent

      private @Nullable Box _parent
    • _boxes

      private final List<Box> _boxes
    • _tx

      private int _tx
      Keeps track of the start of children's containing block.
    • _ty

      private int _ty
    • _style

      private @Nullable CalculatedStyle _style
    • _containingBlock

      private @Nullable Box _containingBlock
    • _relativeOffset

      private @Nullable Dimension _relativeOffset
    • _paintingInfo

      private @Nullable PaintingInfo _paintingInfo
    • _workingMargin

      private @Nullable RectPropertySet _workingMargin
    • _index

      private int _index
    • _pseudoElementOrClass

      private @Nullable String _pseudoElementOrClass
    • _anonymous

      private final boolean _anonymous
    • _state

      private volatile Box.State _state
  • Constructor Details

  • Method Details

    • dump

      public abstract String dump(LayoutContext c, String indent, Box.Dump which)
    • dumpBoxes

      protected void dumpBoxes(LayoutContext c, String indent, List<Box> boxes, Box.Dump which, StringBuilder result)
    • getWidth

      public int getWidth()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • appendPosition

      protected void appendPosition(StringBuilder result)
    • appendSize

      protected void appendSize(StringBuilder result)
    • addChildForLayout

      public void addChildForLayout(LayoutContext c, Box child)
    • addChild

      public void addChild(Box child)
    • addAllChildren

      public void addAllChildren(List<Box> children)
    • removeAllChildren

      public void removeAllChildren()
    • removeChild

      public void removeChild(Box target)
    • getPreviousSibling

      @CheckReturnValue public @Nullable Box getPreviousSibling()
    • getNextSibling

      @CheckReturnValue public @Nullable Box getNextSibling()
    • getPrevious

      @CheckReturnValue protected @Nullable Box getPrevious(Box child)
    • getNext

      @CheckReturnValue protected @Nullable Box getNext(Box child)
    • removeChild

      public void removeChild(int i)
    • setParent

      public void setParent(@Nullable Box box)
    • getParent

      @CheckReturnValue public @Nullable Box getParent()
    • getChildCount

      public int getChildCount()
    • getChild

      @CheckReturnValue public Box getChild(int i)
    • getChildren

      @CheckReturnValue public List<Box> getChildren()
    • getState

      public Box.State getState()
    • setState

      public void setState(Box.State state)
    • getStyle

      @CheckReturnValue public final @Nullable CalculatedStyle getStyle()
      Specified by:
      getStyle in interface Styleable
    • setStyle

      public void setStyle(@Nullable CalculatedStyle style)
      Specified by:
      setStyle in interface Styleable
    • getContainingBlock

      @CheckReturnValue public @Nullable Box getContainingBlock()
    • setContainingBlock

      public void setContainingBlock(Box containingBlock)
    • getMarginEdge

      public Rectangle getMarginEdge(int left, int top, CssContext cssCtx, int tx, int ty)
    • getMarginEdge

      public Rectangle getMarginEdge(CssContext cssCtx, int tx, int ty)
    • getPaintingBorderEdge

      public Rectangle getPaintingBorderEdge(CssContext cssCtx)
    • getPaintingPaddingEdge

      @CheckReturnValue public Rectangle getPaintingPaddingEdge(CssContext cssCtx)
    • getPaintingClipEdge

      public Rectangle getPaintingClipEdge(CssContext cssCtx)
    • getChildrenClipEdge

      @CheckReturnValue public Rectangle getChildrenClipEdge(RenderingContext c)
    • intersects

      public boolean intersects(CssContext cssCtx, @Nullable Shape clip)
      NOTE: This method does not consider any children of this box
    • getBorderEdge

      public Rectangle getBorderEdge(int left, int top, CssContext cssCtx)
    • getPaddingEdge

      @CheckReturnValue public Rectangle getPaddingEdge(int left, int top, CssContext cssCtx)
    • getPaddingWidth

      protected int getPaddingWidth(CssContext cssCtx)
    • getContentAreaEdge

      public Rectangle getContentAreaEdge(int left, int top, CssContext cssCtx)
    • getLayer

      @CheckReturnValue public @Nullable Layer getLayer()
    • setLayer

      public void setLayer(@Nullable Layer layer)
    • positionRelative

      public Dimension positionRelative(CssContext cssCtx)
    • isInlineBlock

      protected boolean isInlineBlock()
    • setAbsY

      public void setAbsY(int absY)
    • getAbsY

      public int getAbsY()
    • setAbsX

      public void setAbsX(int absX)
    • getAbsX

      public int getAbsX()
    • isStyled

      public boolean isStyled()
    • getBorderSides

      public int getBorderSides()
    • paintBorder

      public void paintBorder(RenderingContext c)
    • isPaintsRootElementBackground

      private boolean isPaintsRootElementBackground()
    • paintBackground

      public void paintBackground(RenderingContext c)
    • paintRootElementBackground

      public void paintRootElementBackground(RenderingContext c)
    • paintRootElementBackground

      private void paintRootElementBackground(RenderingContext c, PaintingInfo pI)
    • getContainingLayer

      public @Nullable Layer getContainingLayer()
    • setContainingLayer

      public void setContainingLayer(@Nullable Layer containingLayer)
    • initContainingLayer

      public void initContainingLayer(LayoutContext c)
    • connectChildrenToCurrentLayer

      public void connectChildrenToCurrentLayer(LayoutContext c)
    • getElementBoxes

      public List<Box> getElementBoxes(Element elem)
    • reset

      public void reset(LayoutContext c)
    • detach

      public void detach(LayoutContext c)
    • resetChildren

      public void resetChildren(LayoutContext c, int start, int end)
    • resetChildren

      protected void resetChildren(LayoutContext c)
    • calcCanvasLocation

      public abstract void calcCanvasLocation()
    • calcChildLocations

      public void calcChildLocations()
    • forcePageBreakBefore

      public int forcePageBreakBefore(LayoutContext c, IdentValue pageBreakValue, boolean pendingPageName)
    • forcePageBreakAfter

      public void forcePageBreakAfter(LayoutContext c, IdentValue pageBreakValue)
    • crossesPageBreak

      public boolean crossesPageBreak(LayoutContext c)
    • getRelativeOffset

      @CheckReturnValue public @Nullable Dimension getRelativeOffset()
    • find

      @CheckReturnValue public @Nullable Box find(CssContext cssCtx, int absX, int absY, boolean findAnonymous)
    • isRoot

      public boolean isRoot()
    • isBody

      public boolean isBody()
    • getElement

      @CheckReturnValue public @Nullable Element getElement()
      Specified by:
      getElement in interface Styleable
    • setElement

      public final void setElement(@Nullable Element element)
      Specified by:
      setElement in interface Styleable
    • setMarginTop

      protected final void setMarginTop(CssContext cssContext, int marginTop)
    • setMarginBottom

      protected void setMarginBottom(CssContext cssContext, int marginBottom)
    • setMarginLeft

      public void setMarginLeft(CssContext cssContext, int marginLeft)
    • setMarginRight

      protected void setMarginRight(CssContext cssContext, int marginRight)
    • ensureWorkingMargin

      @CheckReturnValue private @NonNull RectPropertySet ensureWorkingMargin(CssContext cssContext)
    • getMargin

      public RectPropertySet getMargin(CssContext cssContext)
    • getStyleMargin

      protected RectPropertySet getStyleMargin(CssContext cssContext)
    • getStyleMarginNoCache

      protected RectPropertySet getStyleMarginNoCache(CssContext cssContext)
    • getPadding

      public RectPropertySet getPadding(CssContext cssCtx)
    • getBorder

      public BorderPropertySet getBorder(CssContext cssCtx)
    • getContainingBlockWidth

      protected int getContainingBlockWidth()
    • resetTopMargin

      protected void resetTopMargin(CssContext cssContext)
    • clearSelection

      public void clearSelection(List<Box> modified)
    • selectAll

      public void selectAll()
    • calcPaintingInfo

      public PaintingInfo calcPaintingInfo(CssContext c, boolean useCache)
    • calcChildPaintingInfo

      protected void calcChildPaintingInfo(CssContext c, PaintingInfo result, boolean useCache)
    • getMarginBorderPadding

      public int getMarginBorderPadding(CssContext cssCtx, CalculatedStyle.Edge edge)
    • moveIfGreater

      protected void moveIfGreater(Dimension result, Dimension test)
    • restyle

      public void restyle(LayoutContext c)
    • restyleChildren

      protected void restyleChildren(LayoutContext c)
    • getRestyleTarget

      public Box getRestyleTarget()
    • getIndex

      protected int getIndex()
    • setIndex

      protected void setIndex(int index)
    • getPseudoElementOrClass

      @CheckReturnValue public @Nullable String getPseudoElementOrClass()
      Specified by:
      getPseudoElementOrClass in interface Styleable
    • setPseudoElementOrClass

      public void setPseudoElementOrClass(String pseudoElementOrClass)
    • setX

      public void setX(int x)
    • getX

      public int getX()
    • setY

      public void setY(int y)
    • getY

      public int getY()
    • setTy

      public void setTy(int ty)
    • getTy

      public int getTy()
    • setTx

      public void setTx(int tx)
    • getTx

      public int getTx()
    • setRightMBP

      public void setRightMBP(int rightMBP)
    • getRightMBP

      public int getRightMBP()
    • setLeftMBP

      public void setLeftMBP(int leftMBP)
    • getLeftMBP

      public int getLeftMBP()
    • setHeight

      public void setHeight(int height)
    • getHeight

      public int getHeight()
    • setContentWidth

      public void setContentWidth(int contentWidth)
    • getContentWidth

      public int getContentWidth()
    • getPaintingInfo

      @CheckReturnValue public @Nullable PaintingInfo getPaintingInfo()
    • setPaintingInfo

      private void setPaintingInfo(@Nullable PaintingInfo paintingInfo)
    • isAnonymous

      public boolean isAnonymous()
    • getBoxDimensions

      public BoxDimensions getBoxDimensions()
    • setBoxDimensions

      public void setBoxDimensions(BoxDimensions dimensions)
    • collectText

      public void collectText(RenderingContext c, StringBuilder buffer) throws IOException
      Throws:
      IOException
    • exportText

      public void exportText(RenderingContext c, Writer writer) throws IOException
      Throws:
      IOException
    • exportPageBoxText

      private void exportPageBoxText(RenderingContext c, Writer writer) throws IOException
      Throws:
      IOException
    • exportPageBoxText

      protected void exportPageBoxText(RenderingContext c, Writer writer, int yPos) throws IOException
      Throws:
      IOException
    • isInDocumentFlow

      public boolean isInDocumentFlow()
    • analyzePageBreaks

      public void analyzePageBreaks(LayoutContext c, ContentLimitContainer container)
    • getEffBackgroundColor

      public FSColor getEffBackgroundColor(RenderingContext c)
    • isMarginAreaRoot

      protected boolean isMarginAreaRoot()
    • isContainedInMarginBox

      public boolean isContainedInMarginBox()
    • getEffectiveWidth

      public int getEffectiveWidth()
    • isInitialContainingBlock

      protected boolean isInitialContainingBlock()