| 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 #include "wtf/DoublyLinkedList.h" | 36 #include "wtf/DoublyLinkedList.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class Document; | 40 class Document; |
| 41 class ElementShadow; | 41 class ElementShadow; |
| 42 class ExceptionState; | 42 class ExceptionState; |
| 43 class HTMLShadowElement; | 43 class HTMLShadowElement; |
| 44 class InsertionPoint; | 44 class InsertionPoint; |
| 45 class ShadowRootRareData; | 45 class ShadowRootRareData; |
| 46 class ShadowRootRareDataV0; |
| 46 class StyleSheetList; | 47 class StyleSheetList; |
| 47 | 48 |
| 48 enum class ShadowRootType { | 49 enum class ShadowRootType { |
| 49 UserAgent, | 50 UserAgent, |
| 50 V0, | 51 V0, |
| 51 Open, | 52 Open, |
| 52 Closed | 53 Closed |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope,
public DoublyLinkedListNode<ShadowRoot> { | 56 class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope,
public DoublyLinkedListNode<ShadowRoot> { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 151 |
| 151 DECLARE_VIRTUAL_TRACE(); | 152 DECLARE_VIRTUAL_TRACE(); |
| 152 | 153 |
| 153 private: | 154 private: |
| 154 ShadowRoot(Document&, ShadowRootType); | 155 ShadowRoot(Document&, ShadowRootType); |
| 155 ~ShadowRoot() override; | 156 ~ShadowRoot() override; |
| 156 | 157 |
| 157 void childrenChanged(const ChildrenChange&) override; | 158 void childrenChanged(const ChildrenChange&) override; |
| 158 | 159 |
| 159 ShadowRootRareData* ensureShadowRootRareData(); | 160 ShadowRootRareData* ensureShadowRootRareData(); |
| 161 ShadowRootRareDataV0* ensureShadowRootRareDataV0(); |
| 160 | 162 |
| 161 void addChildShadowRoot(); | 163 void addChildShadowRoot(); |
| 162 void removeChildShadowRoot(); | 164 void removeChildShadowRoot(); |
| 163 void invalidateDescendantInsertionPoints(); | 165 void invalidateDescendantInsertionPoints(); |
| 164 | 166 |
| 165 // ShadowRoots should never be cloned. | 167 // ShadowRoots should never be cloned. |
| 166 Node* cloneNode(bool) override { return nullptr; } | 168 Node* cloneNode(bool) override { return nullptr; } |
| 167 | 169 |
| 168 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 | 170 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 |
| 169 bool isOrphan() const { return !host(); } | 171 bool isOrphan() const { return !host(); } |
| 170 | 172 |
| 171 void invalidateDescendantSlots(); | 173 void invalidateDescendantSlots(); |
| 172 unsigned descendantSlotCount() const; | 174 unsigned descendantSlotCount() const; |
| 173 | 175 |
| 174 Member<ShadowRoot> m_prev; | 176 Member<ShadowRoot> m_prev; |
| 175 Member<ShadowRoot> m_next; | 177 Member<ShadowRoot> m_next; |
| 176 Member<ShadowRootRareData> m_shadowRootRareData; | 178 Member<ShadowRootRareData> m_shadowRootRareData; |
| 179 Member<ShadowRootRareDataV0> m_shadowRootRareDataV0; |
| 180 |
| 177 Member<SlotAssignment> m_slotAssignment; | 181 Member<SlotAssignment> m_slotAssignment; |
| 178 unsigned m_numberOfStyles : 26; | 182 unsigned m_numberOfStyles : 26; |
| 179 unsigned m_type : 2; | 183 unsigned m_type : 2; |
| 180 unsigned m_registeredWithParentShadowRoot : 1; | 184 unsigned m_registeredWithParentShadowRoot : 1; |
| 181 unsigned m_descendantInsertionPointsIsValid : 1; | 185 unsigned m_descendantInsertionPointsIsValid : 1; |
| 182 unsigned m_delegatesFocus : 1; | 186 unsigned m_delegatesFocus : 1; |
| 183 unsigned m_descendantSlotsIsValid : 1; | 187 unsigned m_descendantSlotsIsValid : 1; |
| 184 }; | 188 }; |
| 185 | 189 |
| 186 inline Element* ShadowRoot::activeElement() const | 190 inline Element* ShadowRoot::activeElement() const |
| 187 { | 191 { |
| 188 return adjustedFocusedElement(); | 192 return adjustedFocusedElement(); |
| 189 } | 193 } |
| 190 | 194 |
| 191 inline ShadowRoot* Element::shadowRootIfV1() const | 195 inline ShadowRoot* Element::shadowRootIfV1() const |
| 192 { | 196 { |
| 193 ShadowRoot* root = this->shadowRoot(); | 197 ShadowRoot* root = this->shadowRoot(); |
| 194 if (root && root->isV1()) | 198 if (root && root->isV1()) |
| 195 return root; | 199 return root; |
| 196 return nullptr; | 200 return nullptr; |
| 197 } | 201 } |
| 198 | 202 |
| 199 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); | 203 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); |
| 200 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); | 204 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); |
| 201 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); | 205 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); |
| 202 | 206 |
| 203 } // namespace blink | 207 } // namespace blink |
| 204 | 208 |
| 205 #endif // ShadowRoot_h | 209 #endif // ShadowRoot_h |
| OLD | NEW |