| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2010 Apple Inc. ALl rights reserved. | 4 * Copyright (C) 2003, 2010 Apple Inc. ALl rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 template<typename T> class EventSender; | 34 template<typename T> class EventSender; |
| 35 typedef EventSender<HTMLStyleElement> StyleEventSender; | 35 typedef EventSender<HTMLStyleElement> StyleEventSender; |
| 36 | 36 |
| 37 class HTMLStyleElement FINAL : public HTMLElement, private StyleElement { | 37 class HTMLStyleElement FINAL : public HTMLElement, private StyleElement { |
| 38 public: | 38 public: |
| 39 static PassRefPtr<HTMLStyleElement> create(Document&, bool createdByParser); | 39 static PassRefPtr<HTMLStyleElement> create(Document&, bool createdByParser); |
| 40 virtual ~HTMLStyleElement(); | 40 virtual ~HTMLStyleElement(); |
| 41 | 41 |
| 42 void setType(const AtomicString&); | 42 void setType(const AtomicString&); |
| 43 | 43 |
| 44 bool scoped() const; | |
| 45 void setScoped(bool); | |
| 46 ContainerNode* scopingNode(); | 44 ContainerNode* scopingNode(); |
| 47 bool isRegisteredAsScoped() const | 45 bool isScoped() const { return m_scoped; } |
| 48 { | |
| 49 // Note: We cannot rely on the 'scoped' attribute still being present wh
en this method is invoked. | |
| 50 // Therefore we cannot rely on scoped()! | |
| 51 if (m_scopedStyleRegistrationState == NotRegistered) | |
| 52 return false; | |
| 53 return true; | |
| 54 } | |
| 55 | |
| 56 bool isRegisteredInShadowRoot() const | |
| 57 { | |
| 58 return m_scopedStyleRegistrationState == RegisteredInShadowRoot; | |
| 59 } | |
| 60 | 46 |
| 61 using StyleElement::sheet; | 47 using StyleElement::sheet; |
| 62 | 48 |
| 63 bool disabled() const; | 49 bool disabled() const; |
| 64 void setDisabled(bool); | 50 void setDisabled(bool); |
| 65 | 51 |
| 66 void dispatchPendingEvent(StyleEventSender*); | 52 void dispatchPendingEvent(StyleEventSender*); |
| 67 static void dispatchPendingLoadEvents(); | 53 static void dispatchPendingLoadEvents(); |
| 68 | 54 |
| 69 private: | 55 private: |
| 70 HTMLStyleElement(Document&, bool createdByParser); | 56 HTMLStyleElement(Document&, bool createdByParser); |
| 71 | 57 |
| 72 // overload from HTMLElement | 58 // overload from HTMLElement |
| 73 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 59 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
| 74 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 60 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
| 75 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE; | 61 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE; |
| 76 virtual void removedFrom(ContainerNode*) OVERRIDE; | 62 virtual void removedFrom(ContainerNode*) OVERRIDE; |
| 77 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; | 63 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; |
| 78 | 64 |
| 79 virtual void finishParsingChildren() OVERRIDE; | 65 virtual void finishParsingChildren() OVERRIDE; |
| 80 | 66 |
| 81 virtual bool sheetLoaded() OVERRIDE { return StyleElement::sheetLoaded(docum
ent()); } | 67 virtual bool sheetLoaded() OVERRIDE { return StyleElement::sheetLoaded(docum
ent()); } |
| 82 virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred)
OVERRIDE; | 68 virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred)
OVERRIDE; |
| 83 virtual void startLoadingDynamicSheet() OVERRIDE { StyleElement::startLoadin
gDynamicSheet(document()); } | 69 virtual void startLoadingDynamicSheet() OVERRIDE { StyleElement::startLoadin
gDynamicSheet(document()); } |
| 84 | 70 |
| 85 virtual const AtomicString& media() const OVERRIDE; | 71 virtual const AtomicString& media() const OVERRIDE; |
| 86 virtual const AtomicString& type() const OVERRIDE; | 72 virtual const AtomicString& type() const OVERRIDE; |
| 87 | 73 |
| 88 void scopedAttributeChanged(bool); | |
| 89 void registerWithScopingNode(bool); | |
| 90 void unregisterWithScopingNode(ContainerNode*); | |
| 91 | |
| 92 bool m_firedLoad; | 74 bool m_firedLoad; |
| 93 bool m_loadedSheet; | 75 bool m_loadedSheet; |
| 94 | 76 bool m_scoped; |
| 95 enum ScopedStyleRegistrationState { | |
| 96 NotRegistered, | |
| 97 RegisteredAsScoped, | |
| 98 RegisteredInShadowRoot | |
| 99 }; | |
| 100 ScopedStyleRegistrationState m_scopedStyleRegistrationState; | |
| 101 }; | 77 }; |
| 102 | 78 |
| 103 } //namespace | 79 } //namespace |
| 104 | 80 |
| 105 #endif | 81 #endif |
| OLD | NEW |