Public Member Functions | Protected Member Functions | Protected Attributes

nsDisplayWrapList Class Reference

A class that lets you wrap a display list as a display item. More...

#include <nsDisplayList.h>

Inheritance diagram for nsDisplayWrapList:
Collaboration diagram for nsDisplayWrapList:

List of all members.

Public Member Functions

 nsDisplayWrapList (nsIFrame *aFrame, nsDisplayList *aList)
 Takes all the items from aList and puts them in our list.
 nsDisplayWrapList (nsIFrame *aFrame, nsDisplayItem *aItem)
virtual ~nsDisplayWrapList ()
virtual Type GetType ()
 Some consecutive items should be rendered together as a unit, e.g., outlines for the same element.
virtual nsIFrame * HitTest (nsDisplayListBuilder *aBuilder, nsPoint aPt, HitTestState *aState)
 This is called after we've constructed a display list for event handling.
virtual nsRect GetBounds (nsDisplayListBuilder *aBuilder)
 The default bounds is the frame border rect.
virtual PRBool IsOpaque (nsDisplayListBuilder *aBuilder)
virtual PRBool IsUniform (nsDisplayListBuilder *aBuilder)
virtual PRBool IsVaryingRelativeToMovingFrame (nsDisplayListBuilder *aBuilder)
virtual void Paint (nsDisplayListBuilder *aBuilder, nsIRenderingContext *aCtx)
 Actually paint this item to some rendering context.
virtual PRBool ComputeVisibility (nsDisplayListBuilder *aBuilder, nsRegion *aVisibleRegion, nsRegion *aVisibleRegionBeforeMove)
 On entry, aVisibleRegion contains the region (relative to ReferenceFrame()) which may be visible.
virtual PRBool TryMerge (nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem)
 Try to merge with the other item (which is below us in the display list).
virtual nsDisplayListGetList ()
 If this is a leaf item we return null, otherwise we return the wrapped list.
virtual nsDisplayWrapListWrapWithClone (nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem)
 This creates a copy of this item, but wrapping aItem instead of our existing list.

Protected Member Functions

 nsDisplayWrapList ()

Protected Attributes

nsDisplayList mList

Detailed Description

A class that lets you wrap a display list as a display item.

GetUnderlyingFrame() is troublesome for wrapped lists because if the wrapped list has many items, it's not clear which one has the 'underlying frame'. Thus we force the creator to specify what the underlying frame is. The underlying frame should be the root of a stacking context, because sorting a list containing this item will not get at the children.

In some cases (e.g., clipping) we want to wrap a list but we don't have a particular underlying frame that is a stacking context root. In that case we allow the frame to be nsnull. Callers to GetUnderlyingFrame must detect and handle this case.


Constructor & Destructor Documentation

nsDisplayWrapList::nsDisplayWrapList ( nsIFrame *  aFrame,
nsDisplayList aList 
)

Takes all the items from aList and puts them in our list.

nsDisplayWrapList::nsDisplayWrapList ( nsIFrame *  aFrame,
nsDisplayItem aItem 
)
virtual nsDisplayWrapList::~nsDisplayWrapList (  )  [virtual]
nsDisplayWrapList::nsDisplayWrapList (  )  [inline, protected]

Member Function Documentation

virtual PRBool nsDisplayWrapList::ComputeVisibility ( nsDisplayListBuilder aBuilder,
nsRegion aVisibleRegion,
nsRegion aVisibleRegionBeforeMove 
) [virtual]

On entry, aVisibleRegion contains the region (relative to ReferenceFrame()) which may be visible.

If the display item opaquely covers an area, it can remove that area from aVisibleRegion before returning. If we're doing scroll analysis with moving frames, then aVisibleRegionBeforeMove will be non-null and contains the region that would have been visible before the move. aVisibleRegion contains the region that is visible after the move. nsDisplayList::ComputeVisibility automatically subtracts the bounds of items that return true from IsOpaque(), and automatically removes items whose bounds do not intersect the visible area, so implementations of nsDisplayItem::ComputeVisibility do not need to do these things. nsDisplayList::ComputeVisibility will already have set mVisibleRect on this item to the intersection of *aVisibleRegion (unioned with *aVisibleRegionBeforeMove, if that's non-null) and this item's bounds.

Returns:
PR_TRUE if the item is visible, PR_FALSE if no part of the item is visible

Reimplemented from nsDisplayItem.

Reimplemented in nsDisplayOpacity, and nsDisplayClip.

virtual nsRect nsDisplayWrapList::GetBounds ( nsDisplayListBuilder aBuilder  )  [virtual]

The default bounds is the frame border rect.

Returns:
a rectangle relative to aBuilder->ReferenceFrame() that contains the area drawn by this display item

Reimplemented from nsDisplayItem.

Reimplemented in nsDisplayClip.

virtual nsDisplayList* nsDisplayWrapList::GetList (  )  [inline, virtual]

If this is a leaf item we return null, otherwise we return the wrapped list.

Reimplemented from nsDisplayItem.

virtual Type nsDisplayWrapList::GetType (  )  [inline, virtual]

Some consecutive items should be rendered together as a unit, e.g., outlines for the same element.

For this, we need a way for items to identify their type.

Reimplemented from nsDisplayItem.

Reimplemented in nsDisplayOpacity, and nsDisplayClip.

virtual nsIFrame* nsDisplayWrapList::HitTest ( nsDisplayListBuilder aBuilder,
nsPoint  aPt,
HitTestState aState 
) [virtual]

This is called after we've constructed a display list for event handling.

When this is called, we've already ensured that aPt is in the item's bounds.

Parameters:
aState must point to a HitTestState. If you don't have one, just create one with the default constructor and pass it in.
Returns:
the frame that the point is considered over, or nsnull if this is not over any frame

Reimplemented from nsDisplayItem.

virtual PRBool nsDisplayWrapList::IsOpaque ( nsDisplayListBuilder aBuilder  )  [virtual]
Returns:
PR_TRUE if the item is definitely opaque --- i.e., paints every pixel within its bounds opaquely

Reimplemented from nsDisplayItem.

Reimplemented in nsDisplayOpacity.

virtual PRBool nsDisplayWrapList::IsUniform ( nsDisplayListBuilder aBuilder  )  [virtual]
Returns:
PR_TRUE if the item is guaranteed to paint every pixel in its bounds with the same (possibly translucent) color

Reimplemented from nsDisplayItem.

virtual PRBool nsDisplayWrapList::IsVaryingRelativeToMovingFrame ( nsDisplayListBuilder aBuilder  )  [virtual]
Returns:
PR_FALSE if the painting performed by the item is invariant when frame aFrame is moved relative to aBuilder->GetRootMovingFrame(). This can only be called when aBuilder->IsMovingFrame(mFrame) is true. It return PR_TRUE for all wrapped lists.

Reimplemented from nsDisplayItem.

virtual void nsDisplayWrapList::Paint ( nsDisplayListBuilder aBuilder,
nsIRenderingContext *  aCtx 
) [virtual]

Actually paint this item to some rendering context.

Content outside mVisibleRect need not be painted.

Reimplemented from nsDisplayItem.

Reimplemented in nsDisplayOpacity, and nsDisplayClip.

virtual PRBool nsDisplayWrapList::TryMerge ( nsDisplayListBuilder aBuilder,
nsDisplayItem aItem 
) [inline, virtual]

Try to merge with the other item (which is below us in the display list).

This gets used by nsDisplayClip to coalesce clipping operations (optimization), by nsDisplayOpacity to merge rendering for the same content element into a single opacity group (correctness), and will be used by nsDisplayOutline to merge multiple outlines for the same element (also for correctness).

Returns:
PR_TRUE if the merge was successful and the other item should be deleted

Reimplemented from nsDisplayItem.

Reimplemented in nsDisplayOpacity, and nsDisplayClip.

virtual nsDisplayWrapList* nsDisplayWrapList::WrapWithClone ( nsDisplayListBuilder aBuilder,
nsDisplayItem aItem 
) [inline, virtual]

This creates a copy of this item, but wrapping aItem instead of our existing list.

Only gets called if this item returned nsnull for GetUnderlyingFrame(). aItem is guaranteed to return non-null from GetUnderlyingFrame().

Reimplemented in nsDisplayClip.


Member Data Documentation


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