Merge for backout of changeset 93eff7903e34

This commit is contained in:
Shawn Wilsher 2010-02-18 10:10:31 -08:00
Родитель c111092e24 11751a82ea
Коммит fae62ee939
2 изменённых файлов: 0 добавлений и 38 удалений

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

@ -75,47 +75,17 @@ Link::LinkState() const
return 0;
}
already_AddRefed<nsIURI>
Link::GetURI() const
{
nsCOMPtr<nsIURI> uri(mCachedURI);
// If we have this URI cached, use it.
if (uri) {
return uri.forget();
}
// Otherwise obtain it.
Link *self = const_cast<Link *>(this);
nsCOMPtr<nsIContent> content(do_QueryInterface(self));
NS_ASSERTION(content, "Why isn't this an nsIContent node?!");
uri = content->GetHrefURI();
// We want to cache the URI if the node is in the document.
if (uri && content->IsInDoc()) {
mCachedURI = uri;
}
return uri.forget();
}
void
Link::ResetLinkState()
{
nsCOMPtr<nsIContent> content(do_QueryInterface(this));
NS_ASSERTION(content, "Why isn't this an nsIContent node?!");
// Tell the document to forget about this link.
nsIDocument *doc = content->GetCurrentDoc();
if (doc) {
doc->ForgetLink(content);
}
// Update our state back to the default.
mLinkState = defaultState;
// Get rid of our cached URI.
mCachedURI = nsnull;
}
} // namespace dom

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

@ -64,11 +64,6 @@ public:
*/
PRInt32 LinkState() const;
/**
* @return the URI this link is for, if available.
*/
already_AddRefed<nsIURI> GetURI() const;
protected:
/**
* Invalidates any link caching, and resets the state to the default.
@ -76,9 +71,6 @@ protected:
virtual void ResetLinkState();
nsLinkState mLinkState;
private:
mutable nsCOMPtr<nsIURI> mCachedURI;
};
} // namespace dom