Package com.openhtmltopdf.render
Class BlockBox
- java.lang.Object
-
- com.openhtmltopdf.render.Box
-
- com.openhtmltopdf.render.BlockBox
-
- All Implemented Interfaces:
InlinePaintable,Styleable,DisplayListItem
- Direct Known Subclasses:
AnonymousBlockBox,FlowingColumnBox,FlowingColumnContainerBox,MarginBox,TableBox,TableCellBox,TableRowBox,TableSectionBox,ViewportBox
public class BlockBox extends Box implements InlinePaintable
A block box as defined in the CSS spec. It also provides a base class for other kinds of block content (for example table rows or cells).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBlockBox.MarginCollapseResult
-
Field Summary
Fields Modifier and Type Field Description static intCONTENT_BLOCKstatic intCONTENT_EMPTYstatic intCONTENT_INLINEstatic intCONTENT_UNKNOWNprotected static intNO_BASELINEstatic intPOSITION_BOTHstatic intPOSITION_HORIZONTALLYstatic intPOSITION_VERTICALLY-
Fields inherited from class com.openhtmltopdf.render.Box
CHILDREN_FLUX, DONE, DUMP_LAYOUT, DUMP_RENDER, FLUX, LINE_SEPARATOR, NOTHING
-
-
Constructor Summary
Constructors Constructor Description BlockBox()
-
Method Summary
-
Methods inherited from class com.openhtmltopdf.render.Box
addAllChildren, addChild, addChildForLayout, analyzePageBreaks, calcPaintingInfo, collectText, connectChildrenToCurrentLayer, crossesPageBreak, detach, dumpBoxes, exportPageBoxText, exportText, find, forcePageBreakAfter, forcePageBreakBefore, getAbsoluteClipBox, getAbsX, getAbsY, getAccessibilityObject, getBorder, getBorderBox, getBorderBoxHeight, getBorderBoxWidth, getBorderEdge, getBorderSides, getBoxDimensions, getChild, getChildCount, getChildIterator, getChildren, getChildrenClipEdge, getClipBox, getContainingBlock, getContainingBlockWidth, getContainingLayer, getContentAreaEdge, getContentWidth, getEffBackgroundColor, getEffectiveWidth, getElement, getElementBoxes, getHeight, getIndex, getLayer, getLeftMBP, getMargin, getMarginBorderPadding, getMarginEdge, getMarginEdge, getNext, getNextSibling, getPadding, getPaddingEdge, getPaddingWidth, getPaintingBorderEdge, getPaintingInfo, getPaintingPaddingEdge, getParent, getParentClipBox, getPrevious, getPreviousSibling, getPseudoElementOrClass, getRelativeOffset, getRestyleTarget, getRightMBP, getState, getStyle, getStyleMargin, getStyleMargin, getTx, getTy, getWidth, getX, getY, hasNonTextContent, hasRootElementBackground, initContainingLayer, intersects, isAnonymous, isBody, isContainedInMarginBox, isFlowingColumnBox, isInDocumentFlow, isInitialContainingBlock, isMarginAreaRoot, isRoot, isStyled, moveIfGreater, paintBackground, paintBorder, paintRootElementBackground, positionRelative, removeAllChildren, removeChild, removeChild, resetChildren, resetChildren, resetTopMargin, restyle, restyleChildren, setAbsX, setAbsY, setAccessiblityObject, setAnonymous, setBorderBoxHeight, setBorderBoxWidth, setBoxDimensions, setContainingBlock, setContainingLayer, setContentWidth, setHeight, setIndex, setLayer, setLeftMBP, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setParent, setPseudoElementOrClass, setRelativeOffset, setRightMBP, setState, setStyle, setTx, setTy, setX, setY, stateToString
-
-
-
-
Field Detail
-
POSITION_VERTICALLY
public static final int POSITION_VERTICALLY
- See Also:
- Constant Field Values
-
POSITION_HORIZONTALLY
public static final int POSITION_HORIZONTALLY
- See Also:
- Constant Field Values
-
POSITION_BOTH
public static final int POSITION_BOTH
- See Also:
- Constant Field Values
-
CONTENT_UNKNOWN
public static final int CONTENT_UNKNOWN
- See Also:
- Constant Field Values
-
CONTENT_INLINE
public static final int CONTENT_INLINE
- See Also:
- Constant Field Values
-
CONTENT_BLOCK
public static final int CONTENT_BLOCK
- See Also:
- Constant Field Values
-
CONTENT_EMPTY
public static final int CONTENT_EMPTY
- See Also:
- Constant Field Values
-
NO_BASELINE
protected static final int NO_BASELINE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setElement
public void setElement(Element element)
- Specified by:
setElementin interfaceStyleable- Overrides:
setElementin classBox
-
copyOf
public BlockBox copyOf()
-
getExtraBoxDescription
protected String getExtraBoxDescription()
-
appendPositioningInfo
protected void appendPositioningInfo(StringBuilder result)
-
dump
public String dump(LayoutContext c, String indent, int which)
-
isListItem
public boolean isListItem()
-
paintListMarker
public void paintListMarker(RenderingContext c)
-
getPaintingClipEdge
public Rectangle getPaintingClipEdge(CssContext cssCtx)
- Overrides:
getPaintingClipEdgein classBox
-
paintInline
public void paintInline(RenderingContext c)
- Specified by:
paintInlinein interfaceInlinePaintable
-
isInline
public boolean isInline()
-
getLineBox
public LineBox getLineBox()
-
paintDebugOutline
public void paintDebugOutline(RenderingContext c)
-
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)
-
getPersistentBFC
public PersistentBFC getPersistentBFC()
-
setPersistentBFC
public void setPersistentBFC(PersistentBFC persistentBFC)
-
getStaticEquivalent
public Box getStaticEquivalent()
-
setStaticEquivalent
public void setStaticEquivalent(Box staticEquivalent)
-
shouldBeReplaced
public boolean shouldBeReplaced()
-
isReplaced
public boolean isReplaced()
-
calcCanvasLocation
public void calcCanvasLocation()
- Specified by:
calcCanvasLocationin classBox
-
calcInitialFloatedCanvasLocation
public void calcInitialFloatedCanvasLocation(LayoutContext c)
-
calcChildLocations
public void calcChildLocations()
- Overrides:
calcChildLocationsin classBox
-
isNeedPageClear
public boolean isNeedPageClear()
-
setNeedPageClear
public void setNeedPageClear(boolean needPageClear)
-
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)
-
getReplacedElement
public ReplacedElement getReplacedElement()
-
setReplacedElement
public void setReplacedElement(ReplacedElement replacedElement)
-
reset
public void reset(LayoutContext c)
-
resolveAutoMargins
protected void resolveAutoMargins(LayoutContext c, int cssWidth, RectPropertySet padding, BorderPropertySet border)
-
calcDimensions
public void calcDimensions(LayoutContext c)
-
calcDimensions
protected void calcDimensions(LayoutContext c, int cssWidth)
-
layout
public void layout(LayoutContext c)
-
layout
public void layout(LayoutContext c, int contentStart)
-
isAllowHeightToShrink
protected boolean isAllowHeightToShrink()
-
getPageClearance
protected int getPageClearance()
-
calcLayoutHeight
protected void calcLayoutHeight(LayoutContext c, BorderPropertySet border, RectPropertySet margin, RectPropertySet padding)
Oh oh! Up to this method height is used to track content height. After this method it is used to track total layout height!
-
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)
-
getChildrenContentType
public int getChildrenContentType()
-
setChildrenContentType
public void setChildrenContentType(int contentType)
-
isSkipWhenCollapsingMargins
protected boolean isSkipWhenCollapsingMargins()
-
isMayCollapseMarginsWithChildren
protected boolean isMayCollapseMarginsWithChildren()
-
getNextCollapsableSibling
protected BlockBox getNextCollapsableSibling(BlockBox.MarginCollapseResult collapsedMargin)
-
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()
-
getAvailableWidth
protected int getAvailableWidth(LayoutContext c)
-
isFixedWidthAdvisoryOnly
protected boolean isFixedWidthAdvisoryOnly()
-
calcMinMaxWidth
public void calcMinMaxWidth(LayoutContext c)
-
getMaxWidth
public int getMaxWidth()
-
setMaxWidth
protected void setMaxWidth(int maxWidth)
-
getMinWidth
public int getMinWidth()
-
setMinWidth
protected void setMinWidth(int minWidth)
-
styleText
public void styleText(LayoutContext c)
-
styleText
public void styleText(LayoutContext c, CalculatedStyle style)
-
calcChildPaintingInfo
protected void calcChildPaintingInfo(CssContext c, PaintingInfo result, boolean useCache)
- Overrides:
calcChildPaintingInfoin classBox
-
getFirstLetterStyle
public CascadedStyle getFirstLetterStyle()
-
setFirstLetterStyle
public void setFirstLetterStyle(CascadedStyle firstLetterStyle)
-
getFirstLineStyle
public CascadedStyle getFirstLineStyle()
-
setFirstLineStyle
public void setFirstLineStyle(CascadedStyle firstLineStyle)
-
isMinMaxCalculated
protected boolean isMinMaxCalculated()
-
setMinMaxCalculated
protected void setMinMaxCalculated(boolean minMaxCalculated)
-
setDimensionsCalculated
protected void setDimensionsCalculated(boolean dimensionsCalculated)
-
setNeedShrinkToFitCalculatation
protected void setNeedShrinkToFitCalculatation(boolean needShrinkToFitCalculatation)
-
initStaticPos
public void initStaticPos(LayoutContext c, BlockBox parent, int childOffset)
-
calcBaseline
public int calcBaseline(LayoutContext c)
-
calcInitialBreakAtLine
protected int calcInitialBreakAtLine(LayoutContext c)
-
isCurrentBreakAtLineContext
public boolean isCurrentBreakAtLineContext(LayoutContext c)
-
calcBreakAtLineContext
public BreakAtLineContext calcBreakAtLineContext(LayoutContext c)
-
calcInlineBaseline
public int calcInlineBaseline(CssContext c)
-
findOffset
public int findOffset(Box box)
-
findLastNthLineBox
public LineBox findLastNthLineBox(int count)
-
isNeedsKeepWithInline
public boolean isNeedsKeepWithInline(LayoutContext c)
-
isFloated
public boolean isFloated()
-
getFloatedBoxData
public FloatedBoxData getFloatedBoxData()
-
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:
isInlineBlockin classBox
-
isInMainFlow
public boolean isInMainFlow()
-
getDocumentParent
public Box getDocumentParent()
- Overrides:
getDocumentParentin classBox
-
isContainsInlineContent
public boolean isContainsInlineContent(LayoutContext c)
-
checkPageContext
public boolean checkPageContext(LayoutContext c)
-
isNeedsClipOnPaint
public boolean isNeedsClipOnPaint(CssContext c)
-
propagateExtraSpace
protected void propagateExtraSpace(LayoutContext c, ContentLimitContainer parentContainer, ContentLimitContainer currentContainer, int extraTop, int extraBottom)
-
-