Classes | Public Member Functions | Friends

nsDisplayListBuilder Class Reference

This manages a display list and is passed as a parameter to nsIFrame::BuildDisplayList. More...

#include <nsDisplayList.h>

Collaboration diagram for nsDisplayListBuilder:

List of all members.

Classes

class  AutoInTransformSetter
class  AutoIsRootSetter
struct  PresShellState

Public Member Functions

 nsDisplayListBuilder (nsIFrame *aReferenceFrame, PRBool aIsForEvents, PRBool aBuildCaret)
 ~nsDisplayListBuilder ()
PRBool IsForEventDelivery ()
PRBool IsBackgroundOnly ()
void SetBackgroundOnly (PRBool aIsBackgroundOnly)
 Set to PR_TRUE if painting should be suppressed during page load.
PRBool IsAtRootOfPseudoStackingContext ()
void SetMovingFrame (nsIFrame *aMovingFrame, const nsPoint &aMoveDelta, nsRegion *aSaveVisibleRegionOfMovingContent)
 Indicate that we'll use this display list to analyze the effects of aMovingFrame moving by aMoveDelta.
PRBool HasMovingFrames ()
nsIFrame * GetRootMovingFrame ()
const nsPointGetMoveDelta ()
void AccumulateVisibleRegionOfMovingContent (const nsRegion &aMovingContent, const nsRegion &aVisibleRegionBeforeMove, const nsRegion &aVisibleRegionAfterMove)
 Given the bounds of some moving content, and a visible region, intersect the bounds with the visible region and add it to the recorded region of visible moving content.
PRBool IsMovingFrame (nsIFrame *aFrame)
nsISelectionGetBoundingSelection ()
nsIFrame * ReferenceFrame ()
nsPoint ToReferenceFrame (const nsIFrame *aFrame)
void SetIgnoreScrollFrame (nsIFrame *aFrame)
 When building the display list, the scrollframe aFrame will be "ignored" for the purposes of clipping, and its scrollbars will be hidden.
nsIFrame * GetIgnoreScrollFrame ()
 Get the scrollframe to ignore, if any.
void SetPaintAllFrames ()
 Calling this setter makes us ignore all dirty rects and include all descendant frames in the display list, wherever they may be positioned.
PRBool GetPaintAllFrames ()
void SetAccurateVisibleRegions ()
 Calling this setter makes us compute accurate visible regions at the cost of performance if regions get very complex.
PRBool GetAccurateVisibleRegions ()
void IgnorePaintSuppression ()
 Allows callers to selectively override the regular paint suppression checks, so that methods like GetFrameForPoint work when painting is suppressed.
nsresult DisplayCaret (nsIFrame *aFrame, const nsRect &aDirtyRect, const nsDisplayListSet &aLists)
 Display the caret if needed.
nsIFrame * GetCaretFrame ()
 Get the frame that the caret is supposed to draw in.
nsCaretGetCaret ()
 Get the caret associated with the current presshell.
void EnterPresShell (nsIFrame *aReferenceFrame, const nsRect &aDirtyRect)
 Notify the display list builder that we're entering a presshell.
void LeavePresShell (nsIFrame *aReferenceFrame, const nsRect &aDirtyRect)
 Notify the display list builder that we're leaving a presshell.
PRBool IsInTransform ()
 Returns true if we're currently building a display list that's directly or indirectly under an nsDisplayTransform or SVG foreignObject.
void SetInTransform (PRBool aInTransform)
 Indicate whether or not we're directly or indirectly under and nsDisplayTransform or SVG foreignObject.
PRBool ShouldSyncDecodeImages ()
void SetSyncDecodeImages (PRBool aSyncDecodeImages)
 Indicates whether we should synchronously decode images.
PRUint32 GetBackgroundPaintFlags ()
 Helper method to generate background painting flags based on the information available in the display list builder.
void SubtractFromVisibleRegion (nsRegion *aVisibleRegion, const nsRegion &aRegion)
 Subtracts aRegion from *aVisibleRegion.
void MarkFramesForDisplayList (nsIFrame *aDirtyFrame, const nsFrameList &aFrames, const nsRect &aDirtyRect)
 Mark the frames in aFrames to be displayed if they intersect aDirtyRect (which is relative to aDirtyFrame).
void * Allocate (size_t aSize)
 Allocate memory in our arena.
nsDisplayTableItem * GetCurrentTableItem ()
void SetCurrentTableItem (nsDisplayTableItem *aTableItem)

Friends

class AutoIsRootSetter
class AutoInTransformSetter

Detailed Description

This manages a display list and is passed as a parameter to nsIFrame::BuildDisplayList.

It contains the parameters that don't change from frame to frame and manages the display list memory using a PLArena. It also establishes the reference coordinate system for all display list items. Some of the parameters are available from the prescontext/presshell, but we copy them into the builder for faster/more convenient access.


Constructor & Destructor Documentation

nsDisplayListBuilder::nsDisplayListBuilder ( nsIFrame *  aReferenceFrame,
PRBool  aIsForEvents,
PRBool  aBuildCaret 
)
Parameters:
aReferenceFrame the frame at the root of the subtree; its origin is the origin of the reference coordinate system for this display list
aIsForEvents PR_TRUE if we're creating this list in order to determine which frame is under the mouse position
aBuildCaret whether or not we should include the caret in any display lists that we make.
nsDisplayListBuilder::~nsDisplayListBuilder (  ) 

Member Function Documentation

void nsDisplayListBuilder::AccumulateVisibleRegionOfMovingContent ( const nsRegion aMovingContent,
const nsRegion aVisibleRegionBeforeMove,
const nsRegion aVisibleRegionAfterMove 
)

Given the bounds of some moving content, and a visible region, intersect the bounds with the visible region and add it to the recorded region of visible moving content.

void* nsDisplayListBuilder::Allocate ( size_t  aSize  ) 

Allocate memory in our arena.

It will only be freed when this display list builder is destroyed. This memory holds nsDisplayItems. nsDisplayItem destructors are called as soon as the item is no longer used.

nsresult nsDisplayListBuilder::DisplayCaret ( nsIFrame *  aFrame,
const nsRect aDirtyRect,
const nsDisplayListSet aLists 
) [inline]

Display the caret if needed.

void nsDisplayListBuilder::EnterPresShell ( nsIFrame *  aReferenceFrame,
const nsRect aDirtyRect 
)

Notify the display list builder that we're entering a presshell.

aReferenceFrame should be a frame in the new presshell and aDirtyRect should be the current dirty rect in aReferenceFrame's coordinate space.

PRBool nsDisplayListBuilder::GetAccurateVisibleRegions (  )  [inline]
PRUint32 nsDisplayListBuilder::GetBackgroundPaintFlags (  ) 

Helper method to generate background painting flags based on the information available in the display list builder.

Currently only accounts for mSyncDecodeImages.

nsISelection* nsDisplayListBuilder::GetBoundingSelection (  )  [inline]
Returns:
the selection that painting should be restricted to (or nsnull in the normal unrestricted case)
nsCaret* nsDisplayListBuilder::GetCaret (  ) 

Get the caret associated with the current presshell.

nsIFrame* nsDisplayListBuilder::GetCaretFrame (  )  [inline]

Get the frame that the caret is supposed to draw in.

If the caret is currently invisible, this will be null.

nsDisplayTableItem* nsDisplayListBuilder::GetCurrentTableItem (  )  [inline]
nsIFrame* nsDisplayListBuilder::GetIgnoreScrollFrame (  )  [inline]

Get the scrollframe to ignore, if any.

const nsPoint& nsDisplayListBuilder::GetMoveDelta (  )  [inline]
Returns:
the amount by which mMovingFrame was moved. Only valid when GetRootMovingFrame() returns non-null.
PRBool nsDisplayListBuilder::GetPaintAllFrames (  )  [inline]
nsIFrame* nsDisplayListBuilder::GetRootMovingFrame (  )  [inline]
Returns:
the frame that was moved
PRBool nsDisplayListBuilder::HasMovingFrames (  )  [inline]
Returns:
PR_TRUE if we are doing analysis of moving frames
void nsDisplayListBuilder::IgnorePaintSuppression (  )  [inline]

Allows callers to selectively override the regular paint suppression checks, so that methods like GetFrameForPoint work when painting is suppressed.

PRBool nsDisplayListBuilder::IsAtRootOfPseudoStackingContext (  )  [inline]
Returns:
PR_TRUE if the currently active BuildDisplayList call is being applied to a frame at the root of a pseudo stacking context. A pseudo stacking context is either a real stacking context or basically what CSS2.1 appendix E refers to with "treat the element as if it created a new stacking context
PRBool nsDisplayListBuilder::IsBackgroundOnly (  )  [inline]
Returns:
PR_TRUE if "painting is suppressed" during page load and we should paint only the background of the document.
PRBool nsDisplayListBuilder::IsForEventDelivery (  )  [inline]
Returns:
PR_TRUE if the display is being built in order to determine which frame is under the mouse position.
PRBool nsDisplayListBuilder::IsInTransform (  )  [inline]

Returns true if we're currently building a display list that's directly or indirectly under an nsDisplayTransform or SVG foreignObject.

PRBool nsDisplayListBuilder::IsMovingFrame ( nsIFrame *  aFrame  ) 
Returns:
PR_TRUE if aFrame is, or is a descendant of, the hypothetical moving frame
void nsDisplayListBuilder::LeavePresShell ( nsIFrame *  aReferenceFrame,
const nsRect aDirtyRect 
)

Notify the display list builder that we're leaving a presshell.

void nsDisplayListBuilder::MarkFramesForDisplayList ( nsIFrame *  aDirtyFrame,
const nsFrameList aFrames,
const nsRect aDirtyRect 
)

Mark the frames in aFrames to be displayed if they intersect aDirtyRect (which is relative to aDirtyFrame).

If the frames have placeholders that might not be displayed, we mark the placeholders and their ancestors to ensure that display list construction descends into them anyway. nsDisplayListBuilder will take care of unmarking them when it is destroyed.

nsIFrame* nsDisplayListBuilder::ReferenceFrame (  )  [inline]
Returns:
the root of the display list's frame (sub)tree, whose origin establishes the coordinate system for the display list
void nsDisplayListBuilder::SetAccurateVisibleRegions (  )  [inline]

Calling this setter makes us compute accurate visible regions at the cost of performance if regions get very complex.

void nsDisplayListBuilder::SetBackgroundOnly ( PRBool  aIsBackgroundOnly  )  [inline]

Set to PR_TRUE if painting should be suppressed during page load.

Set to PR_FALSE if painting should not be suppressed.

void nsDisplayListBuilder::SetCurrentTableItem ( nsDisplayTableItem *  aTableItem  )  [inline]
void nsDisplayListBuilder::SetIgnoreScrollFrame ( nsIFrame *  aFrame  )  [inline]

When building the display list, the scrollframe aFrame will be "ignored" for the purposes of clipping, and its scrollbars will be hidden.

We use this to allow RenderOffscreen to render a whole document without beign clipped by the viewport or drawing the viewport scrollbars.

void nsDisplayListBuilder::SetInTransform ( PRBool  aInTransform  )  [inline]

Indicate whether or not we're directly or indirectly under and nsDisplayTransform or SVG foreignObject.

void nsDisplayListBuilder::SetMovingFrame ( nsIFrame *  aMovingFrame,
const nsPoint aMoveDelta,
nsRegion aSaveVisibleRegionOfMovingContent 
) [inline]

Indicate that we'll use this display list to analyze the effects of aMovingFrame moving by aMoveDelta.

The move has already been applied to the frame tree. Moving frames are not allowed to clip or cover (during ComputeVisibility) non-moving frames. E.g. when we're constructing a display list to see what should be repainted during a scroll operation, we specify the scrolled frame as the moving frame.

Parameters:
aSaveVisibleRegionOfMovingContent if non-null, this receives a bounding region for the visible moving content (considering the moving content both before and after the move)
void nsDisplayListBuilder::SetPaintAllFrames (  )  [inline]

Calling this setter makes us ignore all dirty rects and include all descendant frames in the display list, wherever they may be positioned.

void nsDisplayListBuilder::SetSyncDecodeImages ( PRBool  aSyncDecodeImages  )  [inline]

Indicates whether we should synchronously decode images.

If true, we decode and draw whatever image data has been loaded. If false, we just draw whatever has already been decoded.

PRBool nsDisplayListBuilder::ShouldSyncDecodeImages (  )  [inline]
Returns:
PR_TRUE if images have been set to decode synchronously.
void nsDisplayListBuilder::SubtractFromVisibleRegion ( nsRegion aVisibleRegion,
const nsRegion aRegion 
)

Subtracts aRegion from *aVisibleRegion.

We avoid letting aVisibleRegion become overcomplex by simplifying it if necessary --- unless mAccurateVisibleRegions is set, in which case we let it get arbitrarily complex.

nsPoint nsDisplayListBuilder::ToReferenceFrame ( const nsIFrame *  aFrame  )  [inline]
Returns:
a point pt such that adding pt to a coordinate relative to aFrame makes it relative to ReferenceFrame(), i.e., returns aFrame->GetOffsetTo(ReferenceFrame()). It may be optimized to be faster than aFrame->GetOffsetTo(ReferenceFrame()) (but currently isn't).

Friends And Related Function Documentation

friend class AutoInTransformSetter [friend]
friend class AutoIsRootSetter [friend]

The documentation for this class was generated from the following file: