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

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

Issue 181283002: Fixing a crash in InsertListCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 894
895 NodeVector nodes; 895 NodeVector nodes;
896 for (Node* child = firstChildInAncestorToProcess.get(); child; 896 for (Node* child = firstChildInAncestorToProcess.get(); child;
897 child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling()) 897 child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling())
898 nodes.append(child); 898 nodes.append(child);
899 899
900 for (NodeVector::const_iterator it = nodes.begin(); it != nodes.end(); + +it) { 900 for (NodeVector::const_iterator it = nodes.begin(); it != nodes.end(); + +it) {
901 Node* child = it->get(); 901 Node* child = it->get();
902 switch (action) { 902 switch (action) {
903 case DELETE_CONTENTS: 903 case DELETE_CONTENTS:
904 // ancestor->removeChild(<child before this child>) might cause the tree change
905 // because removeChild might call dispatchSubtreeModifiedEvent.
906 // Then we should validate again.
Yuta Kitamura 2014/02/26 10:41:16 nit: The first sentence sounds a little bit strang
yoichio 2014/02/27 04:00:03 Done.
907 if (ancestor != child->parentNode())
Yuta Kitamura 2014/02/26 10:41:16 Ideally, we could have bulk-removal functionality
yoichio 2014/02/27 04:00:03 Done.
908 break;
904 ancestor->removeChild(child, exceptionState); 909 ancestor->removeChild(child, exceptionState);
905 break; 910 break;
906 case EXTRACT_CONTENTS: // will remove child from ancestor 911 case EXTRACT_CONTENTS: // will remove child from ancestor
907 if (direction == ProcessContentsForward) 912 if (direction == ProcessContentsForward)
908 clonedContainer->appendChild(child, exceptionState); 913 clonedContainer->appendChild(child, exceptionState);
909 else 914 else
910 clonedContainer->insertBefore(child, clonedContainer->firstC hild(), exceptionState); 915 clonedContainer->insertBefore(child, clonedContainer->firstC hild(), exceptionState);
911 break; 916 break;
912 case CLONE_CONTENTS: 917 case CLONE_CONTENTS:
913 if (direction == ProcessContentsForward) 918 if (direction == ProcessContentsForward)
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 1891
1887 void showTree(const WebCore::Range* range) 1892 void showTree(const WebCore::Range* range)
1888 { 1893 {
1889 if (range && range->boundaryPointsValid()) { 1894 if (range && range->boundaryPointsValid()) {
1890 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1895 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1891 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1896 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1892 } 1897 }
1893 } 1898 }
1894 1899
1895 #endif 1900 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698