Bug 461199 (Part 28) - Tell the document that we are a style relevant link

Adds the needed calls to inform the document if we are a style relevant link,
and when we no longer are.
r=bz
This commit is contained in:
Shawn Wilsher 2010-02-24 08:37:03 -08:00
parent 843b58d6fe
commit 94b3600d96

View File

@ -120,7 +120,8 @@ Link::LinkState() const
Link *self = const_cast<Link *>(this);
// If we are not in the document, default to not visited.
if (!self->Content()->IsInDoc()) {
nsIContent *content = self->Content();
if (!content->IsInDoc()) {
self->mLinkState = eLinkState_Unvisited;
}
@ -142,6 +143,12 @@ Link::LinkState() const
// Assume that we are not visited until we are told otherwise.
self->mLinkState = eLinkState_Unvisited;
// And make sure we are in the document's link map.
nsIDocument *doc = content->GetCurrentDoc();
if (doc) {
doc->AddStyleRelevantLink(content, hrefURI);
}
}
}
@ -467,10 +474,12 @@ Link::ResetLinkState()
{
nsIContent *content = Content();
// Tell the document to forget about this link.
nsIDocument *doc = content->GetCurrentDoc();
if (doc) {
doc->ForgetLink(content);
// Tell the document to forget about this link, but only if we are registered.
if (mRegistered) {
nsIDocument *doc = content->GetCurrentDoc();
if (doc) {
doc->ForgetLink(content);
}
}
UnregisterFromHistory();