author | Robert Longson <longsonr@gmail.com> |
Thu, 06 Nov 2014 09:30:11 +0000 | |
changeset 214375 | 7822514901e6008021b06bad4d862fa7c62b7bcf |
parent 214374 | 0c68932bcf9f9b8182ed58a39c19727e1a885800 |
child 214376 | aebe859551b3c0a327060b43c22ba1461172b141 |
push id | 27780 |
push user | kwierso@gmail.com |
push date | Fri, 07 Nov 2014 02:25:05 +0000 |
treeherder | mozilla-central@e6d47abb6a7b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jwatt |
bugs | 1090936 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/svg/SVGSwitchElement.cpp +++ b/dom/svg/SVGSwitchElement.cpp @@ -1,16 +1,16 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/SVGSwitchElement.h" -#include "nsSVGEffects.h" +#include "nsLayoutUtils.h" #include "nsSVGUtils.h" #include "mozilla/Preferences.h" #include "mozilla/dom/SVGSwitchElementBinding.h" class nsIFrame; NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Switch) @@ -57,17 +57,19 @@ SVGSwitchElement::MaybeInvalidate() nsIContent *newActiveChild = FindActiveChild(); if (newActiveChild == mActiveChild) { return; } nsIFrame *frame = GetPrimaryFrame(); if (frame) { - nsSVGEffects::InvalidateRenderingObservers(frame); + nsLayoutUtils::PostRestyleEvent( + this, nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(frame); } mActiveChild = newActiveChild; } //---------------------------------------------------------------------- // nsIDOMNode methods
--- a/layout/svg/SVGFEContainerFrame.cpp +++ b/layout/svg/SVGFEContainerFrame.cpp @@ -96,14 +96,16 @@ SVGFEContainerFrame::GetType() const nsresult SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { nsSVGFE *element = static_cast<nsSVGFE*>(mContent); if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { - nsSVGEffects::InvalidateRenderingObservers(this); + MOZ_ASSERT(GetParent()->GetType() == nsGkAtoms::svgFilterFrame, + "Observers observe the filter, so that's what we must invalidate"); + nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } return SVGFEContainerFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); }
--- a/layout/svg/SVGFEImageFrame.cpp +++ b/layout/svg/SVGFEImageFrame.cpp @@ -1,14 +1,15 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Keep in (case-insensitive) order: +#include "nsContainerFrame.h" #include "nsContentUtils.h" #include "nsFrame.h" #include "nsGkAtoms.h" #include "nsLiteralString.h" #include "nsSVGEffects.h" #include "nsSVGFilters.h" #include "mozilla/dom/SVGFEImageElement.h" @@ -117,17 +118,19 @@ SVGFEImageFrame::GetType() const nsresult SVGFEImageFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { SVGFEImageElement *element = static_cast<SVGFEImageElement*>(mContent); if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { - nsSVGEffects::InvalidateRenderingObservers(this); + MOZ_ASSERT(GetParent()->GetType() == nsGkAtoms::svgFilterFrame, + "Observers observe the filter, so that's what we must invalidate"); + nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } if (aNameSpaceID == kNameSpaceID_XLink && aAttribute == nsGkAtoms::href) { // Prevent setting image.src by exiting early if (nsContentUtils::IsImageSrcSetDisabled()) { return NS_OK; } @@ -135,10 +138,10 @@ SVGFEImageFrame::AttributeChanged(int32_ if (element->mStringAttributes[SVGFEImageElement::HREF].IsExplicitlySet()) { element->LoadSVGImage(true, true); } else { element->CancelImageRequests(true); } } return SVGFEImageFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + aAttribute, aModType); }
--- a/layout/svg/SVGFELeafFrame.cpp +++ b/layout/svg/SVGFELeafFrame.cpp @@ -1,14 +1,15 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Keep in (case-insensitive) order: +#include "nsContainerFrame.h" #include "nsFrame.h" #include "nsGkAtoms.h" #include "nsSVGEffects.h" #include "nsSVGFilters.h" typedef nsFrame SVGFELeafFrameBase; /* @@ -94,14 +95,16 @@ SVGFELeafFrame::GetType() const nsresult SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { nsSVGFE *element = static_cast<nsSVGFE*>(mContent); if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { - nsSVGEffects::InvalidateRenderingObservers(this); + MOZ_ASSERT(GetParent()->GetType() == nsGkAtoms::svgFilterFrame, + "Observers observe the filter, so that's what we must invalidate"); + nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + aAttribute, aModType); }
--- a/layout/svg/SVGFEUnstyledLeafFrame.cpp +++ b/layout/svg/SVGFEUnstyledLeafFrame.cpp @@ -1,14 +1,15 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Keep in (case-insensitive) order: +#include "nsContainerFrame.h" #include "nsFrame.h" #include "nsGkAtoms.h" #include "nsSVGEffects.h" #include "nsSVGFilters.h" typedef nsFrame SVGFEUnstyledLeafFrameBase; class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase @@ -21,18 +22,18 @@ protected: { AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } public: NS_DECL_FRAMEARENA_HELPERS virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, - const nsDisplayListSet& aLists) MOZ_OVERRIDE {} + const nsRect& aDirtyRect, + const nsDisplayListSet& aLists) MOZ_OVERRIDE {} virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { return SVGFEUnstyledLeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); } #ifdef DEBUG_FRAME_DUMP virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE @@ -74,14 +75,16 @@ SVGFEUnstyledLeafFrame::GetType() const nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent); if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { - nsSVGEffects::InvalidateRenderingObservers(this); + MOZ_ASSERT(GetParent()->GetParent()->GetType() == nsGkAtoms::svgFilterFrame, + "Observers observe the filter, so that's what we must invalidate"); + nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()->GetParent()); } return SVGFEUnstyledLeafFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); }
--- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3319,17 +3319,19 @@ SVGTextFrame::ReflowSVGNonDisplayText() // We had a style change, so we mark this frame as dirty so that the next // time it is painted, we reflow the anonymous block frame. AddStateBits(NS_FRAME_IS_DIRTY); // We also need to call InvalidateRenderingObservers, so that if the <text> // element is within a <mask>, say, the element referencing the <mask> will // be updated, which will then cause this SVGTextFrame to be painted and // in doing so cause the anonymous block frame to be reflowed. - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); // Finally, we need to actually reflow the anonymous block frame and update // mPositions, in case we are being reflowed immediately after a DOM // mutation that needs frame reconstruction. MaybeReflowAnonymousBlockChild(); UpdateGlyphPositioning(); } @@ -5190,17 +5192,19 @@ SVGTextFrame::ScheduleReflowSVG() nsSVGUtils::ScheduleReflowSVG(this); } } void SVGTextFrame::NotifyGlyphMetricsChange() { AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY); - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); ScheduleReflowSVG(); } void SVGTextFrame::UpdateGlyphPositioning() { nsIFrame* kid = GetFirstPrincipalChild(); if (!kid) {
--- a/layout/svg/nsSVGClipPathFrame.cpp +++ b/layout/svg/nsSVGClipPathFrame.cpp @@ -310,17 +310,17 @@ nsSVGClipPathFrame::AttributeChanged(int { if (aNameSpaceID == kNameSpaceID_None) { if (aAttribute == nsGkAtoms::transform) { nsSVGEffects::InvalidateDirectRenderingObservers(this); nsSVGUtils::NotifyChildrenOfSVGChange(this, nsISVGChildFrame::TRANSFORM_CHANGED); } if (aAttribute == nsGkAtoms::clipPathUnits) { - nsSVGEffects::InvalidateRenderingObservers(this); + nsSVGEffects::InvalidateDirectRenderingObservers(this); } } return nsSVGClipPathFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); } void
--- a/layout/svg/nsSVGEffects.cpp +++ b/layout/svg/nsSVGEffects.cpp @@ -223,17 +223,19 @@ void nsSVGRenderingObserverProperty::DoUpdate() { nsSVGIDRenderingObserver::DoUpdate(); nsIFrame* frame = mFrameReference.Get(); if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) { // Changes should propagate out to things that might be observing // the referencing frame or its ancestors. - nsSVGEffects::InvalidateRenderingObservers(frame); + nsLayoutUtils::PostRestyleEvent( + frame->GetContent()->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); } } NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGFilterReference) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGFilterReference) NS_IMPL_CYCLE_COLLECTION(nsSVGFilterReference, mElement) @@ -311,26 +313,26 @@ nsSVGFilterChainObserver::IsInObserverLi void nsSVGFilterProperty::DoUpdate() { nsIFrame* frame = mFrameReference.Get(); if (!frame) return; + // Repaint asynchronously in case the filter frame is being torn down + nsChangeHint changeHint = + nsChangeHint(nsChangeHint_RepaintFrame); + if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) { // Changes should propagate out to things that might be observing // the referencing frame or its ancestors. - nsSVGEffects::InvalidateRenderingObservers(frame); + NS_UpdateHint(changeHint, nsChangeHint_InvalidateRenderingObservers); } - // Repaint asynchronously in case the filter frame is being torn down - nsChangeHint changeHint = - nsChangeHint(nsChangeHint_RepaintFrame); - // Don't need to request UpdateOverflow if we're being reflowed. if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) { NS_UpdateHint(changeHint, nsChangeHint_UpdateOverflow); } frame->PresContext()->RestyleManager()->PostRestyleEvent( frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint); } @@ -346,19 +348,19 @@ nsSVGMarkerProperty::DoUpdate() NS_ASSERTION(frame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected"); // Repaint asynchronously in case the marker frame is being torn down nsChangeHint changeHint = nsChangeHint(nsChangeHint_RepaintFrame); // Don't need to request ReflowFrame if we're being reflowed. if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) { + NS_UpdateHint(changeHint, nsChangeHint_InvalidateRenderingObservers); // XXXjwatt: We need to unify SVG into standard reflow so we can just use // nsChangeHint_NeedReflow | nsChangeHint_NeedDirtyReflow here. - nsSVGEffects::InvalidateRenderingObservers(frame); // XXXSDL KILL THIS!!! nsSVGUtils::ScheduleReflowSVG(frame); } frame->PresContext()->RestyleManager()->PostRestyleEvent( frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint); } bool @@ -418,17 +420,19 @@ nsSVGPaintingProperty::DoUpdate() { nsSVGRenderingObserverProperty::DoUpdate(); nsIFrame* frame = mFrameReference.Get(); if (!frame) return; if (frame->GetStateBits() & NS_FRAME_SVG_LAYOUT) { - nsSVGEffects::InvalidateRenderingObservers(frame); + nsLayoutUtils::PostRestyleEvent( + frame->GetContent()->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); frame->InvalidateFrameSubtree(); } else { InvalidateAllContinuations(frame); } } static nsSVGRenderingObserver * CreateMarkerProperty(nsIURI *aURI, nsIFrame *aFrame, bool aReferenceImage)
--- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -86,35 +86,41 @@ nsSVGForeignObjectFrame::GetType() const nsresult nsSVGForeignObjectFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom *aAttribute, int32_t aModType) { if (aNameSpaceID == kNameSpaceID_None) { if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) { - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); // XXXjwatt: why mark intrinsic widths dirty? can't we just use eResize? RequestReflow(nsIPresShell::eStyleChange); } else if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) { // make sure our cached transform matrix gets (lazily) updated mCanvasTM = nullptr; - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); } else 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. mCanvasTM = nullptr; } else if (aAttribute == nsGkAtoms::viewBox || aAttribute == nsGkAtoms::preserveAspectRatio) { - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); } } return NS_OK; } void nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext,
--- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -186,17 +186,19 @@ nsSVGImageFrame::AttributeChanged(int32_ nsIAtom* aAttribute, int32_t aModType) { if (aNameSpaceID == kNameSpaceID_None) { if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y || aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) { - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); return NS_OK; } else if (aAttribute == nsGkAtoms::preserveAspectRatio) { // We don't paint the content of the image using display lists, therefore // we have to invalidate for this children-only transform changes since // there is no layer tree to notice that the transform changed and // recomposite. @@ -579,30 +581,36 @@ nsSVGImageListener::nsSVGImageListener(n NS_IMETHODIMP nsSVGImageListener::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData) { if (!mFrame) return NS_ERROR_FAILURE; if (aType == imgINotificationObserver::LOAD_COMPLETE) { mFrame->InvalidateFrame(); - nsSVGEffects::InvalidateRenderingObservers(mFrame); + nsLayoutUtils::PostRestyleEvent( + mFrame->GetContent()->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(mFrame); } if (aType == imgINotificationObserver::FRAME_UPDATE) { // No new dimensions, so we don't need to call // nsSVGUtils::InvalidateAndScheduleBoundsUpdate. - nsSVGEffects::InvalidateRenderingObservers(mFrame); + nsLayoutUtils::PostRestyleEvent( + mFrame->GetContent()->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); mFrame->InvalidateFrame(); } if (aType == imgINotificationObserver::SIZE_AVAILABLE) { // Called once the resource's dimensions have been obtained. aRequest->GetImage(getter_AddRefs(mFrame->mImageContainer)); mFrame->InvalidateFrame(); - nsSVGEffects::InvalidateRenderingObservers(mFrame); + nsLayoutUtils::PostRestyleEvent( + mFrame->GetContent()->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(mFrame); } return NS_OK; }
--- a/layout/svg/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/nsSVGInnerSVGFrame.cpp @@ -7,17 +7,16 @@ #include "nsSVGInnerSVGFrame.h" // Keep others in (case-insensitive) order: #include "gfx2DGlue.h" #include "gfxContext.h" #include "nsIFrame.h" #include "nsISVGChildFrame.h" #include "nsSVGContainerFrame.h" -#include "nsSVGEffects.h" #include "nsSVGIntegrationUtils.h" #include "mozilla/dom/SVGSVGElement.h" using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::gfx; nsIFrame* @@ -192,17 +191,19 @@ nsSVGInnerSVGFrame::AttributeChanged(int { if (aNameSpaceID == kNameSpaceID_None && !(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent); if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) { - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); if (content->HasViewBoxOrSyntheticViewBox()) { // make sure our cached transform matrix gets (lazily) updated mCanvasTM = nullptr; content->ChildrenOnlyTransformChanged(); nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED); } else { @@ -227,17 +228,19 @@ nsSVGInnerSVGFrame::AttributeChanged(int 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); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); } else if (aAttribute == nsGkAtoms::viewBox || (aAttribute == nsGkAtoms::preserveAspectRatio && content->HasViewBoxOrSyntheticViewBox())) { content->ChildrenOnlyTransformChanged(); // SchedulePaint sets a global state flag so we only need to call it once // (on ourself is fine), not once on each child (despite bug 828240). SchedulePaint();
--- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -134,17 +134,19 @@ nsSVGPathGeometryFrame::AttributeChanged // 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); + nsLayoutUtils::PostRestyleEvent( + mContent->AsElement(), nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); } return NS_OK; } /* virtual */ void nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) {
--- a/layout/svg/nsSVGStopFrame.cpp +++ b/layout/svg/nsSVGStopFrame.cpp @@ -1,14 +1,15 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Keep in (case-insensitive) order: +#include "nsContainerFrame.h" #include "nsFrame.h" #include "nsGkAtoms.h" #include "nsStyleContext.h" #include "nsSVGEffects.h" // This is a very simple frame whose only purpose is to capture style change // events and propagate them to the parent. Most of the heavy lifting is done // within the nsSVGGradientFrame, which is the parent for this frame @@ -92,17 +93,20 @@ nsSVGStopFrame::GetType() const nsresult nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::offset) { - nsSVGEffects::InvalidateRenderingObservers(this); + MOZ_ASSERT(GetParent()->GetType() == nsGkAtoms::svgLinearGradientFrame || + GetParent()->GetType() == nsGkAtoms::svgRadialGradientFrame, + "Observers observe the gradient, so that's what we must invalidate"); + nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } return nsSVGStopFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); } // ------------------------------------------------------------------------- // Public functions
--- a/layout/svg/nsSVGUseFrame.cpp +++ b/layout/svg/nsSVGUseFrame.cpp @@ -119,39 +119,45 @@ nsSVGUseFrame::AttributeChanged(int32_t { SVGUseElement *useElement = static_cast<SVGUseElement*>(mContent); if (aNameSpaceID == kNameSpaceID_None) { if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) { // make sure our cached transform matrix gets (lazily) updated mCanvasTM = nullptr; - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + useElement, nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED); } else if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) { bool invalidate = false; if (mHasValidDimensions != useElement->HasValidDimensions()) { mHasValidDimensions = !mHasValidDimensions; invalidate = true; } if (useElement->OurWidthAndHeightAreUsed()) { invalidate = true; useElement->SyncWidthOrHeight(aAttribute); } if (invalidate) { - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + useElement, nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); } } } else if (aNameSpaceID == kNameSpaceID_XLink && aAttribute == nsGkAtoms::href) { // we're changing our nature, clear out the clone information - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + useElement, nsRestyleHint(0), + nsChangeHint_InvalidateRenderingObservers); nsSVGUtils::ScheduleReflowSVG(this); useElement->mOriginal = nullptr; useElement->UnlinkSource(); useElement->TriggerReclone(); } return nsSVGUseFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); @@ -229,17 +235,18 @@ nsSVGUseFrame::NotifySVGChanged(uint32_t // nsIAnonymousContentCreator methods: nsresult nsSVGUseFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements) { SVGUseElement *use = static_cast<SVGUseElement*>(mContent); nsIContent* clone = use->CreateAnonymousContent(); - nsSVGEffects::InvalidateRenderingObservers(this); + nsLayoutUtils::PostRestyleEvent( + use, nsRestyleHint(0), nsChangeHint_InvalidateRenderingObservers); if (!clone) return NS_ERROR_FAILURE; if (!aElements.AppendElement(clone)) return NS_ERROR_OUT_OF_MEMORY; return NS_OK; } void