Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 688933002: Make textContent trigger single DOMSubtreeModified event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 oldChild.notifyMutationObserversNodeWillDetach(); 611 oldChild.notifyMutationObserversNodeWillDetach();
612 612
613 removeBetween(prev, next, oldChild); 613 removeBetween(prev, next, oldChild);
614 614
615 notifyNodeRemoved(oldChild); 615 notifyNodeRemoved(oldChild);
616 childrenChanged(ChildrenChange::forRemoval(oldChild, prev, next, ChildrenCha ngeSourceParser)); 616 childrenChanged(ChildrenChange::forRemoval(oldChild, prev, next, ChildrenCha ngeSourceParser));
617 } 617 }
618 618
619 // This differs from other remove functions because it forcibly removes all the children, 619 // This differs from other remove functions because it forcibly removes all the children,
620 // regardless of read-only status or event exceptions, e.g. 620 // regardless of read-only status or event exceptions, e.g.
621 void ContainerNode::removeChildren() 621 void ContainerNode::removeChildren(bool sendModifiedEvent)
622 { 622 {
623 if (!m_firstChild) 623 if (!m_firstChild)
624 return; 624 return;
625 625
626 // The container node can be removed from event handlers. 626 // The container node can be removed from event handlers.
627 RefPtrWillBeRawPtr<ContainerNode> protect(this); 627 RefPtrWillBeRawPtr<ContainerNode> protect(this);
628 628
629 // Do any prep work needed before actually starting to detach 629 // Do any prep work needed before actually starting to detach
630 // and remove... e.g. stop loading frames, fire unload events. 630 // and remove... e.g. stop loading frames, fire unload events.
631 willRemoveChildren(); 631 willRemoveChildren();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 removeBetween(0, child->nextSibling(), *child); 664 removeBetween(0, child->nextSibling(), *child);
665 removedChildren.append(child.get()); 665 removedChildren.append(child.get());
666 notifyNodeRemoved(*child); 666 notifyNodeRemoved(*child);
667 } 667 }
668 } 668 }
669 669
670 ChildrenChange change = {AllChildrenRemoved, nullptr, nullptr, ChildrenC hangeSourceAPI}; 670 ChildrenChange change = {AllChildrenRemoved, nullptr, nullptr, ChildrenC hangeSourceAPI};
671 childrenChanged(change); 671 childrenChanged(change);
672 } 672 }
673 673
674 // We don't fire the DOMSubtreeModified event for Attr Nodes. This matches t he behavior 674 // We don't fire the DOMSubtreeModified event for Attr Nodes. This matches t he behavior
sof 2014/11/20 12:09:59 Move this comment to Attr::setValue()
675 // of IE and Firefox. This event is fired synchronously and is a source of t rouble for 675 // of IE and Firefox. This event is fired synchronously and is a source of t rouble for
676 // attributes as the JS callback could alter the attributes and leave us in a bad state. 676 // attributes as the JS callback could alter the attributes and leave us in a bad state.
677 if (!isAttributeNode()) 677 if (sendModifiedEvent)
678 dispatchSubtreeModifiedEvent(); 678 dispatchSubtreeModifiedEvent();
679 } 679 }
680 680
681 PassRefPtrWillBeRawPtr<Node> ContainerNode::appendChild(PassRefPtrWillBeRawPtr<N ode> newChild, ExceptionState& exceptionState) 681 PassRefPtrWillBeRawPtr<Node> ContainerNode::appendChild(PassRefPtrWillBeRawPtr<N ode> newChild, ExceptionState& exceptionState)
682 { 682 {
683 RefPtrWillBeRawPtr<ContainerNode> protect(this); 683 RefPtrWillBeRawPtr<ContainerNode> protect(this);
684 684
685 #if !ENABLE(OILPAN) 685 #if !ENABLE(OILPAN)
686 // Check that this node is not "floating". 686 // Check that this node is not "floating".
687 // If it is, it can be deleted as a side effect of sending mutation events. 687 // If it is, it can be deleted as a side effect of sending mutation events.
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 return true; 1441 return true;
1442 1442
1443 if (node->isElementNode() && toElement(node)->shadow()) 1443 if (node->isElementNode() && toElement(node)->shadow())
1444 return true; 1444 return true;
1445 1445
1446 return false; 1446 return false;
1447 } 1447 }
1448 #endif 1448 #endif
1449 1449
1450 } // namespace blink 1450 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698