Public Member Functions | Static Public Member Functions

nsDisplayTransform Class Reference

#include <nsDisplayList.h>

Inheritance diagram for nsDisplayTransform:
Collaboration diagram for nsDisplayTransform:

List of all members.

Public Member Functions

 nsDisplayTransform (nsIFrame *aFrame, nsDisplayList *aList)
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 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).

Static Public Member Functions

static nsRect TransformRect (const nsRect &aUntransformedBounds, const nsIFrame *aFrame, const nsPoint &aOrigin, const nsRect *aBoundsOverride=0)
 TransformRect takes in as parameters a rectangle (in aFrame's coordinate space) and returns the smallest rectangle (in aFrame's coordinate space) containing the transformed image of that rectangle.
static nsRect UntransformRect (const nsRect &aUntransformedBounds, const nsIFrame *aFrame, const nsPoint &aOrigin)
static nsRect GetFrameBoundsForTransform (const nsIFrame *aFrame)
 Returns the bounds of a frame as defined for transforms.
static gfxMatrix GetResultingTransformMatrix (const nsIFrame *aFrame, const nsPoint &aOrigin, float aFactor, const nsRect *aBoundsOverride=0)
 Given a frame with the -moz-transform property, returns the transformation matrix for that frame.

Constructor & Destructor Documentation

nsDisplayTransform::nsDisplayTransform ( nsIFrame *  aFrame,
nsDisplayList aList 
) [inline]

Member Function Documentation

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

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

static nsRect nsDisplayTransform::GetFrameBoundsForTransform ( const nsIFrame *  aFrame  )  [static]

Returns the bounds of a frame as defined for transforms.

If UNIFIED_CONTINUATIONS is not defined, this is simply the frame's bounding rectangle, translated to the origin. Otherwise, returns the smallest rectangle containing a frame and all of its continuations. For example, if there is a element with several continuations split over several lines, this function will return the rectangle containing all of those continuations. This rectangle is relative to the origin of the frame's local coordinate space.

Parameters:
aFrame The frame to get the bounding rect for.
Returns:
The frame's bounding rect, as described above.

static gfxMatrix nsDisplayTransform::GetResultingTransformMatrix ( const nsIFrame *  aFrame,
const nsPoint aOrigin,
float  aFactor,
const nsRect aBoundsOverride = 0 
) [static]

Given a frame with the -moz-transform property, returns the transformation matrix for that frame.

Parameters:
aFrame The frame to get the matrix from.
aOrigin Relative to which point this transform should be applied.
aScaleFactor The number of app units per graphics unit.
aBoundsOverride [optional] If this is nsnull (the default), the computation will use the value of GetFrameBoundsForTransform(aFrame) for the frame's bounding rectangle. Otherwise, it will use the value of aBoundsOverride. This is mostly for internal use and in most cases you will not need to specify a value.
virtual Type nsDisplayTransform::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.

virtual nsIFrame* nsDisplayTransform::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 nsDisplayTransform::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.

virtual PRBool nsDisplayTransform::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 void nsDisplayTransform::Paint ( nsDisplayListBuilder aBuilder,
nsIRenderingContext *  aCtx 
) [virtual]

Actually paint this item to some rendering context.

Content outside mVisibleRect need not be painted.

Reimplemented from nsDisplayItem.

static nsRect nsDisplayTransform::TransformRect ( const nsRect aUntransformedBounds,
const nsIFrame *  aFrame,
const nsPoint aOrigin,
const nsRect aBoundsOverride = 0 
) [static]

TransformRect takes in as parameters a rectangle (in aFrame's coordinate space) and returns the smallest rectangle (in aFrame's coordinate space) containing the transformed image of that rectangle.

That is, it takes the four corners of the rectangle, transforms them according to the matrix associated with the specified frame, then returns the smallest rectangle containing the four transformed points.

Parameters:
untransformedBounds The rectangle (in app units) to transform.
aFrame The frame whose transformation should be applied. This function raises an assertion if aFrame is null or doesn't have a transform applied to it.
aOrigin The origin of the transform relative to aFrame's local coordinate space.
aBoundsOverride (optional) Rather than using the frame's computed bounding rect as frame bounds, use this rectangle instead. Pass nsnull (or nothing at all) to use the default.
virtual PRBool nsDisplayTransform::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 nsDisplayItem.

static nsRect nsDisplayTransform::UntransformRect ( const nsRect aUntransformedBounds,
const nsIFrame *  aFrame,
const nsPoint aOrigin 
) [static]

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