Public Member Functions

nsDisplayClip Class Reference

nsDisplayClip can clip a list of items, but we take a single item initially and then later merge other items into it when we merge adjacent matching nsDisplayClips More...

#include <nsDisplayList.h>

Inheritance diagram for nsDisplayClip:
Collaboration diagram for nsDisplayClip:

List of all members.

Public Member Functions

 nsDisplayClip (nsIFrame *aFrame, nsIFrame *aClippingFrame, nsDisplayItem *aItem, const nsRect &aRect)
 nsDisplayClip (nsIFrame *aFrame, nsIFrame *aClippingFrame, nsDisplayList *aList, const nsRect &aRect)
virtual Type GetType ()
 Some consecutive items should be rendered together as a unit, e.g., outlines for the same element.
virtual nsRect GetBounds (nsDisplayListBuilder *aBuilder)
 The default bounds is the frame border rect.
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).
nsRect GetClipRect ()
void SetClipRect (const nsRect &aRect)
nsIFrame * GetClippingFrame ()
virtual nsDisplayWrapListWrapWithClone (nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem)
 This creates a copy of this item, but wrapping aItem instead of our existing list.

Detailed Description

nsDisplayClip can clip a list of items, but we take a single item initially and then later merge other items into it when we merge adjacent matching nsDisplayClips


Constructor & Destructor Documentation

nsDisplayClip::nsDisplayClip ( nsIFrame *  aFrame,
nsIFrame *  aClippingFrame,
nsDisplayItem aItem,
const nsRect aRect 
)
Parameters:
aFrame the frame that should be considered the underlying frame for this content, e.g. the frame whose z-index we have.
aClippingFrame the frame that is inducing the clipping.
nsDisplayClip::nsDisplayClip ( nsIFrame *  aFrame,
nsIFrame *  aClippingFrame,
nsDisplayList aList,
const nsRect aRect 
)

Member Function Documentation

virtual PRBool nsDisplayClip::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 nsDisplayWrapList.

virtual nsRect nsDisplayClip::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 nsDisplayWrapList.

nsIFrame* nsDisplayClip::GetClippingFrame (  )  [inline]
nsRect nsDisplayClip::GetClipRect (  )  [inline]
virtual Type nsDisplayClip::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 nsDisplayWrapList.

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

Actually paint this item to some rendering context.

Content outside mVisibleRect need not be painted.

Reimplemented from nsDisplayWrapList.

void nsDisplayClip::SetClipRect ( const nsRect aRect  )  [inline]
virtual PRBool nsDisplayClip::TryMerge ( nsDisplayListBuilder aBuilder,
nsDisplayItem aItem 
) [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 nsDisplayWrapList.

virtual nsDisplayWrapList* nsDisplayClip::WrapWithClone ( nsDisplayListBuilder aBuilder,
nsDisplayItem aItem 
) [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 from nsDisplayWrapList.


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