2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2010 Apple Inc. ALl rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef HTMLStyleElement_h
24 #define HTMLStyleElement_h
26 #include "core/dom/StyleElement.h"
27 #include "core/html/HTMLElement.h"
31 class HTMLStyleElement;
34 template<typename T> class EventSender;
35 typedef EventSender<HTMLStyleElement> StyleEventSender;
37 class HTMLStyleElement FINAL : public HTMLElement, private StyleElement {
38 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLStyleElement);
40 static PassRefPtrWillBeRawPtr<HTMLStyleElement> create(Document&, bool createdByParser);
41 virtual ~HTMLStyleElement();
43 void setType(const AtomicString&);
47 ContainerNode* scopingNode();
48 bool isRegisteredAsScoped() const
50 // Note: We cannot rely on the 'scoped' attribute still being present when this method is invoked.
51 // Therefore we cannot rely on scoped()!
52 if (m_scopedStyleRegistrationState == NotRegistered)
57 bool isRegisteredInShadowRoot() const
59 return m_scopedStyleRegistrationState == RegisteredInShadowRoot;
62 using StyleElement::sheet;
64 bool disabled() const;
65 void setDisabled(bool);
67 void dispatchPendingEvent(StyleEventSender*);
68 static void dispatchPendingLoadEvents();
70 virtual void trace(Visitor*) OVERRIDE;
73 HTMLStyleElement(Document&, bool createdByParser);
75 // overload from HTMLElement
76 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
77 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
78 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE;
79 virtual void removedFrom(ContainerNode*) OVERRIDE;
80 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
82 virtual void finishParsingChildren() OVERRIDE;
84 virtual bool sheetLoaded() OVERRIDE { return StyleElement::sheetLoaded(document()); }
85 virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred) OVERRIDE;
86 virtual void startLoadingDynamicSheet() OVERRIDE { StyleElement::startLoadingDynamicSheet(document()); }
88 virtual const AtomicString& media() const OVERRIDE;
89 virtual const AtomicString& type() const OVERRIDE;
91 void scopedAttributeChanged(bool);
92 void registerWithScopingNode(bool);
93 void unregisterWithScopingNode(ContainerNode*);
98 enum ScopedStyleRegistrationState {
101 RegisteredInShadowRoot
103 ScopedStyleRegistrationState m_scopedStyleRegistrationState;