Class LayoutContext

java.lang.Object
org.xhtmlrenderer.layout.LayoutContext
All Implemented Interfaces:
CssContext

public class LayoutContext extends Object implements CssContext
This class tracks state which changes over the course of a layout run. Generally speaking, if possible, state information should be stored in the box tree and not here. It also provides pass-though calls to many methods in SharedContext.
  • Field Details

    • _sharedContext

      private final SharedContext _sharedContext
    • _rootLayer

      private @Nullable Layer _rootLayer
    • _firstLines

      private StyleTracker _firstLines
    • _firstLetters

      private StyleTracker _firstLetters
    • _currentMarkerData

      private @Nullable MarkerData _currentMarkerData
    • _blockFormattingContexts

      private final Deque<BlockFormattingContext> _blockFormattingContexts
    • _layers

      private final Deque<Layer> _layers
    • _fontContext

      private final FontContext _fontContext
    • _contentFunctionFactory

      private final ContentFunctionFactory _contentFunctionFactory
    • _extraSpaceTop

      private int _extraSpaceTop
    • _extraSpaceBottom

      private int _extraSpaceBottom
    • _counterContextMap

      private final Map<CalculatedStyle,LayoutContext.CounterContext> _counterContextMap
    • _pendingPageName

      private @Nullable String _pendingPageName
    • _pageName

      private @Nullable String _pageName
    • _noPageBreak

      private int _noPageBreak
    • _rootDocumentLayer

      private @Nullable Layer _rootDocumentLayer
    • _page

      private @Nullable PageBox _page
    • _mayCheckKeepTogether

      private boolean _mayCheckKeepTogether
    • _breakAtLineContext

      private @Nullable BreakAtLineContext _breakAtLineContext
  • Constructor Details

  • Method Details

    • getTextRenderer

      public TextRenderer getTextRenderer()
    • getCss

      @CheckReturnValue public StyleReference getCss()
      Specified by:
      getCss in interface CssContext
    • getCanvas

      public FSCanvas getCanvas()
    • getFixedRectangle

      public Rectangle getFixedRectangle()
    • getNamespaceHandler

      public NamespaceHandler getNamespaceHandler()
    • reInit

      public void reInit(boolean keepLayers)
    • captureLayoutState

      public LayoutState captureLayoutState()
    • restoreLayoutState

      public void restoreLayoutState(LayoutState layoutState)
    • copyStateForRelayout

      public LayoutState copyStateForRelayout()
    • restoreStateForRelayout

      public void restoreStateForRelayout(LayoutState layoutState)
    • getBlockFormattingContext

      public BlockFormattingContext getBlockFormattingContext()
    • pushBFC

      public void pushBFC(BlockFormattingContext bfc)
    • popBFC

      public void popBFC()
    • pushLayer

      public void pushLayer(Box master)
    • pushLayer

      public void pushLayer(Layer layer)
    • popLayer

      public void popLayer()
    • getLayer

      public Layer getLayer()
    • getRootLayer

      public @Nullable Layer getRootLayer()
    • translate

      public void translate(int x, int y)
    • addBoxId

      public void addBoxId(String id, Box box)
    • removeBoxId

      public void removeBoxId(String id)
    • isInteractive

      public boolean isInteractive()
    • getMmPerDot

      public float getMmPerDot()
      Specified by:
      getMmPerDot in interface CssContext
    • getDotsPerPixel

      public int getDotsPerPixel()
      Specified by:
      getDotsPerPixel in interface CssContext
    • getFontSize2D

      public float getFontSize2D(FontSpecification font)
      Specified by:
      getFontSize2D in interface CssContext
    • getXHeight

      public float getXHeight(FontSpecification parentFont)
      Specified by:
      getXHeight in interface CssContext
    • getFont

      @CheckReturnValue public @Nullable FSFont getFont(FontSpecification font)
      Specified by:
      getFont in interface CssContext
    • getUac

      @CheckReturnValue public UserAgentCallback getUac()
    • isPrint

      public boolean isPrint()
    • getFirstLinesTracker

      public StyleTracker getFirstLinesTracker()
    • getFirstLettersTracker

      public StyleTracker getFirstLettersTracker()
    • getCurrentMarkerData

      @CheckReturnValue public @Nullable MarkerData getCurrentMarkerData()
    • setCurrentMarkerData

      public void setCurrentMarkerData(@Nullable MarkerData currentMarkerData)
    • getReplacedElementFactory

      public ReplacedElementFactory getReplacedElementFactory()
    • getFontContext

      public FontContext getFontContext()
    • getContentFunctionFactory

      public ContentFunctionFactory getContentFunctionFactory()
    • getSharedContext

      public SharedContext getSharedContext()
    • getExtraSpaceBottom

      public int getExtraSpaceBottom()
    • setExtraSpaceBottom

      public void setExtraSpaceBottom(int extraSpaceBottom)
    • getExtraSpaceTop

      public int getExtraSpaceTop()
    • setExtraSpaceTop

      public void setExtraSpaceTop(int extraSpaceTop)
    • resolveCounters

      public void resolveCounters(CalculatedStyle style, @Nullable Integer startIndex)
    • resolveCounters

      public void resolveCounters(CalculatedStyle style)
    • getCounterContext

      public LayoutContext.CounterContext getCounterContext(CalculatedStyle style)
    • getFSFontMetrics

      @CheckReturnValue public FSFontMetrics getFSFontMetrics(FSFont font)
      Specified by:
      getFSFontMetrics in interface CssContext
    • getPageName

      @CheckReturnValue public @Nullable String getPageName()
    • setPageName

      public void setPageName(@Nullable String currentPageName)
    • getNoPageBreak

      public int getNoPageBreak()
    • setNoPageBreak

      public void setNoPageBreak(int noPageBreak)
    • isPageBreaksAllowed

      public boolean isPageBreaksAllowed()
    • getPendingPageName

      @CheckReturnValue public @Nullable String getPendingPageName()
    • setPendingPageName

      public void setPendingPageName(@Nullable String pendingPageName)
    • getRootDocumentLayer

      @CheckReturnValue public @Nullable Layer getRootDocumentLayer()
    • setRootDocumentLayer

      public void setRootDocumentLayer(Layer rootDocumentLayer)
    • getPage

      @CheckReturnValue public @Nullable PageBox getPage()
    • setPage

      public void setPage(PageBox page)
    • isMayCheckKeepTogether

      public boolean isMayCheckKeepTogether()
    • setMayCheckKeepTogether

      public void setMayCheckKeepTogether(boolean mayKeepTogether)
    • getBreakAtLineContext

      @CheckReturnValue public @Nullable BreakAtLineContext getBreakAtLineContext()
    • setBreakAtLineContext

      public void setBreakAtLineContext(@Nullable BreakAtLineContext breakAtLineContext)