Bug 874854 - Stop calling SchedulePaint for SVG transform attribute changes. r=longsonr

This commit is contained in:
Jonathan Watt 2013-05-23 08:04:21 +01:00
parent 7c6786d1d2
commit d1f5d8d8d3
8 changed files with 37 additions and 14 deletions

View File

@ -2278,6 +2278,12 @@ public:
* invalid areas in the layer tree and schedule a layer tree
* composite operation to display the layer tree.
*
* In general it is not necessary for frames to call this when they change.
* For example, changes that result in a reflow will have this called for
* them by PresContext::DoReflow when the reflow begins. Style changes that
* do not trigger a reflow should have this called for them by
* DoApplyRenderingChangeToTree.
*
* @param aFlags PAINT_COMPOSITE_ONLY : No changes have been made
* that require a layer tree update, so only schedule a layer
* tree composite.

View File

@ -106,9 +106,11 @@ nsSVGAFrame::AttributeChanged(int32_t aNameSpaceID,
{
if (aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::transform) {
// Don't invalidate (the layers code does that).
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
NotifySVGChanged(TRANSFORM_CHANGED);
SchedulePaint();
}
return NS_OK;

View File

@ -104,8 +104,10 @@ nsSVGForeignObjectFrame::AttributeChanged(int32_t aNameSpaceID,
nsSVGEffects::InvalidateRenderingObservers(this);
nsSVGUtils::ScheduleReflowSVG(this);
} else if (aAttribute == nsGkAtoms::transform) {
// Don't invalidate (the layers code does that).
SchedulePaint();
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
mCanvasTM = nullptr;
} else if (aAttribute == nsGkAtoms::viewBox ||
aAttribute == nsGkAtoms::preserveAspectRatio) {

View File

@ -93,9 +93,11 @@ nsSVGGFrame::AttributeChanged(int32_t aNameSpaceID,
{
if (aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::transform) {
// Don't invalidate (the layers code does that).
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
NotifySVGChanged(TRANSFORM_CHANGED);
SchedulePaint();
}
return NS_OK;

View File

@ -202,12 +202,14 @@ nsSVGInnerSVGFrame::AttributeChanged(int32_t aNameSpaceID,
this, aAttribute == nsGkAtoms::viewBox ?
TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED : TRANSFORM_CHANGED);
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) {
nsSVGEffects::InvalidateRenderingObservers(this);
nsSVGUtils::ScheduleReflowSVG(this);
} else if (aAttribute == nsGkAtoms::transform) {
// Don't invalidate (the layers code does that).
SchedulePaint();
} else if (aAttribute == nsGkAtoms::viewBox ||
(aAttribute == nsGkAtoms::preserveAspectRatio &&
content->HasViewBoxOrSyntheticViewBox())) {

View File

@ -106,14 +106,16 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
if (aNameSpaceID == kNameSpaceID_None &&
(static_cast<nsSVGPathGeometryElement*>
(mContent)->AttributeDefinesGeometry(aAttribute))) {
nsSVGEffects::InvalidateRenderingObservers(this);
nsSVGUtils::ScheduleReflowSVG(this);
} else if (aAttribute == nsGkAtoms::transform) {
// Don't invalidate (the layers code does that).
SchedulePaint();
}
return NS_OK;
}

View File

@ -55,9 +55,11 @@ nsSVGTextFrame::AttributeChanged(int32_t aNameSpaceID,
return NS_OK;
if (aAttribute == nsGkAtoms::transform) {
// Don't invalidate (the layers code does that).
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
NotifySVGChanged(TRANSFORM_CHANGED);
SchedulePaint();
} else if (aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y ||
aAttribute == nsGkAtoms::dx ||

View File

@ -3019,6 +3019,11 @@ nsSVGTextFrame2::AttributeChanged(int32_t aNameSpaceID,
return NS_OK;
if (aAttribute == nsGkAtoms::transform) {
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
NotifySVGChanged(TRANSFORM_CHANGED);
} else if (IsGlyphPositioningAttribute(aAttribute)) {
NotifyGlyphMetricsChange();