diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/WebCore/html/HTMLStyleElement.h | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/WebCore/html/HTMLStyleElement.h')
-rw-r--r-- | Source/WebCore/html/HTMLStyleElement.h | 77 |
1 files changed, 17 insertions, 60 deletions
diff --git a/Source/WebCore/html/HTMLStyleElement.h b/Source/WebCore/html/HTMLStyleElement.h index 3f2540123..2868dbd2e 100644 --- a/Source/WebCore/html/HTMLStyleElement.h +++ b/Source/WebCore/html/HTMLStyleElement.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2010 Apple Inc. ALl rights reserved. + * Copyright (C) 2003, 2010, 2013 Apple Inc. ALl rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -24,7 +24,7 @@ #define HTMLStyleElement_h #include "HTMLElement.h" -#include "StyleElement.h" +#include "InlineStyleSheetOwner.h" namespace WebCore { @@ -34,26 +34,12 @@ class StyleSheet; template<typename T> class EventSender; typedef EventSender<HTMLStyleElement> StyleEventSender; -class HTMLStyleElement FINAL : public HTMLElement, private StyleElement { +class HTMLStyleElement final : public HTMLElement { public: - static PassRefPtr<HTMLStyleElement> create(const QualifiedName&, Document*, bool createdByParser); + static Ref<HTMLStyleElement> create(const QualifiedName&, Document&, bool createdByParser); virtual ~HTMLStyleElement(); - void setType(const AtomicString&); - - bool scoped() const; - void setScoped(bool); - Element* scopingElement() const; - bool isRegisteredAsScoped() const - { - // Note: We cannot rely on the 'scoped' attribute still being present when this method is invoked. - // Therefore we cannot rely on scoped()! - if (m_scopedStyleRegistrationState == NotRegistered) - return false; - return true; - } - - using StyleElement::sheet; + CSSStyleSheet* sheet() const { return m_styleSheetOwner.sheet(); } bool disabled() const; void setDisabled(bool); @@ -62,57 +48,28 @@ public: static void dispatchPendingLoadEvents(); private: - HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser); + HTMLStyleElement(const QualifiedName&, Document&, bool createdByParser); // overload from HTMLElement - virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; - virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; - virtual void removedFrom(ContainerNode*) OVERRIDE; - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - - virtual void finishParsingChildren(); + virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; + virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; + virtual void removedFrom(ContainerNode&) override; + virtual void childrenChanged(const ChildChange&) override; - virtual bool isLoading() const { return StyleElement::isLoading(); } - virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); } - virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred); - virtual void startLoadingDynamicSheet() { StyleElement::startLoadingDynamicSheet(document()); } + virtual void finishParsingChildren() override; - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; + bool isLoading() const { return m_styleSheetOwner.isLoading(); } + virtual bool sheetLoaded() override { return m_styleSheetOwner.sheetLoaded(*this); } + virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred) override; + virtual void startLoadingDynamicSheet() override { m_styleSheetOwner.startLoadingDynamicSheet(*this); } - virtual const AtomicString& media() const; - virtual const AtomicString& type() const; - - void scopedAttributeChanged(bool); - void registerWithScopingNode(bool); - void unregisterWithScopingNode(ContainerNode*); + virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; + InlineStyleSheetOwner m_styleSheetOwner; bool m_firedLoad; bool m_loadedSheet; - - enum ScopedStyleRegistrationState { - NotRegistered, - RegisteredAsScoped, - RegisteredInShadowRoot - }; - ScopedStyleRegistrationState m_scopedStyleRegistrationState; }; -inline bool isHTMLStyleElement(Node* node) -{ - return node->hasTagName(HTMLNames::styleTag); -} - -inline bool isHTMLStyleElement(Element* element) -{ - return element->hasTagName(HTMLNames::styleTag); -} - -inline HTMLStyleElement* toHTMLStyleElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLStyleElement(node)); - return static_cast<HTMLStyleElement*>(node); -} - } //namespace #endif |