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

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: Address comments 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
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(SubtreeModificationAction action)
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 if (action == DispatchSubtreeModifiedEvent)
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.
677 if (!isAttributeNode())
678 dispatchSubtreeModifiedEvent(); 675 dispatchSubtreeModifiedEvent();
679 } 676 }
680 677
681 PassRefPtrWillBeRawPtr<Node> ContainerNode::appendChild(PassRefPtrWillBeRawPtr<N ode> newChild, ExceptionState& exceptionState) 678 PassRefPtrWillBeRawPtr<Node> ContainerNode::appendChild(PassRefPtrWillBeRawPtr<N ode> newChild, ExceptionState& exceptionState)
682 { 679 {
683 RefPtrWillBeRawPtr<ContainerNode> protect(this); 680 RefPtrWillBeRawPtr<ContainerNode> protect(this);
684 681
685 #if !ENABLE(OILPAN) 682 #if !ENABLE(OILPAN)
686 // Check that this node is not "floating". 683 // Check that this node is not "floating".
687 // If it is, it can be deleted as a side effect of sending mutation events. 684 // 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; 1438 return true;
1442 1439
1443 if (node->isElementNode() && toElement(node)->shadow()) 1440 if (node->isElementNode() && toElement(node)->shadow())
1444 return true; 1441 return true;
1445 1442
1446 return false; 1443 return false;
1447 } 1444 }
1448 #endif 1445 #endif
1449 1446
1450 } // namespace blink 1447 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698