OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 25 matching lines...) Expand all Loading... |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class Document; | 38 class Document; |
39 class ElementShadow; | 39 class ElementShadow; |
40 class ExceptionState; | 40 class ExceptionState; |
41 class HTMLShadowElement; | 41 class HTMLShadowElement; |
42 class InsertionPoint; | 42 class InsertionPoint; |
43 class ShadowRootRareData; | 43 class ShadowRootRareData; |
44 class StyleSheetList; | 44 class StyleSheetList; |
45 | 45 |
46 class ShadowRoot FINAL : public DocumentFragment, public TreeScope, public Doubl
yLinkedListNode<ShadowRoot> { | 46 class ShadowRoot final : public DocumentFragment, public TreeScope, public Doubl
yLinkedListNode<ShadowRoot> { |
47 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot); | 48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot); |
49 friend class WTF::DoublyLinkedListNode<ShadowRoot>; | 49 friend class WTF::DoublyLinkedListNode<ShadowRoot>; |
50 public: | 50 public: |
51 // FIXME: We will support multiple shadow subtrees, however current implemen
tation does not work well | 51 // FIXME: We will support multiple shadow subtrees, however current implemen
tation does not work well |
52 // if a shadow root is dynamically created. So we prohibit multiple shadow s
ubtrees | 52 // if a shadow root is dynamically created. So we prohibit multiple shadow s
ubtrees |
53 // in several elements for a while. | 53 // in several elements for a while. |
54 // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs. | 54 // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs. |
55 enum ShadowRootType { | 55 enum ShadowRootType { |
56 UserAgentShadowRoot = 0, | 56 UserAgentShadowRoot = 0, |
(...skipping 16 matching lines...) Expand all Loading... |
73 | 73 |
74 ShadowRoot* youngerShadowRoot() const { return prev(); } | 74 ShadowRoot* youngerShadowRoot() const { return prev(); } |
75 | 75 |
76 ShadowRoot* olderShadowRootForBindings() const; | 76 ShadowRoot* olderShadowRootForBindings() const; |
77 bool shouldExposeToBindings() const { return type() == AuthorShadowRoot; } | 77 bool shouldExposeToBindings() const { return type() == AuthorShadowRoot; } |
78 | 78 |
79 bool isYoungest() const { return !youngerShadowRoot(); } | 79 bool isYoungest() const { return !youngerShadowRoot(); } |
80 bool isOldest() const { return !olderShadowRoot(); } | 80 bool isOldest() const { return !olderShadowRoot(); } |
81 bool isOldestAuthorShadowRoot() const; | 81 bool isOldestAuthorShadowRoot() const; |
82 | 82 |
83 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 83 virtual void attach(const AttachContext& = AttachContext()) override; |
84 | 84 |
85 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 85 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; |
86 virtual void removedFrom(ContainerNode*) OVERRIDE; | 86 virtual void removedFrom(ContainerNode*) override; |
87 | 87 |
88 void registerScopedHTMLStyleChild(); | 88 void registerScopedHTMLStyleChild(); |
89 void unregisterScopedHTMLStyleChild(); | 89 void unregisterScopedHTMLStyleChild(); |
90 | 90 |
91 bool containsShadowElements() const; | 91 bool containsShadowElements() const; |
92 bool containsContentElements() const; | 92 bool containsContentElements() const; |
93 bool containsInsertionPoints() const { return containsShadowElements() || co
ntainsContentElements(); } | 93 bool containsInsertionPoints() const { return containsShadowElements() || co
ntainsContentElements(); } |
94 bool containsShadowRoots() const; | 94 bool containsShadowRoots() const; |
95 | 95 |
96 unsigned descendantShadowElementCount() const; | 96 unsigned descendantShadowElementCount() const; |
(...skipping 21 matching lines...) Expand all Loading... |
118 ShadowRoot* olderShadowRoot() const { return next(); } | 118 ShadowRoot* olderShadowRoot() const { return next(); } |
119 | 119 |
120 String innerHTML() const; | 120 String innerHTML() const; |
121 void setInnerHTML(const String&, ExceptionState&); | 121 void setInnerHTML(const String&, ExceptionState&); |
122 | 122 |
123 PassRefPtrWillBeRawPtr<Node> cloneNode(bool, ExceptionState&); | 123 PassRefPtrWillBeRawPtr<Node> cloneNode(bool, ExceptionState&); |
124 PassRefPtrWillBeRawPtr<Node> cloneNode(ExceptionState& exceptionState) { ret
urn cloneNode(true, exceptionState); } | 124 PassRefPtrWillBeRawPtr<Node> cloneNode(ExceptionState& exceptionState) { ret
urn cloneNode(true, exceptionState); } |
125 | 125 |
126 StyleSheetList* styleSheets(); | 126 StyleSheetList* styleSheets(); |
127 | 127 |
128 virtual void trace(Visitor*) OVERRIDE; | 128 virtual void trace(Visitor*) override; |
129 | 129 |
130 private: | 130 private: |
131 ShadowRoot(Document&, ShadowRootType); | 131 ShadowRoot(Document&, ShadowRootType); |
132 virtual ~ShadowRoot(); | 132 virtual ~ShadowRoot(); |
133 | 133 |
134 #if !ENABLE(OILPAN) | 134 #if !ENABLE(OILPAN) |
135 virtual void dispose() OVERRIDE; | 135 virtual void dispose() override; |
136 #endif | 136 #endif |
137 | 137 |
138 virtual void childrenChanged(const ChildrenChange&) OVERRIDE; | 138 virtual void childrenChanged(const ChildrenChange&) override; |
139 | 139 |
140 ShadowRootRareData* ensureShadowRootRareData(); | 140 ShadowRootRareData* ensureShadowRootRareData(); |
141 | 141 |
142 void addChildShadowRoot(); | 142 void addChildShadowRoot(); |
143 void removeChildShadowRoot(); | 143 void removeChildShadowRoot(); |
144 void invalidateDescendantInsertionPoints(); | 144 void invalidateDescendantInsertionPoints(); |
145 | 145 |
146 // ShadowRoots should never be cloned. | 146 // ShadowRoots should never be cloned. |
147 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool) OVERRIDE { return nullp
tr; } | 147 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool) override { return nullp
tr; } |
148 | 148 |
149 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 | 149 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 |
150 bool isOrphan() const { return !host(); } | 150 bool isOrphan() const { return !host(); } |
151 | 151 |
152 RawPtrWillBeMember<ShadowRoot> m_prev; | 152 RawPtrWillBeMember<ShadowRoot> m_prev; |
153 RawPtrWillBeMember<ShadowRoot> m_next; | 153 RawPtrWillBeMember<ShadowRoot> m_next; |
154 OwnPtrWillBeMember<ShadowRootRareData> m_shadowRootRareData; | 154 OwnPtrWillBeMember<ShadowRootRareData> m_shadowRootRareData; |
155 unsigned m_numberOfStyles : 27; | 155 unsigned m_numberOfStyles : 27; |
156 unsigned m_type : 1; | 156 unsigned m_type : 1; |
157 unsigned m_registeredWithParentShadowRoot : 1; | 157 unsigned m_registeredWithParentShadowRoot : 1; |
158 unsigned m_descendantInsertionPointsIsValid : 1; | 158 unsigned m_descendantInsertionPointsIsValid : 1; |
159 }; | 159 }; |
160 | 160 |
161 inline Element* ShadowRoot::activeElement() const | 161 inline Element* ShadowRoot::activeElement() const |
162 { | 162 { |
163 return adjustedFocusedElement(); | 163 return adjustedFocusedElement(); |
164 } | 164 } |
165 | 165 |
166 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); | 166 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); |
167 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); | 167 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); |
168 | 168 |
169 } // namespace blink | 169 } // namespace blink |
170 | 170 |
171 #endif // ShadowRoot_h | 171 #endif // ShadowRoot_h |
OLD | NEW |