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

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

Issue 25389004: Notify nodes removal to Range/Selection after dispatching blur and mutation event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/Range/range-after-remove-children-expected.txt ('k') | no next file » | 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 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 dispatchChildRemovalEvents(child); 394 dispatchChildRemovalEvents(child);
395 child->document().nodeWillBeRemoved(child); // e.g. mutation event listener can create a new range. 395 child->document().nodeWillBeRemoved(child); // e.g. mutation event listener can create a new range.
396 ChildFrameDisconnector(child).disconnect(); 396 ChildFrameDisconnector(child).disconnect();
397 } 397 }
398 398
399 static void willRemoveChildren(ContainerNode* container) 399 static void willRemoveChildren(ContainerNode* container)
400 { 400 {
401 NodeVector children; 401 NodeVector children;
402 getChildNodes(container, children); 402 getChildNodes(container, children);
403 403
404 container->document().nodeChildrenWillBeRemoved(container);
405
406 ChildListMutationScope mutation(container); 404 ChildListMutationScope mutation(container);
407 for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) { 405 for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) {
408 Node* child = it->get(); 406 Node* child = it->get();
409 mutation.willRemoveChild(child); 407 mutation.willRemoveChild(child);
410 child->notifyMutationObserversNodeWillDetach(); 408 child->notifyMutationObserversNodeWillDetach();
411 409
412 // fire removed from document mutation events. 410 // fire removed from document mutation events.
413 dispatchChildRemovalEvents(child); 411 dispatchChildRemovalEvents(child);
414 } 412 }
415 413
414 container->document().nodeChildrenWillBeRemoved(container); // e.g. mutation event listener can create a new range.
tkent 2013/10/04 05:21:39 After this line, It is possible to dispatch 'blur'
yosin_UTC9 2013/10/04 08:09:30 It is safe in 'DOMSubtreeModfified' event handler,
tkent 2013/10/06 23:46:54 The comment in removeChildren says: // T
416 ChildFrameDisconnector(container).disconnect(ChildFrameDisconnector::Descend antsOnly); 415 ChildFrameDisconnector(container).disconnect(ChildFrameDisconnector::Descend antsOnly);
417 } 416 }
418 417
419 void ContainerNode::disconnectDescendantFrames() 418 void ContainerNode::disconnectDescendantFrames()
420 { 419 {
421 ChildFrameDisconnector(this).disconnect(); 420 ChildFrameDisconnector(this).disconnect();
422 } 421 }
423 422
424 void ContainerNode::removeChild(Node* oldChild, ExceptionState& es) 423 void ContainerNode::removeChild(Node* oldChild, ExceptionState& es)
425 { 424 {
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 return true; 978 return true;
980 979
981 if (node->isElementNode() && toElement(node)->shadow()) 980 if (node->isElementNode() && toElement(node)->shadow())
982 return true; 981 return true;
983 982
984 return false; 983 return false;
985 } 984 }
986 #endif 985 #endif
987 986
988 } // namespace WebCore 987 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Range/range-after-remove-children-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698