Bug 1687587 - Cleanup a bit Link.h. r=smaug

Depends on D102365

Differential Revision: https://phabricator.services.mozilla.com/D102366
This commit is contained in:
Emilio Cobos Álvarez 2021-01-20 09:24:10 +00:00
parent 929ed76787
commit e1271b87c9
4 changed files with 28 additions and 28 deletions

View File

@ -11,8 +11,10 @@
#ifndef mozilla_dom_Link_h__
#define mozilla_dom_Link_h__
#include "mozilla/MemoryReporting.h"
#include "nsIContent.h" // for nsLinkState
#include "nsWrapperCache.h" // For nsWrapperCache::FlagsType
#include "nsCOMPtr.h"
class nsIURI;
namespace mozilla {
@ -21,6 +23,7 @@ class SizeOfState;
namespace dom {
class Document;
class Element;
#define MOZILLA_DOM_LINK_IMPLEMENTATION_IID \
@ -57,7 +60,6 @@ class Link : public nsISupports {
* @return the URI this link is for, if available.
*/
nsIURI* GetURI() const;
virtual nsIURI* GetURIExternal() const { return GetURI(); }
/**
* Helper methods for modifying and obtaining parts of the URI of the Link.
@ -182,27 +184,6 @@ class Link : public nsISupports {
NS_DEFINE_STATIC_IID_ACCESSOR(Link, MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
enum ASDestination : uint8_t {
DESTINATION_INVALID,
DESTINATION_AUDIO,
DESTINATION_DOCUMENT,
DESTINATION_EMBED,
DESTINATION_FONT,
DESTINATION_IMAGE,
DESTINATION_MANIFEST,
DESTINATION_OBJECT,
DESTINATION_REPORT,
DESTINATION_SCRIPT,
DESTINATION_SERVICEWORKER,
DESTINATION_SHAREDWORKER,
DESTINATION_STYLE,
DESTINATION_TRACK,
DESTINATION_VIDEO,
DESTINATION_WORKER,
DESTINATION_XSLT,
DESTINATION_FETCH
};
} // namespace dom
} // namespace mozilla

View File

@ -359,10 +359,7 @@ class InternalRequest final : public AtomicSafeRefCounted<InternalRequest> {
// by the spec at https://fetch.spec.whatwg.org/#concept-request-destination.
// Note that while the HTML spec for the "Link" element and its "as" attribute
// (https://html.spec.whatwg.org/#attr-link-as) reuse fetch's definition of
// destination, and the Link class has an internal Link::AsDestination enum
// type, the latter is only a support type to map the string values via
// Link::ParseAsValue and Link::AsValueToContentPolicy to our canonical
// nsContentPolicyType.
// destination.
static RequestDestination MapContentPolicyTypeToRequestDestination(
nsContentPolicyType aContentPolicyType);

View File

@ -493,6 +493,27 @@ void HTMLLinkElement::GetAs(nsAString& aResult) {
GetEnumAttr(nsGkAtoms::as, "", aResult);
}
enum ASDestination : uint8_t {
DESTINATION_INVALID,
DESTINATION_AUDIO,
DESTINATION_DOCUMENT,
DESTINATION_EMBED,
DESTINATION_FONT,
DESTINATION_IMAGE,
DESTINATION_MANIFEST,
DESTINATION_OBJECT,
DESTINATION_REPORT,
DESTINATION_SCRIPT,
DESTINATION_SERVICEWORKER,
DESTINATION_SHAREDWORKER,
DESTINATION_STYLE,
DESTINATION_TRACK,
DESTINATION_VIDEO,
DESTINATION_WORKER,
DESTINATION_XSLT,
DESTINATION_FETCH
};
static const nsAttrValue::EnumTable kAsAttributeTable[] = {
{"", DESTINATION_INVALID}, {"audio", DESTINATION_AUDIO},
{"font", DESTINATION_FONT}, {"image", DESTINATION_IMAGE},

View File

@ -13,6 +13,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Link.h"
#include "nsIContent.h"
#include "mozilla/StaticPrefs_layout.h"
class mock_Link : public mozilla::dom::Link {