| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/dom/DocumentFragment.h" | 31 #include "core/dom/DocumentFragment.h" |
| 32 #include "core/dom/Element.h" | 32 #include "core/dom/Element.h" |
| 33 #include "core/dom/TreeScope.h" | 33 #include "core/dom/TreeScope.h" |
| 34 #include "wtf/DoublyLinkedList.h" | 34 #include "wtf/DoublyLinkedList.h" |
| 35 | 35 |
| 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; | |
| 42 class InsertionPoint; | 41 class InsertionPoint; |
| 43 class ShadowRootRareData; | 42 class ShadowRootRareData; |
| 44 class StyleSheetList; | 43 class StyleSheetList; |
| 45 | 44 |
| 46 class ShadowRoot final : public DocumentFragment, public TreeScope, public Doubl
yLinkedListNode<ShadowRoot> { | 45 class ShadowRoot final : public DocumentFragment, public TreeScope, public Doubl
yLinkedListNode<ShadowRoot> { |
| 47 DEFINE_WRAPPERTYPEINFO(); | 46 DEFINE_WRAPPERTYPEINFO(); |
| 48 friend class WTF::DoublyLinkedListNode<ShadowRoot>; | 47 friend class WTF::DoublyLinkedListNode<ShadowRoot>; |
| 49 public: | 48 public: |
| 50 | 49 |
| 51 static PassRefPtr<ShadowRoot> create(Document& document) | 50 static PassRefPtr<ShadowRoot> create(Document& document) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 67 bool isYoungest() const { return !youngerShadowRoot(); } | 66 bool isYoungest() const { return !youngerShadowRoot(); } |
| 68 bool isOldest() const { return !olderShadowRoot(); } | 67 bool isOldest() const { return !olderShadowRoot(); } |
| 69 bool isOldestAuthorShadowRoot() const; | 68 bool isOldestAuthorShadowRoot() const; |
| 70 | 69 |
| 71 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 70 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 72 virtual void removedFrom(ContainerNode*) override; | 71 virtual void removedFrom(ContainerNode*) override; |
| 73 | 72 |
| 74 void registerScopedHTMLStyleChild(); | 73 void registerScopedHTMLStyleChild(); |
| 75 void unregisterScopedHTMLStyleChild(); | 74 void unregisterScopedHTMLStyleChild(); |
| 76 | 75 |
| 77 bool containsShadowElements() const; | |
| 78 bool containsContentElements() const; | 76 bool containsContentElements() const; |
| 79 bool containsInsertionPoints() const { return containsShadowElements() || co
ntainsContentElements(); } | 77 bool containsInsertionPoints() const { return containsContentElements(); } |
| 80 bool containsShadowRoots() const; | 78 bool containsShadowRoots() const; |
| 81 | 79 |
| 82 unsigned descendantShadowElementCount() const; | |
| 83 | |
| 84 // For Internals, don't use this. | 80 // For Internals, don't use this. |
| 85 unsigned childShadowRootCount() const; | 81 unsigned childShadowRootCount() const; |
| 86 unsigned numberOfStyles() const { return m_numberOfStyles; } | 82 unsigned numberOfStyles() const { return m_numberOfStyles; } |
| 87 | 83 |
| 88 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const; | |
| 89 void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShadowElement
>); | |
| 90 | |
| 91 void didAddInsertionPoint(InsertionPoint*); | 84 void didAddInsertionPoint(InsertionPoint*); |
| 92 void didRemoveInsertionPoint(InsertionPoint*); | 85 void didRemoveInsertionPoint(InsertionPoint*); |
| 93 const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints(); | 86 const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints(); |
| 94 | 87 |
| 95 // Make protected methods from base class public here. | 88 // Make protected methods from base class public here. |
| 96 using TreeScope::setDocument; | 89 using TreeScope::setDocument; |
| 97 using TreeScope::setParentTreeScope; | 90 using TreeScope::setParentTreeScope; |
| 98 | 91 |
| 99 public: | 92 public: |
| 100 Element* activeElement() const; | 93 Element* activeElement() const; |
| 101 | 94 |
| 102 ShadowRoot* olderShadowRoot() const { return next(); } | 95 ShadowRoot* olderShadowRoot() const { return next(); } |
| 103 | 96 |
| 104 PassRefPtr<Node> cloneNode(bool, ExceptionState&); | 97 PassRefPtr<Node> cloneNode(bool, ExceptionState&); |
| 105 PassRefPtr<Node> cloneNode(ExceptionState& exceptionState) { return cloneNod
e(true, exceptionState); } | 98 PassRefPtr<Node> cloneNode(ExceptionState& exceptionState) { return cloneNod
e(true, exceptionState); } |
| 106 | 99 |
| 107 StyleSheetList* styleSheets(); | 100 StyleSheetList* styleSheets(); |
| 108 | 101 |
| 109 virtual void trace(Visitor*) override; | 102 virtual void trace(Visitor*) override; |
| 110 | 103 |
| 111 private: | 104 private: |
| 112 ShadowRoot(Document&); | 105 ShadowRoot(Document&); |
| 113 virtual ~ShadowRoot(); | 106 virtual ~ShadowRoot(); |
| 114 | 107 |
| 115 #if !ENABLE(OILPAN) | 108 #if !ENABLE(OILPAN) |
| 116 virtual void dispose() override; | 109 virtual void dispose() override; |
| 117 #endif | 110 #endif |
| 118 | 111 |
| 119 virtual void childrenChanged(const ChildrenChange&) override; | |
| 120 | |
| 121 ShadowRootRareData* ensureShadowRootRareData(); | 112 ShadowRootRareData* ensureShadowRootRareData(); |
| 122 | 113 |
| 123 void addChildShadowRoot(); | 114 void addChildShadowRoot(); |
| 124 void removeChildShadowRoot(); | 115 void removeChildShadowRoot(); |
| 125 void invalidateDescendantInsertionPoints(); | 116 void invalidateDescendantInsertionPoints(); |
| 126 | 117 |
| 127 // ShadowRoots should never be cloned. | 118 // ShadowRoots should never be cloned. |
| 128 virtual PassRefPtr<Node> cloneNode(bool) override { return nullptr; } | 119 virtual PassRefPtr<Node> cloneNode(bool) override { return nullptr; } |
| 129 | 120 |
| 130 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 | 121 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888
34 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 142 { | 133 { |
| 143 return adjustedFocusedElement(); | 134 return adjustedFocusedElement(); |
| 144 } | 135 } |
| 145 | 136 |
| 146 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); | 137 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); |
| 147 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); | 138 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); |
| 148 | 139 |
| 149 } // namespace blink | 140 } // namespace blink |
| 150 | 141 |
| 151 #endif // ShadowRoot_h | 142 #endif // ShadowRoot_h |
| OLD | NEW |