Merge for backout of changeset 42bf809ee413

This commit is contained in:
Shawn Wilsher 2010-02-18 09:48:13 -08:00
commit c53b330598
8 changed files with 28 additions and 49 deletions

View File

@ -49,15 +49,9 @@
namespace mozilla {
namespace dom {
#define MOZILLA_DOM_LINK_IMPLEMENTATION_IID \
{ 0x0c032581, 0x1c8a, 0x4fff, \
{ 0xbe, 0x9a, 0xfb, 0x6e, 0x2e, 0xe4, 0x22, 0x2e } }
class Link : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
static const nsLinkState defaultState = eLinkState_Unknown;
Link();
virtual nsLinkState GetLinkState() const;
@ -129,8 +123,6 @@ private:
nsIContent *mContent;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Link, MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
} // namespace dom
} // namespace mozilla

View File

@ -198,6 +198,9 @@ public:
nsresult PostHandleEventForAnchors(nsEventChainPostVisitor& aVisitor);
PRBool IsHTMLLink(nsIURI** aURI) const;
// Used by A, AREA, LINK, and STYLE.
already_AddRefed<nsIURI> GetHrefURIForAnchors() const;
// As above, but makes sure to return a URI object that we can mutate with
// impunity without changing our current URI. That is, if the URI is cached
// it clones it and returns the clone.
@ -720,9 +723,6 @@ protected:
return value > 0 ? eTrue : (value == 0 ? eFalse : eInherit);
}
// Used by A, AREA, LINK, and STYLE.
already_AddRefed<nsIURI> GetHrefURIForAnchors() const;
private:
/**
* Returns whether this element is an editable root. There are two types of

View File

@ -152,12 +152,11 @@ NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, nsGenericElement)
// QueryInterface implementation for nsHTMLAnchorElement
NS_INTERFACE_TABLE_HEAD(nsHTMLAnchorElement)
NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLAnchorElement,
NS_HTML_CONTENT_INTERFACE_TABLE4(nsHTMLAnchorElement,
nsIDOMHTMLAnchorElement,
nsIDOMNSHTMLAnchorElement,
nsIDOMNSHTMLAnchorElement2,
nsILink,
Link)
nsILink)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAnchorElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAnchorElement)

View File

@ -137,12 +137,11 @@ NS_IMPL_RELEASE_INHERITED(nsHTMLAreaElement, nsGenericElement)
// QueryInterface implementation for nsHTMLAreaElement
NS_INTERFACE_TABLE_HEAD(nsHTMLAreaElement)
NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLAreaElement,
NS_HTML_CONTENT_INTERFACE_TABLE4(nsHTMLAreaElement,
nsIDOMHTMLAreaElement,
nsIDOMNSHTMLAreaElement,
nsIDOMNSHTMLAreaElement2,
nsILink,
Link)
nsILink)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAreaElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAreaElement)

View File

@ -53,11 +53,9 @@
#include "nsGkAtoms.h"
#include "nsIDocument.h"
#include "nsThreadUtils.h"
#include "nsGenericHTMLElement.h"
#include "nsITimer.h"
#include "nsIObserverService.h"
#include "mozilla/dom/Link.h"
using namespace mozilla::dom;
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
PRBool sDisablePrefetchHTTPSPref;
@ -127,7 +125,7 @@ nsHTMLDNSPrefetch::IsAllowed (nsIDocument *aDocument)
}
nsresult
nsHTMLDNSPrefetch::Prefetch(Link *aElement, PRUint16 flags)
nsHTMLDNSPrefetch::Prefetch(nsGenericHTMLElement *aElement, PRUint16 flags)
{
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
@ -136,19 +134,19 @@ nsHTMLDNSPrefetch::Prefetch(Link *aElement, PRUint16 flags)
}
nsresult
nsHTMLDNSPrefetch::PrefetchLow(Link *aElement)
nsHTMLDNSPrefetch::PrefetchLow(nsGenericHTMLElement *aElement)
{
return Prefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_LOW);
}
nsresult
nsHTMLDNSPrefetch::PrefetchMedium(Link *aElement)
nsHTMLDNSPrefetch::PrefetchMedium(nsGenericHTMLElement *aElement)
{
return Prefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
}
nsresult
nsHTMLDNSPrefetch::PrefetchHigh(Link *aElement)
nsHTMLDNSPrefetch::PrefetchHigh(nsGenericHTMLElement *aElement)
{
return Prefetch(aElement, 0);
}
@ -231,7 +229,7 @@ nsHTMLDNSPrefetch::nsDeferrals::Flush()
}
nsresult
nsHTMLDNSPrefetch::nsDeferrals::Add(PRUint16 flags, Link *aElement)
nsHTMLDNSPrefetch::nsDeferrals::Add(PRUint16 flags, nsGenericHTMLElement *aElement)
{
// The FIFO has no lock, so it can only be accessed on main thread
NS_ASSERTION(NS_IsMainThread(), "nsDeferrals::Add must be on main thread");
@ -261,8 +259,9 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue()
while (mHead != mTail) {
nsCOMPtr<nsIContent> content = do_QueryReferent(mEntries[mTail].mElement);
if (content && content->GetOwnerDoc()) {
nsCOMPtr<Link> link = do_QueryInterface(content);
nsCOMPtr<nsIURI> hrefURI(link ? link->GetURI() : nsnull);
nsCOMPtr<nsIURI> hrefURI;
hrefURI =
nsGenericHTMLElement::FromContent(content)->GetHrefURIForAnchors();
if (hrefURI)
hrefURI->GetAsciiHost(hostName);

View File

@ -49,12 +49,8 @@
#include "nsIObserver.h"
class nsIDocument;
class nsGenericHTMLElement;
class nsITimer;
namespace mozilla {
namespace dom {
class Link;
} // namespace dom
} // namespace mozilla
class nsHTMLDNSPrefetch
{
@ -75,16 +71,16 @@ public:
// weight, but its request is also more likely to be dropped due to a
// full queue and it may only be used from the main thread.
static nsresult PrefetchHigh(mozilla::dom::Link *aElement);
static nsresult PrefetchMedium(mozilla::dom::Link *aElement);
static nsresult PrefetchLow(mozilla::dom::Link *aElement);
static nsresult PrefetchHigh(nsGenericHTMLElement *aElement);
static nsresult PrefetchMedium(nsGenericHTMLElement *aElement);
static nsresult PrefetchLow(nsGenericHTMLElement *aElement);
static nsresult PrefetchHigh(nsAString &host);
static nsresult PrefetchMedium(nsAString &host);
static nsresult PrefetchLow(nsAString &host);
private:
static nsresult Prefetch(nsAString &host, PRUint16 flags);
static nsresult Prefetch(mozilla::dom::Link *aElement, PRUint16 flags);
static nsresult Prefetch(nsGenericHTMLElement *aElement, PRUint16 flags);
public:
class nsListener : public nsIDNSListener
@ -111,7 +107,7 @@ public:
nsDeferrals();
void Activate();
nsresult Add(PRUint16 flags, mozilla::dom::Link *aElement);
nsresult Add(PRUint16 flags, nsGenericHTMLElement *aElement);
private:
~nsDeferrals();

View File

@ -148,12 +148,11 @@ NS_IMPL_RELEASE_INHERITED(nsHTMLLinkElement, nsGenericElement)
// QueryInterface implementation for nsHTMLLinkElement
NS_INTERFACE_TABLE_HEAD(nsHTMLLinkElement)
NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLLinkElement,
NS_HTML_CONTENT_INTERFACE_TABLE4(nsHTMLLinkElement,
nsIDOMHTMLLinkElement,
nsIDOMLinkStyle,
nsILink,
nsIStyleSheetLinkingElement,
Link)
nsIStyleSheetLinkingElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLinkElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLinkElement)
@ -376,7 +375,7 @@ already_AddRefed<nsIURI>
nsHTMLLinkElement::GetStyleSheetURL(PRBool* aIsInline)
{
*aIsInline = PR_FALSE;
return Link::GetURI();
return GetHrefURIForAnchors();
}
void

View File

@ -61,13 +61,8 @@ NS_IMPL_ADDREF_INHERITED(nsSVGAElement, nsSVGAElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGAElement, nsSVGAElementBase)
NS_INTERFACE_TABLE_HEAD(nsSVGAElement)
NS_NODE_INTERFACE_TABLE6(nsSVGAElement,
nsIDOMNode,
nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGAElement,
nsILink,
Link)
NS_NODE_INTERFACE_TABLE5(nsSVGAElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGAElement, nsILink)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGAElementBase)