Bug 455226 - Removing the xlink:href attribute of an feImage filter does not cause it to change; r+sr=bzbarsky

This commit is contained in:
Robert Longson 2008-09-20 17:07:54 +02:00
Родитель dd8f34b6a6
Коммит ee543b8f1d
2 изменённых файлов: 56 добавлений и 43 удалений

Просмотреть файл

@ -5195,12 +5195,11 @@ public:
NS_FORWARD_NSIDOMNODE(nsSVGFEImageElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEImageElementBase::)
// nsSVGElement
virtual void DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr);
// nsIContent
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
PRBool aCompileEventHandlers);
@ -5316,6 +5315,22 @@ nsSVGFEImageElement::LoadSVGImage(PRBool aForce, PRBool aNotify)
//----------------------------------------------------------------------
// nsIContent methods:
nsresult
nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify)
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
if (aValue) {
LoadSVGImage(PR_TRUE, aNotify);
} else {
CancelImageRequests(aNotify);
}
}
return nsSVGFEImageElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aNotify);
}
nsresult
nsSVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -5326,11 +5341,13 @@ nsSVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadSVGImage(PR_FALSE, PR_FALSE);
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadSVGImage(PR_FALSE, PR_FALSE);
}
return rv;
}
@ -5434,16 +5451,6 @@ nsSVGFEImageElement::GetStringInfo()
NS_ARRAY_LENGTH(sStringInfo));
}
void
nsSVGFEImageElement::DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr)
{
nsSVGFEImageElementBase::DidChangeString(aAttrEnum, aDoSetAttr);
if (aAttrEnum == HREF) {
LoadSVGImage(PR_TRUE, PR_TRUE);
}
}
//----------------------------------------------------------------------
// imgIDecoderObserver methods

Просмотреть файл

@ -81,10 +81,9 @@ public:
NS_FORWARD_NSIDOMELEMENT(nsSVGImageElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGImageElementBase::)
// nsSVGElement specializations:
virtual void DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr);
// nsIContent interface
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
PRBool aCompileEventHandlers);
@ -249,23 +248,6 @@ nsSVGImageElement::GetLengthInfo()
NS_ARRAY_LENGTH(sLengthInfo));
}
void
nsSVGImageElement::DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr)
{
nsSVGImageElementBase::DidChangeString(aAttrEnum, aDoSetAttr);
if (aAttrEnum == HREF) {
// If caller is not chrome and dom.disable_image_src_set is true,
// prevent setting image.src by exiting early
if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
!nsContentUtils::IsCallerChrome()) {
return;
}
LoadSVGImage(PR_TRUE, PR_TRUE);
}
}
//----------------------------------------------------------------------
nsresult
@ -286,6 +268,28 @@ nsSVGImageElement::LoadSVGImage(PRBool aForce, PRBool aNotify)
//----------------------------------------------------------------------
// nsIContent methods:
nsresult
nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify)
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
// If caller is not chrome and dom.disable_image_src_set is true,
// prevent setting image.src by exiting early
if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
!nsContentUtils::IsCallerChrome()) {
return NS_OK;
}
if (aValue) {
LoadSVGImage(PR_TRUE, aNotify);
} else {
CancelImageRequests(aNotify);
}
}
return nsSVGImageElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aNotify);
}
nsresult
nsSVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -296,11 +300,13 @@ nsSVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadSVGImage(PR_FALSE, PR_FALSE);
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadSVGImage(PR_FALSE, PR_FALSE);
}
return rv;
}