Bug 734732 - Rename nsISVGChildFrame::SUPPRESS_INVALIDATION so it's not misleading. r=longsonr.

--HG--
extra : rebase_source : e12bd28657acceec99b7dc723149a72be1b9b75f
This commit is contained in:
Jonathan Watt 2012-03-11 15:53:36 +00:00
parent d92c873210
commit 726cd3bb85
13 changed files with 76 additions and 16 deletions

View File

@ -98,13 +98,16 @@ public:
// Flags to pass to NotifySVGChange: // Flags to pass to NotifySVGChange:
// //
// SUPPRESS_INVALIDATION - do not invalidate rendered areas (only to be // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
// used in conjunction with TRANSFORM_CHANGED) // updating the descendant frames of a clipPath,
// mask, pattern or marker frame (or other similar
// NS_STATE_SVG_NONDISPLAY_CHILD frame) immediately
// prior to painting that frame's descendants.
// TRANSFORM_CHANGED - the current transform matrix for this frame has changed // TRANSFORM_CHANGED - the current transform matrix for this frame has changed
// COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has // COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has
// changed (percentage lengths must be reevaluated) // changed (percentage lengths must be reevaluated)
enum SVGChangedFlags { enum SVGChangedFlags {
SUPPRESS_INVALIDATION = 0x01, DO_NOT_NOTIFY_RENDERING_OBSERVERS = 0x01,
TRANSFORM_CHANGED = 0x02, TRANSFORM_CHANGED = 0x02,
COORD_CONTEXT_CHANGED = 0x04 COORD_CONTEXT_CHANGED = 0x04
}; };

View File

@ -159,6 +159,13 @@ nsSVGAFrame::GetType() const
void void
nsSVGAFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGAFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
if (aFlags & TRANSFORM_CHANGED) { if (aFlags & TRANSFORM_CHANGED) {
// make sure our cached transform matrix gets (lazily) updated // make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nsnull; mCanvasTM = nsnull;

View File

@ -102,8 +102,9 @@ nsSVGClipPathFrame::ClipPaint(nsRenderingContext* aContext,
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
if (SVGFrame) { if (SVGFrame) {
// The CTM of each frame referencing us can be different. // The CTM of each frame referencing us can be different.
SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | SVGFrame->NotifySVGChanged(
nsISVGChildFrame::TRANSFORM_CHANGED); nsISVGChildFrame::DO_NOT_NOTIFY_RENDERING_OBSERVERS |
nsISVGChildFrame::TRANSFORM_CHANGED);
bool isOK = true; bool isOK = true;
nsSVGClipPathFrame *clipPathFrame = nsSVGClipPathFrame *clipPathFrame =

View File

@ -227,8 +227,12 @@ nsSVGDisplayContainerFrame::InitialUpdate()
void void
nsSVGDisplayContainerFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGDisplayContainerFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ASSERTION(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
"Invalidation logic may need adjusting"); (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags); nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
} }

View File

@ -394,6 +394,13 @@ nsSVGForeignObjectFrame::InitialUpdate()
void void
nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
bool reflow = false; bool reflow = false;
if (aFlags & TRANSFORM_CHANGED) { if (aFlags & TRANSFORM_CHANGED) {
@ -405,7 +412,7 @@ nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags)
// We also seem to get some sort of infinite loop post bug 421584 if we // We also seem to get some sort of infinite loop post bug 421584 if we
// reflow. // reflow.
mCanvasTM = nsnull; mCanvasTM = nsnull;
if (!(aFlags & SUPPRESS_INVALIDATION)) { if (!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
UpdateGraphic(); UpdateGraphic();
} }

View File

@ -80,6 +80,13 @@ nsSVGGFrame::GetType() const
void void
nsSVGGFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGGFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
if (aFlags & TRANSFORM_CHANGED) { if (aFlags & TRANSFORM_CHANGED) {
// make sure our cached transform matrix gets (lazily) updated // make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nsnull; mCanvasTM = nsnull;

View File

@ -521,10 +521,17 @@ nsSVGGlyphFrame::InitialUpdate()
void void
nsSVGGlyphFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGGlyphFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
if (aFlags & TRANSFORM_CHANGED) { if (aFlags & TRANSFORM_CHANGED) {
ClearTextRun(); ClearTextRun();
} }
if (!(aFlags & SUPPRESS_INVALIDATION)) { if (!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
nsSVGUtils::UpdateGraphic(this); nsSVGUtils::UpdateGraphic(this);
} }
} }

View File

@ -113,6 +113,13 @@ nsSVGInnerSVGFrame::PaintSVG(nsRenderingContext *aContext,
void void
nsSVGInnerSVGFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGInnerSVGFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
if (aFlags & COORD_CONTEXT_CHANGED) { if (aFlags & COORD_CONTEXT_CHANGED) {
nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(mContent); nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(mContent);

View File

@ -163,8 +163,9 @@ nsSVGMarkerFrame::PaintMark(nsRenderingContext *aContext,
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
if (SVGFrame) { if (SVGFrame) {
// The CTM of each frame referencing us may be different. // The CTM of each frame referencing us may be different.
SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | SVGFrame->NotifySVGChanged(
nsISVGChildFrame::TRANSFORM_CHANGED); nsISVGChildFrame::DO_NOT_NOTIFY_RENDERING_OBSERVERS |
nsISVGChildFrame::TRANSFORM_CHANGED);
nsSVGUtils::PaintFrameWithEffects(aContext, nsnull, kid); nsSVGUtils::PaintFrameWithEffects(aContext, nsnull, kid);
} }
} }

View File

@ -128,8 +128,9 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsRenderingContext *aContext,
// The CTM of each frame referencing us can be different // The CTM of each frame referencing us can be different
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | SVGFrame->NotifySVGChanged(
nsISVGChildFrame::TRANSFORM_CHANGED); nsISVGChildFrame::DO_NOT_NOTIFY_RENDERING_OBSERVERS |
nsISVGChildFrame::TRANSFORM_CHANGED);
} }
nsSVGUtils::PaintFrameWithEffects(&tmpCtx, nsnull, kid); nsSVGUtils::PaintFrameWithEffects(&tmpCtx, nsnull, kid);
} }

View File

@ -247,7 +247,14 @@ nsSVGPathGeometryFrame::InitialUpdate()
void void
nsSVGPathGeometryFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGPathGeometryFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
if (!(aFlags & SUPPRESS_INVALIDATION)) { NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
if (!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
nsSVGUtils::UpdateGraphic(this); nsSVGUtils::UpdateGraphic(this);
} }
} }

View File

@ -327,8 +327,9 @@ nsSVGPatternFrame::PaintPattern(gfxASurface** surface,
// The CTM of each frame referencing us can be different // The CTM of each frame referencing us can be different
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | SVGFrame->NotifySVGChanged(
nsISVGChildFrame::TRANSFORM_CHANGED); nsISVGChildFrame::DO_NOT_NOTIFY_RENDERING_OBSERVERS |
nsISVGChildFrame::TRANSFORM_CHANGED);
} }
nsSVGUtils::PaintFrameWithEffects(&context, nsnull, kid); nsSVGUtils::PaintFrameWithEffects(&context, nsnull, kid);
} }

View File

@ -181,6 +181,13 @@ nsSVGTextFrame::GetRotationOfChar(PRUint32 charnum, float *_retval)
void void
nsSVGTextFrame::NotifySVGChanged(PRUint32 aFlags) nsSVGTextFrame::NotifySVGChanged(PRUint32 aFlags)
{ {
NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
bool updateGlyphMetrics = false; bool updateGlyphMetrics = false;
if (aFlags & COORD_CONTEXT_CHANGED) { if (aFlags & COORD_CONTEXT_CHANGED) {