Backed out changeset 50be346999f6 (bug 515494). This fix is not what we want.

This commit is contained in:
Shawn Wilsher 2009-09-28 12:25:49 -07:00
Родитель 06a77cb9eb
Коммит 66070e1f91
5 изменённых файлов: 24 добавлений и 119 удалений

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

@ -2694,6 +2694,10 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
// anonymous content that the document is changing.
document->BindingManager()->ChangeDocumentFor(this, document, nsnull);
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
document->ForgetLink(this);
}
document->ClearBoxObjectFor(this);
}
@ -4303,6 +4307,20 @@ nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
"Don't call SetAttr with unknown namespace");
nsIDocument* doc = GetCurrentDoc();
if (kNameSpaceID_XLink == aNamespaceID && nsGkAtoms::href == aName) {
// XLink URI(s) might be changing. Drop the link from the map. If it
// is still style relevant it will be re-added by
// nsStyleUtil::IsLink. Make sure to keep the style system
// consistent so this remains true! In particular if the style system
// were to get smarter and not restyling an XLink element if the href
// doesn't change in a "significant" way, we'd need to do the same
// significance check here.
if (doc) {
doc->ForgetLink(this);
}
}
nsAutoString oldValue;
PRBool modification = PR_FALSE;
PRBool hasListeners = aNotify &&
@ -4617,6 +4635,12 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIDOMMutationEvent::REMOVAL);
}
if (document && kNameSpaceID_XLink == aNameSpaceID &&
nsGkAtoms::href == aName) {
// XLink URI might be changing.
document->ForgetLink(this);
}
// When notifying, make sure to keep track of states whose value
// depends solely on the value of an attribute.
PRUint32 stateMask;

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

@ -103,57 +103,6 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
return rv;
}
void
nsMathMLElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
{
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
}
nsMathMLElementBase::UnbindFromTree(aDeep, aNullParent);
}
nsresult
nsMathMLElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify)
{
if (kNameSpaceID_XLink == aNamespaceID && nsGkAtoms::href == aName) {
// XLink URI(s) might be changing. Drop the link from the map. If it
// is still style relevant it will be re-added by
// nsStyleUtil::IsLink. Make sure to keep the style system
// consistent so this remains true! In particular if the style system
// were to get smarter and not restyling an XLink element if the href
// doesn't change in a "significant" way, we'd need to do the same
// significance check here.
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
}
return nsMathMLElementBase::SetAttr(aNamespaceID, aName, aPrefix, aValue,
aNotify);
}
nsresult
nsMathMLElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
PRBool aNotify)
{
if (kNameSpaceID_XLink == aNamespaceID && nsGkAtoms::href == aName) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
// XLink URI might be changing.
doc->ForgetLink(this);
}
}
return nsMathMLElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
}
PRBool
nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,

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

@ -70,16 +70,6 @@ public:
nsIContent* aBindingParent,
PRBool aCompileEventHandlers);
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual nsresult SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
PRBool aNotify);
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,

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

@ -122,57 +122,6 @@ nsSVGAElement::GetTarget(nsIDOMSVGAnimatedString * *aTarget)
//----------------------------------------------------------------------
// nsIContent methods
void
nsSVGAElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
{
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
nsIDocument *doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
}
nsSVGAElementBase::UnbindFromTree(aDeep, aNullParent);
}
nsresult
nsSVGAElement::SetAttr(PRInt32 aNamespaceID, nsIAtom *aName,
nsIAtom *aPrefix, const nsAString& aValue,
PRBool aNotify)
{
if (kNameSpaceID_XLink == aNamespaceID && nsGkAtoms::href == aName) {
// XLink URI(s) might be changing. Drop the link from the map. If it
// is still style relevant it will be re-added by
// nsStyleUtil::IsLink. Make sure to keep the style system
// consistent so this remains true! In particular if the style system
// were to get smarter and not restyling an XLink element if the href
// doesn't change in a "significant" way, we'd need to do the same
// significance check here.
nsIDocument *doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
}
return nsSVGAElementBase::SetAttr(aNamespaceID, aName, aPrefix, aValue,
aNotify);
}
nsresult
nsSVGAElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom *aName,
PRBool aNotify)
{
if (kNameSpaceID_XLink == aNamespaceID && nsGkAtoms::href == aName) {
nsIDocument *doc = GetCurrentDoc();
if (doc) {
// XLink URI might be changing.
doc->ForgetLink(this);
}
}
return nsSVGAElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
}
nsLinkState
nsSVGAElement::GetLinkState() const
{

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

@ -75,13 +75,6 @@ public:
NS_IMETHOD LinkRemoved() { return NS_OK; }
// nsIContent
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual nsresult SetAttr(PRInt32 aNamespaceID, nsIAtom *aName,
nsIAtom *aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom *aName,
PRBool aNotify);
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual PRBool IsLink(nsIURI** aURI) const;
virtual void GetLinkTarget(nsAString& aTarget);