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

Unified Diff: Source/core/editing/CompositeEditCommand.cpp

Issue 306473003: Don't over split DOM tree in CompositeEditCommand::splitTreeToNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-05-28T05:18:57 Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/editing/execCommand/indent-table-cell-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/CompositeEditCommand.cpp
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index b7cdd68aa64943606b7a6a8274afb27129d2c66f..4b4dfce54b63bb7350b7c9efdf6bafc534c7dd98 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -1456,12 +1456,14 @@ PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, b
ASSERT(end);
ASSERT(start != end);
- RefPtr<Node> node;
if (shouldSplitAncestor && end->parentNode())
end = end->parentNode();
+ if (!start->isDescendantOf(end))
+ return end;
RefPtr<Node> endNode = end;
- for (node = start; node && node->parentNode() != endNode; node = node->parentNode()) {
+ RefPtr<Node> node;
+ for (node = start; node->parentNode() != endNode; node = node->parentNode()) {
if (!node->parentNode()->isElementNode())
break;
// Do not split a node when doing so introduces an empty node.
« no previous file with comments | « LayoutTests/editing/execCommand/indent-table-cell-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698