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

      • Layer

        public Layer​(Box master,
                     CssContext c)
        Creates the root layer.
      • Layer

        public Layer​(Layer parent,
                     Box master,
                     CssContext c)
        Creates a child layer.
    • Method Detail

      • propagateCurrentTransformationMatrix

        public void propagateCurrentTransformationMatrix​(CssContext c)
        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

        public AffineTransform 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 after propagateCurrentTransformationMatrix(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

        public Layer getParent()
      • isStackingContext

        public boolean isStackingContext()
      • setStackingContext

        public void setStackingContext​(boolean stackingContext)
      • getZIndex

        public int getZIndex()
      • isZIndexAuto

        public boolean isZIndexAuto()
      • getMaster

        public Box getMaster()
      • addChild

        public void addChild​(Layer layer)
      • removeFloat

        public void removeFloat​(BlockBox floater)
        FIXME: Only used when we reset a box, so trying to remove at sometime in the future.
      • collectLayers

        public List<Layer> collectLayers​(int which)
        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

        public List<Layer> getSortedLayers​(int which)
      • applyTranform

        @Deprecated
        protected List<AffineTransform> applyTranform​(RenderingContext c,
                                                      Box box)
        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.
      • isRootLayer

        public boolean isRootLayer()
      • positionChildren

        public void positionChildren​(LayoutContext c)
      • containsFixedContent

        @Deprecated
        public boolean containsFixedContent()
        Deprecated.
      • setFixedBackground

        @Deprecated
        public void setFixedBackground​(boolean b)
        Deprecated.
      • getChildren

        public List<Layer> getChildren()
        The resulting list should not be modified.
      • detach

        public void detach()
      • isInline

        public boolean isInline()
      • setInline

        public void setInline​(boolean inline)
      • getEnd

        public Box getEnd()
      • setEnd

        public void setEnd​(Box end)
      • isRequiresLayout

        public boolean isRequiresLayout()
      • setRequiresLayout

        public void setRequiresLayout​(boolean requiresLayout)
      • setPages

        public void setPages​(List<PageBox> pages)
      • isLastPage

        public boolean isLastPage​(PageBox pageBox)
      • removeLastPage

        public void removeLastPage()
      • ensureHasPage

        public void ensureHasPage​(CssContext c,
                                  Box box)
      • trimEmptyPages

        public void trimEmptyPages​(CssContext c,
                                   int maxYHeight)
      • trimPageCount

        public void trimPageCount​(int newPageCount)
      • assignPagePaintingPositions

        public void assignPagePaintingPositions​(CssContext cssCtx,
                                                short mode)
      • assignPagePaintingPositions

        public void assignPagePaintingPositions​(CssContext cssCtx,
                                                int mode,
                                                int additionalClearance)
      • getMaxPageWidth

        public int getMaxPageWidth​(CssContext cssCtx,
                                   int additionalClearance)
      • getLastPage

        public PageBox getLastPage()
      • crossesPageBreak

        public boolean crossesPageBreak​(LayoutContext c,
                                        int top,
                                        int bottom)
      • findRoot

        public Layer findRoot()
      • addRunningBlock

        public void addRunningBlock​(BlockBox block)
      • removeRunningBlock

        public void removeRunningBlock​(BlockBox block)
      • addPageSequence

        public void addPageSequence​(BlockBox start)
      • getRelativePageNo

        public int getRelativePageNo​(RenderingContext c,
                                     int absY)
      • getRelativePageCount

        public int getRelativePageCount​(RenderingContext c)
      • getSelectionEnd

        public Box getSelectionEnd()
      • setSelectionEnd

        public void setSelectionEnd​(Box selectionEnd)
      • getSelectionStart

        public Box getSelectionStart()
      • setSelectionStart

        public void setSelectionStart​(Box selectionStart)
      • 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)