diff --git a/content/svg/content/src/nsSVGSVGElement.cpp b/content/svg/content/src/nsSVGSVGElement.cpp index 57c9a87adcd..be927e916c5 100644 --- a/content/svg/content/src/nsSVGSVGElement.cpp +++ b/content/svg/content/src/nsSVGSVGElement.cpp @@ -1106,6 +1106,23 @@ nsSVGSVGElement::IsAttributeMapped(const nsIAtom* name) const nsSVGSVGElementBase::IsAttributeMapped(name); } +nsresult +nsSVGSVGElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString* aValue, PRBool aNotify) +{ + nsSVGSVGElementBase::AfterSetAttr(aNameSpaceID, aName, aValue, aNotify); + + // We need to do this here because the calling + // InvalidateTransformNotifyFrame in DidModifySVGObservable would + // happen too early, before HasAttr(viewBox) returns true (important + // in the case of adding a viewBox) + if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::viewBox) { + InvalidateTransformNotifyFrame(); + } + + return NS_OK; +} + nsresult nsSVGSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, PRBool aNotify) @@ -1186,7 +1203,11 @@ nsSVGSVGElement::DidModifySVGObservable (nsISVGValue* observable, } } - InvalidateTransformNotifyFrame(); + // Deal with viewBox in AfterSetAttr (see comment there for reason) + nsCOMPtr r = do_QueryInterface(observable); + if (r != mViewBox) { + InvalidateTransformNotifyFrame(); + } return NS_OK; } diff --git a/content/svg/content/src/nsSVGSVGElement.h b/content/svg/content/src/nsSVGSVGElement.h index fe2ed178e07..fd7686cd983 100644 --- a/content/svg/content/src/nsSVGSVGElement.h +++ b/content/svg/content/src/nsSVGSVGElement.h @@ -102,6 +102,8 @@ public: // nsIContent interface NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; + virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString* aValue, PRBool aNotify); virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify);