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 d2d06bae65
commit 55a0c649a1
13 changed files with 76 additions and 16 deletions

View File

@ -98,13 +98,16 @@ public:
// Flags to pass to NotifySVGChange:
//
// SUPPRESS_INVALIDATION - do not invalidate rendered areas (only to be
// used in conjunction with TRANSFORM_CHANGED)
// DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
// 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
// COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has
// changed (percentage lengths must be reevaluated)
enum SVGChangedFlags {
SUPPRESS_INVALIDATION = 0x01,
DO_NOT_NOTIFY_RENDERING_OBSERVERS = 0x01,
TRANSFORM_CHANGED = 0x02,
COORD_CONTEXT_CHANGED = 0x04
};

View File

@ -159,6 +159,13 @@ nsSVGAFrame::GetType() const
void
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) {
// make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nsnull;

View File

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

View File

@ -227,8 +227,12 @@ nsSVGDisplayContainerFrame::InitialUpdate()
void
nsSVGDisplayContainerFrame::NotifySVGChanged(PRUint32 aFlags)
{
NS_ASSERTION(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
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");
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
}

View File

@ -394,6 +394,13 @@ nsSVGForeignObjectFrame::InitialUpdate()
void
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;
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
// reflow.
mCanvasTM = nsnull;
if (!(aFlags & SUPPRESS_INVALIDATION)) {
if (!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
UpdateGraphic();
}

View File

@ -80,6 +80,13 @@ nsSVGGFrame::GetType() const
void
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) {
// make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nsnull;

View File

@ -521,10 +521,17 @@ nsSVGGlyphFrame::InitialUpdate()
void
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) {
ClearTextRun();
}
if (!(aFlags & SUPPRESS_INVALIDATION)) {
if (!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
nsSVGUtils::UpdateGraphic(this);
}
}

View File

@ -113,6 +113,13 @@ nsSVGInnerSVGFrame::PaintSVG(nsRenderingContext *aContext,
void
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) {
nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(mContent);

View File

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

View File

@ -247,7 +247,14 @@ nsSVGPathGeometryFrame::InitialUpdate()
void
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);
}
}

View File

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

View File

@ -181,6 +181,13 @@ nsSVGTextFrame::GetRotationOfChar(PRUint32 charnum, float *_retval)
void
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;
if (aFlags & COORD_CONTEXT_CHANGED) {