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

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

Issue 9570057: Merge 107761 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 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/inserting/delete-insignificant-text-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/WebCore/editing/CompositeEditCommand.cpp
===================================================================
--- Source/WebCore/editing/CompositeEditCommand.cpp (revision 109471)
+++ Source/WebCore/editing/CompositeEditCommand.cpp (working copy)
@@ -528,6 +528,8 @@
if (!textNode || start >= end)
return;
+ document()->updateLayout();
+
RenderText* textRenderer = toRenderText(textNode->renderer());
if (!textRenderer)
return;
@@ -610,18 +612,20 @@
if (comparePositions(start, end) >= 0)
return;
- Node* next;
- for (Node* node = start.deprecatedNode(); node; node = next) {
- next = node->traverseNextNode();
- if (node->isTextNode()) {
- Text* textNode = static_cast<Text*>(node);
- int startOffset = node == start.deprecatedNode() ? start.deprecatedEditingOffset() : 0;
- int endOffset = node == end.deprecatedNode() ? end.deprecatedEditingOffset() : static_cast<int>(textNode->length());
- deleteInsignificantText(textNode, startOffset, endOffset);
- }
+ Vector<RefPtr<Text> > nodes;
+ for (Node* node = start.deprecatedNode(); node; node = node->traverseNextNode()) {
+ if (node->isTextNode())
+ nodes.append(static_cast<Text*>(node));
if (node == end.deprecatedNode())
break;
}
+
+ for (size_t i = 0; i < nodes.size(); ++i) {
+ Text* textNode = nodes[i].get();
+ int startOffset = textNode == start.deprecatedNode() ? start.deprecatedEditingOffset() : 0;
+ int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditingOffset() : static_cast<int>(textNode->length());
+ deleteInsignificantText(textNode, startOffset, endOffset);
+ }
}
void CompositeEditCommand::deleteInsignificantTextDownstream(const Position& pos)
« no previous file with comments | « LayoutTests/editing/inserting/delete-insignificant-text-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698