зеркало из https://github.com/mozilla/gecko-dev.git
Merge for backout of changeset 93eff7903e34
This commit is contained in:
Коммит
fae62ee939
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче