Changeset 189906 in webkit
- Timestamp:
- Sep 16, 2015 11:12:06 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r189905 r189906 1 2015-09-16 Ryosuke Niwa <rniwa@webkit.org> 2 3 removeShadow shouldn't call ChildNodeRemovalNotifier with the shadow host as the removal point 4 https://bugs.webkit.org/show_bug.cgi?id=149244 5 6 Reviewed by Antti Koivisto. 7 8 Since a shadow host is in a different tree than nodes in its shadow tree, it's incorrect to call 9 removedFrom with the shadow host as the removal point. This causes HTMLSlotElement::removedFrom 10 which will be added in the bug 149241 to call methods on a wrong ShadowRoot. 11 12 We still keep the ad-hoc behavior of using the shadow host as the insertion/removal point when 13 calling insertedInto and removedFrom on the shadow root itself to update the InDocument node flag. 14 We may want to re-visit this design in the future. 15 16 No new tests since I couldn't quite create a reduction. However, tests I'm adding in the bug 149241 17 will crash without this change. 18 19 I separated this patch from the bug 149241 to isolate the high-risk code change here. 20 21 * dom/Element.cpp: 22 (WebCore::Element::addShadowRoot): Call insertedInto on ShadowRoot, and then call it on all its 23 children separately with the insertion point set to the shadow root since insertedInto relies on 24 insertion point's inDocument flag to be true when the shadow host is in the document. 25 (WebCore::Element::removeShadowRoot): Ditto in the reverse order. 26 1 27 2015-09-16 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 28 -
trunk/Source/WebCore/dom/Element.cpp
r189896 r189906 1616 1616 shadowRoot.setParentTreeScope(&treeScope()); 1617 1617 1618 NodeVector postInsertionNotificationTargets; 1619 notifyChildNodeInserted(*this, shadowRoot, postInsertionNotificationTargets); 1620 1621 for (auto& target : postInsertionNotificationTargets) 1622 target->finishedInsertingSubtree(); 1618 auto shadowRootInsertionResult = shadowRoot.insertedInto(*this); 1619 ASSERT_UNUSED(shadowRootInsertionResult, shadowRootInsertionResult == InsertionDone); 1620 if (auto* firstChild = shadowRoot.firstChild()) { 1621 NodeVector postInsertionNotificationTargets; 1622 { 1623 NoEventDispatchAssertion assertNoEventDispatch; 1624 for (auto* child = firstChild; child; child = child->nextSibling()) 1625 notifyChildNodeInserted(shadowRoot, *child, postInsertionNotificationTargets); 1626 } 1627 1628 for (auto& target : postInsertionNotificationTargets) 1629 target->finishedInsertingSubtree(); 1630 } 1623 1631 1624 1632 resetNeedsNodeRenderingTraversalSlowPath(); … … 1647 1655 oldRoot->setParentTreeScope(&document()); 1648 1656 1649 notifyChildNodeRemoved(*this, *oldRoot); 1657 { 1658 NoEventDispatchAssertion assertNoEventDispatch; 1659 for (auto* child = oldRoot->firstChild(); child; child = child->nextSibling()) 1660 notifyChildNodeRemoved(*oldRoot, *child); 1661 } 1662 1663 oldRoot->removedFrom(*this); 1650 1664 } 1651 1665
Note: See TracChangeset
for help on using the changeset viewer.