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

Side by Side Diff: components/test_runner/text_input_controller.cc

Issue 2020973002: Reland: Fix setComposingText with empty text when newCursorPosition != 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For multi-code text Created 4 years, 6 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
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/test_runner/text_input_controller.h" 5 #include "components/test_runner/text_input_controller.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "components/test_runner/web_test_proxy.h" 8 #include "components/test_runner/web_test_proxy.h"
9 #include "gin/arguments.h" 9 #include "gin/arguments.h"
10 #include "gin/handle.h" 10 #include "gin/handle.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void TextInputController::SetComposition(const std::string& text) { 250 void TextInputController::SetComposition(const std::string& text) {
251 // Sends a keydown event with key code = 0xE5 to emulate input method 251 // Sends a keydown event with key code = 0xE5 to emulate input method
252 // behavior. 252 // behavior.
253 blink::WebKeyboardEvent key_down; 253 blink::WebKeyboardEvent key_down;
254 key_down.type = blink::WebInputEvent::RawKeyDown; 254 key_down.type = blink::WebInputEvent::RawKeyDown;
255 key_down.modifiers = 0; 255 key_down.modifiers = 0;
256 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY 256 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY
257 key_down.setKeyIdentifierFromWindowsKeyCode(); 257 key_down.setKeyIdentifierFromWindowsKeyCode();
258 view()->handleInputEvent(key_down); 258 view()->handleInputEvent(key_down);
259 259
260 // The value returned by std::string::length() may not correspond to the
261 // actual number of encoded characters in sequences of multi-byte or
262 // variable-length characters.
yabinh 2016/06/17 06:15:10 Some test will fail because of this bug, like: ht
263 blink::WebString newText = blink::WebString::fromUTF8(text);
264 size_t textLength = base::string16(newText).length();
265
260 std::vector<blink::WebCompositionUnderline> underlines; 266 std::vector<blink::WebCompositionUnderline> underlines;
261 underlines.push_back(blink::WebCompositionUnderline(0, text.length(), 267 underlines.push_back(blink::WebCompositionUnderline(
262 SK_ColorBLACK, false, 268 0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT));
263 SK_ColorTRANSPARENT));
264 view()->setComposition( 269 view()->setComposition(
265 blink::WebString::fromUTF8(text), 270 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines),
266 blink::WebVector<blink::WebCompositionUnderline>(underlines), 271 textLength, textLength);
267 text.length(), text.length());
268 } 272 }
269 273
270 blink::WebView* TextInputController::view() { 274 blink::WebView* TextInputController::view() {
271 return web_test_proxy_base_->web_view(); 275 return web_test_proxy_base_->web_view();
272 } 276 }
273 277
274 } // namespace test_runner 278 } // namespace test_runner
OLDNEW
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698