| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 ElementShadow* owner() const { return host() ? host()->shadow() : 0; } | 72 ElementShadow* owner() const { return host() ? host()->shadow() : 0; } |
| 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() == OpenShadowRoot; } | 77 bool shouldExposeToBindings() const { return type() == OpenShadowRoot; } |
| 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 | 81 |
| 82 virtual void attach(const AttachContext& = AttachContext()) override; | 82 void attach(const AttachContext& = AttachContext()) override; |
| 83 | 83 |
| 84 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 84 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 85 virtual void removedFrom(ContainerNode*) override; | 85 void removedFrom(ContainerNode*) override; |
| 86 | 86 |
| 87 void registerScopedHTMLStyleChild(); | 87 void registerScopedHTMLStyleChild(); |
| 88 void unregisterScopedHTMLStyleChild(); | 88 void unregisterScopedHTMLStyleChild(); |
| 89 | 89 |
| 90 bool containsShadowElements() const; | 90 bool containsShadowElements() const; |
| 91 bool containsContentElements() const; | 91 bool containsContentElements() const; |
| 92 bool containsInsertionPoints() const { return containsShadowElements() || co
ntainsContentElements(); } | 92 bool containsInsertionPoints() const { return containsShadowElements() || co
ntainsContentElements(); } |
| 93 bool containsShadowRoots() const; | 93 bool containsShadowRoots() const; |
| 94 | 94 |
| 95 unsigned descendantShadowElementCount() const; | 95 unsigned descendantShadowElementCount() const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 124 | 124 |
| 125 StyleSheetList* styleSheets(); | 125 StyleSheetList* styleSheets(); |
| 126 | 126 |
| 127 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; } | 127 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; } |
| 128 bool delegatesFocus() const { return m_delegatesFocus; } | 128 bool delegatesFocus() const { return m_delegatesFocus; } |
| 129 | 129 |
| 130 DECLARE_VIRTUAL_TRACE(); | 130 DECLARE_VIRTUAL_TRACE(); |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 ShadowRoot(Document&, ShadowRootType); | 133 ShadowRoot(Document&, ShadowRootType); |
| 134 virtual ~ShadowRoot(); | 134 ~ShadowRoot() override; |
| 135 | 135 |
| 136 #if !ENABLE(OILPAN) | 136 #if !ENABLE(OILPAN) |
| 137 virtual void dispose() override; | 137 void dispose() override; |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 virtual void childrenChanged(const ChildrenChange&) override; | 140 void childrenChanged(const ChildrenChange&) override; |
| 141 | 141 |
| 142 ShadowRootRareData* ensureShadowRootRareData(); | 142 ShadowRootRareData* ensureShadowRootRareData(); |
| 143 | 143 |
| 144 void addChildShadowRoot(); | 144 void addChildShadowRoot(); |
| 145 void removeChildShadowRoot(); | 145 void removeChildShadowRoot(); |
| 146 void invalidateDescendantInsertionPoints(); | 146 void invalidateDescendantInsertionPoints(); |
| 147 | 147 |
| 148 // ShadowRoots should never be cloned. | 148 // ShadowRoots should never be cloned. |
| 149 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool) override { return nullp
tr; } | 149 PassRefPtrWillBeRawPtr<Node> cloneNode(bool) override { return nullptr; } |
| 150 | 150 |
| 151 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 | 151 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 |
| 152 bool isOrphan() const { return !host(); } | 152 bool isOrphan() const { return !host(); } |
| 153 | 153 |
| 154 RawPtrWillBeMember<ShadowRoot> m_prev; | 154 RawPtrWillBeMember<ShadowRoot> m_prev; |
| 155 RawPtrWillBeMember<ShadowRoot> m_next; | 155 RawPtrWillBeMember<ShadowRoot> m_next; |
| 156 OwnPtrWillBeMember<ShadowRootRareData> m_shadowRootRareData; | 156 OwnPtrWillBeMember<ShadowRootRareData> m_shadowRootRareData; |
| 157 unsigned m_numberOfStyles : 27; | 157 unsigned m_numberOfStyles : 27; |
| 158 unsigned m_type : 1; | 158 unsigned m_type : 1; |
| 159 unsigned m_registeredWithParentShadowRoot : 1; | 159 unsigned m_registeredWithParentShadowRoot : 1; |
| 160 unsigned m_descendantInsertionPointsIsValid : 1; | 160 unsigned m_descendantInsertionPointsIsValid : 1; |
| 161 unsigned m_delegatesFocus : 1; | 161 unsigned m_delegatesFocus : 1; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 inline Element* ShadowRoot::activeElement() const | 164 inline Element* ShadowRoot::activeElement() const |
| 165 { | 165 { |
| 166 return adjustedFocusedElement(); | 166 return adjustedFocusedElement(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); | 169 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); |
| 170 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); | 170 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); |
| 171 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); | 171 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); |
| 172 | 172 |
| 173 } // namespace blink | 173 } // namespace blink |
| 174 | 174 |
| 175 #endif // ShadowRoot_h | 175 #endif // ShadowRoot_h |
| OLD | NEW |