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-17 14:04:32 -08:00
Родитель e39a5e6342
Коммит 7425d27218
1 изменённых файлов: 14 добавлений и 5 удалений

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

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