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

Unified Diff: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp

Issue 2650113004: [WIP] Add support for Android SuggestionSpans when editing text (Closed)
Patch Set: Remove logging statements, fix copyright years in new files Created 3 years, 11 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
Index: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
index 0c7fb5795e80adc76d9cb1cd2c79949553efcf3d..f238e95ebd8aa2edbb24d7dbd9d1ad2d74d0e01d 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -532,13 +532,16 @@ void CompositeEditCommand::replaceTextInNode(Text* node,
const String& replacementText) {
// DeleteFromTextNodeCommand and InsertIntoTextNodeCommand are never
// aborted.
- applyCommandToComposite(
- DeleteFromTextNodeCommand::create(node, offset, count),
- ASSERT_NO_EDITING_ABORT);
+
+ // Insert must happen before delete to preserve markers correctly
+ // See algorithm in https://dom.spec.whatwg.org/#concept-cd-replace
if (!replacementText.isEmpty())
applyCommandToComposite(
InsertIntoTextNodeCommand::create(node, offset, replacementText),
ASSERT_NO_EDITING_ABORT);
+ applyCommandToComposite(DeleteFromTextNodeCommand::create(
rlanday 2017/01/31 19:50:21 Again, hope this doesn't break anything...
rlanday 2017/01/31 22:33:45 I have a test case that requires this fix to work
esprehn 2017/01/31 22:41:34 What did the code do before and what's different?
rlanday 2017/01/31 22:58:43 Actually this doesn't break any of the webkit_unit
+ node, offset + replacementText.length(), count),
+ ASSERT_NO_EDITING_ABORT);
}
Position CompositeEditCommand::replaceSelectedTextInNode(const String& text) {

Powered by Google App Engine
This is Rietveld 408576698