Bug 542592 - Change how we use/store nsDocument::mLinkMap
This makes changes nsDocument::mLinkMap in a number of ways: 1) renamed to mStyledLinks to better reflect its new nature. 2) change it to an nsTHashtable of Link*. It no longer has a strong reference 3) add some assertions to make sure we call ForgetLink and AddStyleRelevantLink in pairs. This also makes mozilla::dom::Link::ResetLinkState take a boolean indicating if we should notify or not. r=bz
This commit is contained in:
@@ -2646,10 +2646,6 @@ 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);
|
||||
}
|
||||
|
||||
@@ -4299,20 +4295,6 @@ 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 &&
|
||||
@@ -4629,12 +4611,6 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user