Bug 756462 - Stop unnecessary propagating COORD_CONTEXT_CHANGED notifications to descendants of nsSVGInnerSVGFrame. r=longsonr.

This commit is contained in:
Jonathan Watt 2012-05-19 14:50:07 +01:00
parent bb1ba049a4
commit ba87c24d19
2 changed files with 16 additions and 14 deletions

View File

@ -155,20 +155,18 @@ nsSVGInnerSVGFrame::NotifySVGChanged(PRUint32 aFlags)
aFlags |= TRANSFORM_CHANGED; aFlags |= TRANSFORM_CHANGED;
} }
// XXX We could clear the COORD_CONTEXT_CHANGED flag in some circumstances if (svg->HasViewBox() ||
// if we have a non-percentage 'width' AND 'height, or if we have a 'viewBox' (!svg->mLengthAttributes[nsSVGSVGElement::WIDTH].IsPercentage() &&
// rect. This is because, when we have a viewBox rect, the viewBox rect !svg->mLengthAttributes[nsSVGSVGElement::HEIGHT].IsPercentage())) {
// is the coordinate context for our children, and it isn't changing. // Remove COORD_CONTEXT_CHANGED, since we establish the coordinate
// Percentage lengths on our children will continue to resolve to the // context for our descendants and this notification won't change its
// same number of user units because they're relative to our viewBox rect. The // dimensions:
// same is true if we have a non-percentage width and height and don't have a aFlags &= ~COORD_CONTEXT_CHANGED;
// viewBox. We (the <svg>) establish the coordinate context for our children. Our
// children don't care about changes to our parent coordinate context unless that if (!(aFlags & ~DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
// change results in a change to the coordinate context that _we_ establish. Hence return; // No notification flags left
// we can (should, really) stop propagating COORD_CONTEXT_CHANGED in these cases. }
// We'd actually need to check that we have a viewBox rect and not just }
// that viewBox is set, since it could be set to none.
// Take care not to break the testcase for bug 394463 when implementing this
} }
if (aFlags & TRANSFORM_CHANGED) { if (aFlags & TRANSFORM_CHANGED) {

View File

@ -225,6 +225,10 @@ nsSVGUseFrame::NotifySVGChanged(PRUint32 aFlags)
} }
} }
// We don't remove the TRANSFORM_CHANGED flag here if we have a viewBox or
// non-percentage width/height, since if they're set then they are cloned to
// an anonymous child <svg>, and its nsSVGInnerSVGFrame will do that.
nsSVGUseFrameBase::NotifySVGChanged(aFlags); nsSVGUseFrameBase::NotifySVGChanged(aFlags);
} }