Changeset 74715 in webkit
- Timestamp:
- Dec 28, 2010 10:55:42 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r74714 r74715 1 2010-12-28 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Combine setShadowRoot and clearShadowRoot into a simpler API 6 https://bugs.webkit.org/show_bug.cgi?id=50971 7 8 No change in behavior, and API is not used yet. 9 10 * dom/Element.cpp: 11 (WebCore::Element::setShadowRoot): Combined clearing and setting of 12 the shadowRoot, also hooked up with setting and clearing of the 13 corresponding shadowHost values. 14 * dom/Element.h: renamed clearShadowRoot to removeShadowRoot and made it 15 private. 16 * dom/Node.h: Made shadow host-related functions public so that 17 Element::setShadowRoot can access setShadowHost. It seems logical 18 to make shadowHost public as well to keep the defs together. 19 1 20 2010-12-28 Andrey Kosyakov <caseq@chromium.org> 2 21 -
trunk/WebCore/dom/Element.cpp
r73983 r74715 1083 1083 void Element::setShadowRoot(PassRefPtr<Node> node) 1084 1084 { 1085 ASSERT(node); 1086 1087 // FIXME: Once all instances of shadow DOM are converted to use this code, add setting of shadow host (shadowParent) on node. 1088 ensureRareData()->m_shadowRoot = node; 1089 } 1090 1091 void Element::clearShadowRoot() 1085 // FIXME: Because today this is never called from script directly, we don't have to worry 1086 // about compromising DOM tree integrity (eg. node being a parent of this). However, 1087 // once we implement XBL2, we will have to add integrity checks here. 1088 removeShadowRoot(); 1089 RefPtr<Node> newRoot = node; 1090 if (!newRoot) 1091 return; 1092 1093 ensureRareData()->m_shadowRoot = newRoot; 1094 newRoot->setShadowHost(this); 1095 } 1096 1097 void Element::removeShadowRoot() 1092 1098 { 1093 1099 if (!hasRareData()) 1094 1100 return; 1095 1101 1096 RefPtr<Node> shadowRoot = rareData()->m_shadowRoot.release(); 1097 document()->removeFocusedNodeOfSubtree(shadowRoot.get()); 1098 // FIXME: Once all instances of shadow DOM are converted to use this code, add clearing of shadow host (shadowParent). 1099 if (shadowRoot->inDocument()) 1100 shadowRoot->removedFromDocument(); 1101 else 1102 shadowRoot->removedFromTree(true); 1102 if (RefPtr<Node> oldRoot = rareData()->m_shadowRoot.release()) { 1103 document()->removeFocusedNodeOfSubtree(oldRoot.get()); 1104 oldRoot->setShadowHost(0); 1105 if (oldRoot->inDocument()) 1106 oldRoot->removedFromDocument(); 1107 else 1108 oldRoot->removedFromTree(true); 1109 } 1103 1110 } 1104 1111 -
trunk/WebCore/dom/Element.h
r73114 r74715 228 228 Node* shadowRoot(); 229 229 void setShadowRoot(PassRefPtr<Node>); 230 void clearShadowRoot();231 230 232 231 RenderStyle* computedStyle(PseudoId = NOPSEUDO); … … 393 392 394 393 SpellcheckAttributeState spellcheckAttributeState() const; 394 void removeShadowRoot(); 395 395 396 396 private: -
trunk/WebCore/dom/Node.h
r74406 r74715 217 217 ContainerNode* parentNodeGuaranteedHostFree() const; 218 218 219 Element* shadowHost() const; 220 void setShadowHost(Element*); 221 219 222 // Returns the enclosing event parent node (or self) that, when clicked, would trigger a navigation. 220 223 Node* enclosingLinkEventParentOrSelf(); … … 639 642 NodeRareData* ensureRareData(); 640 643 641 Element* shadowHost() const;642 void setShadowHost(Element*);643 644 644 private: 645 645 #if USE(JSC)
Note: See TracChangeset
for help on using the changeset viewer.