diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/HTMLLinkElement.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/HTMLLinkElement.h')
-rw-r--r-- | Source/WebCore/html/HTMLLinkElement.h | 85 |
1 files changed, 42 insertions, 43 deletions
diff --git a/Source/WebCore/html/HTMLLinkElement.h b/Source/WebCore/html/HTMLLinkElement.h index 65b324176..41c9a5b51 100644 --- a/Source/WebCore/html/HTMLLinkElement.h +++ b/Source/WebCore/html/HTMLLinkElement.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2003-2017 Apple Inc. All rights reserved. * Copyright (C) 2011 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or @@ -21,21 +21,20 @@ * */ -#ifndef HTMLLinkElement_h -#define HTMLLinkElement_h +#pragma once #include "CSSStyleSheet.h" #include "CachedStyleSheetClient.h" #include "CachedResourceHandle.h" -#include "DOMSettableTokenList.h" +#include "DOMTokenList.h" #include "HTMLElement.h" -#include "IconURL.h" #include "LinkLoader.h" #include "LinkLoaderClient.h" #include "LinkRelAttribute.h" namespace WebCore { +class DOMTokenList; class HTMLLinkElement; class URL; @@ -44,20 +43,17 @@ typedef EventSender<HTMLLinkElement> LinkEventSender; class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient, public LinkLoaderClient { public: - static PassRefPtr<HTMLLinkElement> create(const QualifiedName&, Document&, bool createdByParser); + static Ref<HTMLLinkElement> create(const QualifiedName&, Document&, bool createdByParser); virtual ~HTMLLinkElement(); URL href() const; - String rel() const; + const AtomicString& rel() const; - virtual String target() const override; + String target() const final; - String type() const; + const AtomicString& type() const; - IconType iconType() const; - - // the icon size string as parsed from the HTML attribute - String iconSizes() const; + std::optional<LinkIconType> iconType() const; CSSStyleSheet* sheet() const { return m_sheet.get(); } @@ -65,56 +61,61 @@ public: bool isDisabled() const { return m_disabledState == Disabled; } bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; } - void setSizes(const String&); - DOMSettableTokenList* sizes() const; + DOMTokenList& sizes(); + + WEBCORE_EXPORT void setCrossOrigin(const AtomicString&); + WEBCORE_EXPORT String crossOrigin() const; void dispatchPendingEvent(LinkEventSender*); static void dispatchPendingLoadEvents(); + WEBCORE_EXPORT DOMTokenList& relList(); + private: - virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; + void parseAttribute(const QualifiedName&, const AtomicString&) final; - virtual bool shouldLoadLink() override; + bool shouldLoadLink() final; void process(); static void processCallback(Node*); void clearSheet(); - virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; - virtual void removedFrom(ContainerNode&) override; + InsertionNotificationRequest insertedInto(ContainerNode&) final; + void finishedInsertingSubtree() final; + void removedFrom(ContainerNode&) final; + + void initializeStyleSheet(Ref<StyleSheetContents>&&, const CachedCSSStyleSheet&); // from CachedResourceClient - virtual void setCSSStyleSheet(const String& href, const URL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet) override; - virtual bool sheetLoaded() override; - virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred) override; - virtual void startLoadingDynamicSheet() override; + void setCSSStyleSheet(const String& href, const URL& baseURL, const String& charset, const CachedCSSStyleSheet*) final; + bool sheetLoaded() final; + void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred) final; + void startLoadingDynamicSheet() final; - virtual void linkLoaded() override; - virtual void linkLoadingErrored() override; + void linkLoaded() final; + void linkLoadingErrored() final; - bool isAlternate() const { return m_disabledState == Unset && m_relAttribute.m_isAlternate; } + bool isAlternate() const { return m_disabledState == Unset && m_relAttribute.isAlternate; } void setDisabledState(bool); - virtual bool isURLAttribute(const Attribute&) const override; + bool isURLAttribute(const Attribute&) const final; + + void defaultEventHandler(Event&) final; + void handleClick(Event&); -private: HTMLLinkElement(const QualifiedName&, Document&, bool createdByParser); - virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; + void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; - virtual void finishParsingChildren() override; + void finishParsingChildren() final; enum PendingSheetType { Unknown, ActiveSheet, InactiveSheet }; void addPendingSheet(PendingSheetType); - enum RemovePendingSheetNotificationType { - RemovePendingSheetNotifyImmediately, - RemovePendingSheetNotifyLater - }; - - void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately); + void removePendingSheet(); LinkLoader m_linkLoader; + Style::Scope* m_styleScope { nullptr }; CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet; RefPtr<CSSStyleSheet> m_sheet; enum DisabledState { @@ -125,20 +126,18 @@ private: String m_type; String m_media; - RefPtr<DOMSettableTokenList> m_sizes; + std::unique_ptr<DOMTokenList> m_sizes; DisabledState m_disabledState; LinkRelAttribute m_relAttribute; bool m_loading; bool m_createdByParser; - bool m_isInShadowTree; bool m_firedLoad; - bool m_loadedSheet; + bool m_loadedResource; + bool m_isHandlingBeforeLoad { false }; PendingSheetType m_pendingSheetType; -}; -NODE_TYPE_CASTS(HTMLLinkElement) + std::unique_ptr<DOMTokenList> m_relList; +}; } //namespace - -#endif |