Changeset 117796 in webkit
- Timestamp:
- May 21, 2012, 9:59:02 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
dom/ContainerNodeAlgorithms.cpp (modified) (1 diff)
-
dom/Document.cpp (modified) (1 diff)
-
dom/ElementShadow.cpp (modified) (1 diff)
-
dom/ElementShadow.h (modified) (3 diffs)
-
dom/Node.h (modified) (1 diff)
-
dom/TreeScopeAdopter.cpp (modified) (2 diffs)
-
dom/TreeScopeAdopter.h (modified) (1 diff)
-
html/shadow/TextFieldDecorationElement.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117795 r117796 1 2012-05-21 MORITA Hajime <morrita@google.com> 2 3 [Refactoring] Node should have youngestShadowRoot. 4 https://bugs.webkit.org/show_bug.cgi?id=86427 5 6 Reviewed by Dimitri Glazkov. 7 8 This change adds Node::youngestShadowRoot() and replaced 9 ElementShadow::youngestShadowRoot() with it if appropriate. 10 11 By introducing this, traversal across node and its shadow tree can 12 look more fluent and idiomatic. There are a few non-trivial traversal 13 remaining like ElementShadow::recalcStyle() and attach(). 14 But they should be flattened out eventually. 15 16 No new tests. Refactoring. 17 18 * dom/ContainerNodeAlgorithms.cpp: 19 (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree): 20 * dom/Document.cpp: 21 (WebCore::Document::buildAccessKeyMap): 22 * dom/ElementShadow.cpp: 23 * dom/ElementShadow.h: 24 (ElementShadow): 25 (WebCore::Node::youngestShadowRoot): 26 (WebCore): 27 * dom/Node.h: 28 (Node): 29 * dom/TreeScopeAdopter.cpp: 30 (WebCore::TreeScopeAdopter::moveTreeToNewScope): 31 (WebCore::TreeScopeAdopter::moveTreeToNewDocument): 32 * dom/TreeScopeAdopter.h: 33 (TreeScopeAdopter): 34 * html/shadow/TextFieldDecorationElement.cpp: 35 (WebCore::getDecorationRootAndDecoratedRoot): 36 1 37 2012-05-21 Christophe Dumez <christophe.dumez@intel.com> 2 38 -
trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp
r116629 r117796 62 62 } 63 63 64 if (!node->isElementNode()) 65 return; 66 67 if (ElementShadow* shadow = toElement(node)->shadow()) { 68 for (ShadowRoot* root = shadow->youngestShadowRoot(); root; root = root->olderShadowRoot()) 69 notifyNodeInsertedIntoTree(root); 70 } 64 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->olderShadowRoot()) 65 notifyNodeInsertedIntoTree(root); 71 66 } 72 67 -
trunk/Source/WebCore/dom/Document.cpp
r117613 r117796 720 720 m_elementsByAccessKey.set(accessKey.impl(), element); 721 721 722 if (ElementShadow* shadow = element->shadow()) { 723 for (ShadowRoot* root = shadow->youngestShadowRoot(); root; root = root->olderShadowRoot()) 724 buildAccessKeyMap(root); 725 } 722 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->olderShadowRoot()) 723 buildAccessKeyMap(root); 726 724 } 727 725 } -
trunk/Source/WebCore/dom/ElementShadow.cpp
r117723 r117796 111 111 } 112 112 113 void ElementShadow::setParentTreeScope(TreeScope* scope)114 {115 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot())116 root->setParentTreeScope(scope);117 }118 119 113 void ElementShadow::attach() 120 114 { -
trunk/Source/WebCore/dom/ElementShadow.h
r117033 r117796 29 29 30 30 #include "ContentDistributor.h" 31 #include "Element.h" 31 32 #include "ExceptionCode.h" 32 33 #include "ShadowRoot.h" … … 53 54 54 55 void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&); 55 56 void setParentTreeScope(TreeScope*);57 56 58 57 void attach(); … … 116 115 } 117 116 117 inline ShadowRoot* Node::youngestShadowRoot() const 118 { 119 if (!this->isElementNode()) 120 return 0; 121 if (ElementShadow* shadow = toElement(this)->shadow()) 122 return shadow->youngestShadowRoot(); 123 return 0; 124 } 125 118 126 class ShadowRootVector : public Vector<RefPtr<ShadowRoot> > { 119 127 public: -
trunk/Source/WebCore/dom/Node.h
r117723 r117796 224 224 Node* shadowAncestorNode() const; 225 225 ShadowRoot* shadowRoot() const; 226 ShadowRoot* youngestShadowRoot() const; 227 226 228 // Returns 0, a child of ShadowRoot, or a legacy shadow root. 227 229 Node* nonBoundaryShadowTreeRootNode(); -
trunk/Source/WebCore/dom/TreeScopeAdopter.cpp
r116277 r117796 64 64 moveNodeToNewDocument(node, oldDocument, newDocument); 65 65 66 if (ElementShadow* shadow = shadowFor(node)) {66 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) { 67 67 shadow->setParentTreeScope(m_newScope); 68 68 if (willMoveToNewDocument) 69 move ShadowToNewDocument(shadow, oldDocument, newDocument);69 moveTreeToNewDocument(shadow, oldDocument, newDocument); 70 70 } 71 71 } … … 76 76 for (Node* node = root; node; node = node->traverseNextNode(root)) { 77 77 moveNodeToNewDocument(node, oldDocument, newDocument); 78 if (ElementShadow* shadow = shadowFor(node))79 move ShadowToNewDocument(shadow, oldDocument, newDocument);78 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) 79 moveTreeToNewDocument(shadow, oldDocument, newDocument); 80 80 } 81 }82 83 inline void TreeScopeAdopter::moveShadowToNewDocument(ElementShadow* shadow, Document* oldDocument, Document* newDocument) const84 {85 for (ShadowRoot* root = shadow->youngestShadowRoot(); root; root = root->olderShadowRoot())86 moveTreeToNewDocument(root, oldDocument, newDocument);87 81 } 88 82 -
trunk/Source/WebCore/dom/TreeScopeAdopter.h
r116277 r117796 47 47 void moveTreeToNewDocument(Node*, Document* oldDocument, Document* newDocument) const; 48 48 void moveNodeToNewDocument(Node*, Document* oldDocument, Document* newDocument) const; 49 void moveShadowToNewDocument(ElementShadow*, Document* oldDocument, Document* newDocument) const;50 49 51 50 Node* m_toAdopt; -
trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp
r117242 r117796 69 69 static inline void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, ShadowRoot*& decorationRoot, ShadowRoot*& decoratedRoot) 70 70 { 71 ShadowRoot* existingRoot = input-> shadow()->youngestShadowRoot();71 ShadowRoot* existingRoot = input->youngestShadowRoot(); 72 72 ShadowRoot* newRoot = 0; 73 73 while (existingRoot->childNodeCount() == 1 && existingRoot->firstChild()->hasTagName(shadowTag)) {
Note:
See TracChangeset
for help on using the changeset viewer.