Bug 373634 - adding a viewBox attribute to outer SVG not working.

r=jwatt, sr=roc
This commit is contained in:
tor%cs.brown.edu 2007-03-19 15:12:26 +00:00
parent a749b09f5f
commit 334a738e0c
2 changed files with 24 additions and 1 deletions

View File

@ -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<nsIDOMSVGAnimatedRect> r = do_QueryInterface(observable);
if (r != mViewBox) {
InvalidateTransformNotifyFrame();
}
return NS_OK;
}

View File

@ -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);