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

Side by Side Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 2469983003: Trybot test for finishComposingText keeping style (Closed)
Patch Set: Delete and cancel Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return insertTextAndMoveCaret(text, relativeCaretPosition); 217 return insertTextAndMoveCaret(text, relativeCaretPosition);
218 } 218 }
219 219
220 bool InputMethodController::replaceComposition(const String& text) { 220 bool InputMethodController::replaceComposition(const String& text) {
221 if (!hasComposition()) 221 if (!hasComposition())
222 return false; 222 return false;
223 223
224 // If the composition was set from existing text and didn't change, then 224 // If the composition was set from existing text and didn't change, then
225 // there's nothing to do here (and we should avoid doing anything as that 225 // there's nothing to do here (and we should avoid doing anything as that
226 // may clobber multi-node styled text). 226 // may clobber multi-node styled text).
227 if (!m_isDirty && composingText() == text) { 227 if (!m_isDirty && composingText() == text) {
yabinh 2016/11/02 07:07:49 Delete and cancel. It will fire 2 "input.data:null
yabinh 2016/11/02 07:14:48 See the result of InputMethodControllerTest#Compos
228 TypingCommand::closeTyping(m_frame);
229 selectComposition();
230 TypingCommand::deleteSelection(*frame().document(), 0);
231
232 editor().lastEditCommand()->ensureComposition()->unapply();
233
228 clear(); 234 clear();
229 return true; 235 return true;
230 } 236 }
231 237
232 // Select the text that will be deleted or replaced. 238 // Select the text that will be deleted or replaced.
233 selectComposition(); 239 selectComposition();
234 240
235 if (frame().selection().isNone()) 241 if (frame().selection().isNone())
236 return false; 242 return false;
237 243
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 selectComposition(); 521 selectComposition();
516 522
517 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 523 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
518 // needs to be audited. see http://crbug.com/590369 for more details. 524 // needs to be audited. see http://crbug.com/590369 for more details.
519 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); 525 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
520 526
521 const PlainTextRange& selectedRange = createSelectionRangeForSetComposition( 527 const PlainTextRange& selectedRange = createSelectionRangeForSetComposition(
522 selectionStart, selectionEnd, text.length()); 528 selectionStart, selectionEnd, text.length());
523 // We shouldn't close typing in the middle of setComposition. 529 // We shouldn't close typing in the middle of setComposition.
524 setEditableSelectionOffsets(selectedRange, NotUserTriggered); 530 setEditableSelectionOffsets(selectedRange, NotUserTriggered);
525 m_isDirty = true;
526 } 531 }
527 532
528 void InputMethodController::setComposition( 533 void InputMethodController::setComposition(
529 const String& text, 534 const String& text,
530 const Vector<CompositionUnderline>& underlines, 535 const Vector<CompositionUnderline>& underlines,
531 int selectionStart, 536 int selectionStart,
532 int selectionEnd) { 537 int selectionEnd) {
533 Editor::RevealSelectionScope revealSelectionScope(&editor()); 538 Editor::RevealSelectionScope revealSelectionScope(&editor());
534 539
535 // Updates styles before setting selection for composition to prevent 540 // Updates styles before setting selection for composition to prevent
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1159
1155 return WebTextInputTypeNone; 1160 return WebTextInputTypeNone;
1156 } 1161 }
1157 1162
1158 DEFINE_TRACE(InputMethodController) { 1163 DEFINE_TRACE(InputMethodController) {
1159 visitor->trace(m_frame); 1164 visitor->trace(m_frame);
1160 visitor->trace(m_compositionRange); 1165 visitor->trace(m_compositionRange);
1161 } 1166 }
1162 1167
1163 } // namespace blink 1168 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698