Changeset 137731 in webkit
- Timestamp:
- Dec 14, 2012, 1:23:22 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r137727 r137731 1 2012-12-14 Shinya Kawanaka <shinyak@chromium.org> 2 3 [Shadow DOM] ShadowRoot.getElementById() should work outside document. 4 https://bugs.webkit.org/show_bug.cgi?id=87815 5 6 Reviewed by Hajime Morita. 7 8 * fast/dom/shadow/getelementbyid-in-orphan-expected.txt: Added. 9 * fast/dom/shadow/getelementbyid-in-orphan.html: Added. 10 1 11 2012-12-14 Eugene Klyuchnikov <eustas@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r137730 r137731 1 2012-12-14 Shinya Kawanaka <shinyak@chromium.org> 2 3 [Shadow DOM] ShadowRoot.getElementById() should work outside document. 4 https://bugs.webkit.org/show_bug.cgi?id=87815 5 6 Reviewed by Hajime Morita. 7 8 ShadowRoot.getElementById() didn't work if ShadowRoot is outside document. We need to update id when an element 9 is in ShadowTree event if it is not in document. 10 11 For performance reason, we introduce IsInShadowTree flag, which enables us to check isInTreeScope() fast. 12 This is maintained in Element::insertedInto and removedFrom. Here, we're anxious about performance regression, 13 however our benchmark result shows this doesn't regress the performance. 14 15 I've measured Dromaeo/dom-modify.html and Parser/html5-full-render.html 2 times. 16 17 Dromaeo/dom-modify.html 18 35.21, 35.27 [runs/s] ---> 35.76, 35.56 [runs/s] 19 Parser/html5-full-render.html 20 4328.51, 4254.94 [ms] ---> 4277.14, 4222.43 [ms] 21 22 Test: fast/dom/shadow/getelementbyid-in-orphan.html 23 24 * dom/Element.cpp: 25 (WebCore::Element::insertedInto): 26 * dom/Element.h: 27 (WebCore::Element::updateId): 28 * dom/Node.cpp: 29 (WebCore::Node::insertedInto): If the parent node is in shadow tree, this node should be also in the same shadow tree. 30 Since this node is inserted, parentOrHostNode() will not be null. 31 (WebCore::Node::removedFrom): When node is removed from ShadowTree, its treeScope() should not be ShadowRoot. 32 * dom/Node.h: 33 (Node): 34 (WebCore::Node::isInShadowTree): 35 (WebCore::Node::isInTreeScope): 36 1 37 2012-12-14 Antoine Quint <graouts@apple.com> 2 38 -
trunk/Source/WebCore/dom/Element.cpp
r137715 r137731 1099 1099 #endif 1100 1100 1101 if (!insertionPoint->i nDocument())1101 if (!insertionPoint->isInTreeScope()) 1102 1102 return InsertionDone; 1103 1103 -
trunk/Source/WebCore/dom/Element.h
r137715 r137731 680 680 inline void Element::updateId(const AtomicString& oldId, const AtomicString& newId) 681 681 { 682 if (!i nDocument())682 if (!isInTreeScope()) 683 683 return; 684 684 … … 691 691 inline void Element::updateId(TreeScope* scope, const AtomicString& oldId, const AtomicString& newId) 692 692 { 693 ASSERT(i nDocument());693 ASSERT(isInTreeScope()); 694 694 ASSERT(oldId != newId); 695 695 -
trunk/Source/WebCore/dom/Node.cpp
r137715 r137731 1271 1271 } 1272 1272 1273 bool Node::isInShadowTree() const1274 {1275 return treeScope() != document();1276 }1277 1278 1273 Element* Node::parentOrHostElement() const 1279 1274 { … … 2101 2096 if (insertionPoint->inDocument()) 2102 2097 setFlag(InDocumentFlag); 2098 if (parentOrHostNode()->isInShadowTree()) 2099 setFlag(IsInShadowTreeFlag); 2103 2100 return InsertionDone; 2104 2101 } … … 2109 2106 if (insertionPoint->inDocument()) 2110 2107 clearFlag(InDocumentFlag); 2108 if (isInShadowTree() && !treeScope()->rootNode()->isShadowRoot()) 2109 clearFlag(IsInShadowTreeFlag); 2111 2110 } 2112 2111 -
trunk/Source/WebCore/dom/Node.h
r137715 r137731 276 276 // Returns 0, a child of ShadowRoot, or a legacy shadow root. 277 277 Node* nonBoundaryShadowTreeRootNode(); 278 bool isInShadowTree() const; 278 279 279 // Node's parent, shadow tree host. 280 280 ContainerNode* parentOrHostNode() const; … … 477 477 return getFlag(InDocumentFlag); 478 478 } 479 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } 480 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumentFlag | IsInShadowTreeFlag)); } 479 481 480 482 bool isReadOnlyNode() const { return nodeType() == ENTITY_REFERENCE_NODE; } … … 713 715 V8CollectableDuringMinorGCFlag = 1 << 24, 714 716 NeedsShadowTreeWalkerFlag = 1 << 25, 717 IsInShadowTreeFlag = 1 << 26, 715 718 716 719 DefaultNodeFlags = IsParsingChildrenFinishedFlag 717 720 }; 718 721 719 // 6bits remaining722 // 5 bits remaining 720 723 721 724 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } … … 731 734 CreateElement = CreateContainer | IsElementFlag, 732 735 CreatePseudoElement = CreateElement | InDocumentFlag | NeedsShadowTreeWalkerFlag, 733 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | NeedsShadowTreeWalkerFlag ,736 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | NeedsShadowTreeWalkerFlag | IsInShadowTreeFlag, 734 737 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, 735 738 CreateStyledElement = CreateElement | IsStyledElementFlag,
Note:
See TracChangeset
for help on using the changeset viewer.