Classes | Public Types | 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 Types

enum  Mode { PAINTING, EVENT_DELIVERY, PLUGIN_GEOMETRY, OTHER }
typedef
mozilla::FramePropertyDescriptor 
FramePropertyDescriptor
typedef mozilla::FrameLayerBuilder FrameLayerBuilder
typedef nsIWidget::ThemeGeometry ThemeGeometry

Public Member Functions

 nsDisplayListBuilder (nsIFrame *aReferenceFrame, Mode aMode, PRBool aBuildCaret)
 ~nsDisplayListBuilder ()
PRBool IsForEventDelivery ()
PRBool IsForPluginGeometry ()
PRBool IsForPainting ()
PRBool IsBackgroundOnly ()
PRBool IsAtRootOfPseudoStackingContext ()
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 SetIncludeAllOutOfFlows ()
 Calling this setter makes us include all out-of-flow descendant frames in the display list, wherever they may be positioned (even outside the dirty rects).
PRBool GetIncludeAllOutOfFlows () const
void SetSelectedFramesOnly ()
 Calling this setter makes us exclude all leaf frames that does not have the NS_FRAME_SELECTED_CONTENT bit.
PRBool GetSelectedFramesOnly ()
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.
PRBool IsIgnoringPaintSuppression ()
PRBool GetHadToIgnorePaintSuppression ()
void SetPaintingToWindow (PRBool aToWindow)
 Call this if we're doing normal painting to the window.
PRBool IsPaintingToWindow () const
nsresult DisplayCaret (nsIFrame *aFrame, const nsRect &aDirtyRect, nsDisplayList *aList)
 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 IsSnappingEnabled ()
 Returns true if snapping is enabled for the final drawing context.
void SetSnappingEnabled (PRBool aSnappingEnabled)
 Set if snapping is enabled for the final drawing context.
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).
FrameLayerBuilderLayerBuilder ()
 Return the FrameLayerBuilder.
const nsRegionGetFinalTransparentRegion ()
 Get the area of the final transparent region.
void SetFinalTransparentRegion (const nsRegion &aFinalTransparentRegion)
 Record the area of the final transparent region after all visibility calculations were performed.
const nsTArray< ThemeGeometry > & GetThemeGeometries ()
bool ShouldDescendIntoFrame (nsIFrame *aFrame) const
 Returns true if we need to descend into this frame when building the display list, even though it doesn't intersect the dirty rect, because it may have out-of-flows that do so.
void RegisterThemeGeometry (PRUint8 aWidgetType, const nsIntRect &aRect)
 Notifies the builder that a particular themed widget exists at the given rectangle within the currently built display list.
void * Allocate (size_t aSize)
 Allocate memory in our arena.
nsDisplayTableItem * GetCurrentTableItem ()
void SetCurrentTableItem (nsDisplayTableItem *aTableItem)
nsPresContextCurrentPresContext ()

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.


Member Typedef Documentation

typedef nsIWidget::ThemeGeometry nsDisplayListBuilder::ThemeGeometry

Member Enumeration Documentation

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.
Enumerator:
PAINTING 
EVENT_DELIVERY 
PLUGIN_GEOMETRY 
OTHER 

Constructor & Destructor Documentation

nsDisplayListBuilder::nsDisplayListBuilder ( nsIFrame *  aReferenceFrame,
Mode  aMode,
PRBool  aBuildCaret 
)
nsDisplayListBuilder::~nsDisplayListBuilder (  ) 

Member Function Documentation

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.

nsPresContext* nsDisplayListBuilder::CurrentPresContext (  )  [inline]
nsresult nsDisplayListBuilder::DisplayCaret ( nsIFrame *  aFrame,
const nsRect aDirtyRect,
nsDisplayList aList 
) [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]
const nsRegion* nsDisplayListBuilder::GetFinalTransparentRegion (  )  [inline]

Get the area of the final transparent region.

PRBool nsDisplayListBuilder::GetHadToIgnorePaintSuppression (  )  [inline]
Returns:
Returns if this builder had to ignore painting suppression on some document when building the display list.
nsIFrame* nsDisplayListBuilder::GetIgnoreScrollFrame (  )  [inline]

Get the scrollframe to ignore, if any.

PRBool nsDisplayListBuilder::GetIncludeAllOutOfFlows (  )  const [inline]
PRBool nsDisplayListBuilder::GetSelectedFramesOnly (  )  [inline]
const nsTArray<ThemeGeometry>& nsDisplayListBuilder::GetThemeGeometries (  )  [inline]
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::IsForPainting (  )  [inline]
Returns:
PR_TRUE if the display list is being built for painting.
PRBool nsDisplayListBuilder::IsForPluginGeometry (  )  [inline]
Returns:
PR_TRUE if the display list is being built to compute geometry for plugins.
PRBool nsDisplayListBuilder::IsIgnoringPaintSuppression (  )  [inline]
Returns:
Returns if this builder will ignore paint suppression.
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::IsPaintingToWindow (  )  const [inline]
PRBool nsDisplayListBuilder::IsSnappingEnabled (  )  [inline]

Returns true if snapping is enabled for the final drawing context.

The default is true.

FrameLayerBuilder* nsDisplayListBuilder::LayerBuilder (  )  [inline]

Return the FrameLayerBuilder.

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::RegisterThemeGeometry ( PRUint8  aWidgetType,
const nsIntRect aRect 
) [inline]

Notifies the builder that a particular themed widget exists at the given rectangle within the currently built display list.

For certain appearance values (currently only NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR and NS_THEME_TOOLBAR) this gets called during every display list construction, for every themed widget of the right type within the display list, except for themed widgets which are transformed or have effects applied to them (e.g. CSS opacity or filters).

Parameters:
aWidgetType the -moz-appearance value for the themed widget
aRect the device-pixel rect relative to the widget's displayRoot for the themed widget
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::SetCurrentTableItem ( nsDisplayTableItem *  aTableItem  )  [inline]
void nsDisplayListBuilder::SetFinalTransparentRegion ( const nsRegion aFinalTransparentRegion  )  [inline]

Record the area of the final transparent region after all visibility calculations were performed.

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::SetIncludeAllOutOfFlows (  )  [inline]

Calling this setter makes us include all out-of-flow descendant frames in the display list, wherever they may be positioned (even outside the dirty rects).

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

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

void nsDisplayListBuilder::SetPaintingToWindow ( PRBool  aToWindow  )  [inline]

Call this if we're doing normal painting to the window.

void nsDisplayListBuilder::SetSelectedFramesOnly (  )  [inline]

Calling this setter makes us exclude all leaf frames that does not have the NS_FRAME_SELECTED_CONTENT bit.

void nsDisplayListBuilder::SetSnappingEnabled ( PRBool  aSnappingEnabled  )  [inline]

Set if snapping is enabled for the final drawing context.

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.

bool nsDisplayListBuilder::ShouldDescendIntoFrame ( nsIFrame *  aFrame  )  const [inline]

Returns true if we need to descend into this frame when building the display list, even though it doesn't intersect the dirty rect, because it may have out-of-flows that do so.

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->GetOffsetToCrossDoc(ReferenceFrame()). The returned point is in the appunits of aFrame. It may be optimized to be faster than aFrame->GetOffsetToCrossDoc(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: