Package com.openhtmltopdf.layout
Class Layer
java.lang.Object
com.openhtmltopdf.layout.Layer
public class Layer extends Object
All positioned content as well as content with an overflow value other
than visible creates a layer. Layers which define stacking contexts
provide the entry for rendering the box tree to an output device. The main
purpose of this class is to provide an implementation of Appendix E of the
spec, but it also provides additional utility services including page
management and mapping boxes to coordinates (for e.g. links). When
rendering to a paged output device, the layer is also responsible for laying
out absolute content (which is layed out after its containing block has
completed layout).
-
Field Summary
Fields Modifier and Type Field Description static intAUTOstatic intNEGATIVEstatic shortPAGED_MODE_PRINTstatic shortPAGED_MODE_SCREENstatic intPOSITIVEstatic intZERO -
Constructor Summary
Constructors Constructor Description Layer(Layer parent, Box master, CssContext c)Creates a child layer.Layer(Box master, CssContext c)Creates the root layer. -
Method Summary
Modifier and Type Method Description voidaddChild(Layer layer)voidaddFloat(BlockBox floater, BlockFormattingContext bfc)voidaddPage(CssContext c)voidaddPageSequence(BlockBox start)voidaddRunningBlock(BlockBox block)protected List<AffineTransform>applyTranform(RenderingContext c, Box box)Deprecated.voidassignPagePaintingPositions(CssContext cssCtx, int mode, int additionalClearance)voidassignPagePaintingPositions(CssContext cssCtx, short mode)List<Layer>collectLayers(int which)Called recusively to collect all descendant layers in a stacking context so they can be painted in correct order.booleancontainsFixedContent()Deprecated.static PageBoxcreatePageBox(CssContext c, String pseudoPage)booleancrossesPageBreak(LayoutContext c, int top, int bottom)voiddetach()voidensureHasPage(CssContext c, Box box)Boxfind(CssContext cssCtx, int absX, int absY, boolean findAnonymous)Deprecated.LayerfindRoot()voidfinish(LayoutContext c)List<Layer>getChildren()The resulting list should not be modified.AffineTransformgetCurrentTransformMatrix()The document coordinates current transform, this is cumulative from layer to child layer.BoxgetEnd()PageBoxgetFirstPage(CssContext c, Box box)List<BlockBox>getFloats()PageBoxgetLastPage()PageBoxgetLastPage(CssContext c, Box box)BoxgetMaster()intgetMaxPageWidth(CssContext cssCtx, int additionalClearance)PageBoxgetPage(CssContext c, int yOffset)List<PageBox>getPages()DimensiongetPaintingDimension(LayoutContext c)LayergetParent()intgetRelativePageCount(RenderingContext c)intgetRelativePageNo(RenderingContext c)intgetRelativePageNo(RenderingContext c, int absY)BlockBoxgetRunningBlock(String identifer, PageBox page, PageElementPosition which)BoxgetSelectionEnd()intgetSelectionEndX()intgetSelectionEndY()BoxgetSelectionStart()intgetSelectionStartX()intgetSelectionStartY()List<Layer>getSortedLayers(int which)intgetZIndex()booleanhasFixedAncester()booleanhasLocalTransform()booleanisForDeletion()booleanisInline()booleanisLastPage(PageBox pageBox)booleanisRequiresLayout()booleanisRootLayer()booleanisStackingContext()booleanisZIndexAuto()voidlayoutPages(LayoutContext c)voidpaint(RenderingContext c)Deprecated.voidpaintAsLayer(RenderingContext c, BlockBox startingPoint)Deprecated.voidpositionChildren(LayoutContext c)voidpositionFixedLayer(RenderingContext c)voidpropagateCurrentTransformationMatrix(CssContext c)Recursively propagates the transformation matrix.voidremoveFloat(BlockBox floater)FIXME: Only used when we reset a box, so trying to remove at sometime in the future.voidremoveLastPage()voidremoveRunningBlock(BlockBox block)voidsetEnd(Box end)voidsetFixedBackground(boolean b)Deprecated.voidsetForDeletion(boolean forDeletion)voidsetInline(boolean inline)voidsetPages(List<PageBox> pages)voidsetRequiresLayout(boolean requiresLayout)voidsetSelectionEnd(Box selectionEnd)voidsetSelectionEndX(int selectionEndX)voidsetSelectionEndY(int selectionEndY)voidsetSelectionStart(Box selectionStart)voidsetSelectionStartX(int selectionStartX)voidsetSelectionStartY(int selectionStartY)voidsetStackingContext(boolean stackingContext)voidtrimEmptyPages(CssContext c, int maxYHeight)voidtrimPageCount(int newPageCount)
-
Field Details
-
PAGED_MODE_SCREEN
public static final short PAGED_MODE_SCREEN- See Also:
- Constant Field Values
-
PAGED_MODE_PRINT
public static final short PAGED_MODE_PRINT- See Also:
- Constant Field Values
-
POSITIVE
public static final int POSITIVE- See Also:
- Constant Field Values
-
ZERO
public static final int ZERO- See Also:
- Constant Field Values
-
NEGATIVE
public static final int NEGATIVE- See Also:
- Constant Field Values
-
AUTO
public static final int AUTO- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
propagateCurrentTransformationMatrix
Recursively propagates the transformation matrix. This must be done after layout of the master box and its children as this method relies on the box width and height for relative units in the transforms and transform origins. -
getCurrentTransformMatrix
The document coordinates current transform, this is cumulative from layer to child layer. May be null, if identity transform is in effect. Used to check if a box belonging to this layer sits on a particular page after the transform is applied. This method can only be used afterpropagateCurrentTransformationMatrix(CssContext)has been called on the root layer.- Returns:
- null or affine transform.
-
hasLocalTransform
public boolean hasLocalTransform() -
setForDeletion
public void setForDeletion(boolean forDeletion) -
isForDeletion
public boolean isForDeletion() -
hasFixedAncester
public boolean hasFixedAncester() -
getParent
-
isStackingContext
public boolean isStackingContext() -
setStackingContext
public void setStackingContext(boolean stackingContext) -
getZIndex
public int getZIndex() -
isZIndexAuto
public boolean isZIndexAuto() -
getMaster
-
addChild
-
createPageBox
-
removeFloat
FIXME: Only used when we reset a box, so trying to remove at sometime in the future. -
addFloat
-
collectLayers
Called recusively to collect all descendant layers in a stacking context so they can be painted in correct order. Those descendants that are under their own stacking contexts are excluded.- Parameters:
which- NEGATIVE ZERO POSITIVE AUTO corresponding to z-index property.- Returns:
-
getSortedLayers
-
getPaintingDimension
-
paint
Deprecated. -
getFloats
-
applyTranform
Deprecated.Applies the transforms specified for the box and returns a list of inverse transforms that should be applied once the transformed element has been output. -
find
Deprecated. -
paintAsLayer
Deprecated. -
positionFixedLayer
-
isRootLayer
public boolean isRootLayer() -
positionChildren
-
containsFixedContent
Deprecated. -
setFixedBackground
Deprecated. -
getChildren
The resulting list should not be modified. -
detach
public void detach() -
isInline
public boolean isInline() -
setInline
public void setInline(boolean inline) -
getEnd
-
setEnd
-
isRequiresLayout
public boolean isRequiresLayout() -
setRequiresLayout
public void setRequiresLayout(boolean requiresLayout) -
finish
-
getPages
-
setPages
-
isLastPage
-
removeLastPage
public void removeLastPage() -
addPage
-
getFirstPage
-
getLastPage
-
ensureHasPage
-
getPage
-
trimEmptyPages
-
trimPageCount
public void trimPageCount(int newPageCount) -
assignPagePaintingPositions
-
assignPagePaintingPositions
-
getMaxPageWidth
-
getLastPage
-
crossesPageBreak
-
findRoot
-
addRunningBlock
-
removeRunningBlock
-
getRunningBlock
-
layoutPages
-
addPageSequence
-
getRelativePageNo
-
getRelativePageNo
-
getRelativePageCount
-
getSelectionEnd
-
setSelectionEnd
-
getSelectionStart
-
setSelectionStart
-
getSelectionEndX
public int getSelectionEndX() -
setSelectionEndX
public void setSelectionEndX(int selectionEndX) -
getSelectionEndY
public int getSelectionEndY() -
setSelectionEndY
public void setSelectionEndY(int selectionEndY) -
getSelectionStartX
public int getSelectionStartX() -
setSelectionStartX
public void setSelectionStartX(int selectionStartX) -
getSelectionStartY
public int getSelectionStartY() -
setSelectionStartY
public void setSelectionStartY(int selectionStartY)
-