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

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

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: 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
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_view_test_proxy.h" 8 #include "components/test_runner/web_view_test_proxy.h"
9 #include "gin/arguments.h" 9 #include "gin/arguments.h"
10 #include "gin/handle.h" 10 #include "gin/handle.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return int_array; 274 return int_array;
275 } 275 }
276 276
277 void TextInputController::SetComposition(const std::string& text) { 277 void TextInputController::SetComposition(const std::string& text) {
278 // Sends a keydown event with key code = 0xE5 to emulate input method 278 // Sends a keydown event with key code = 0xE5 to emulate input method
279 // behavior. 279 // behavior.
280 blink::WebKeyboardEvent key_down; 280 blink::WebKeyboardEvent key_down;
281 key_down.type = blink::WebInputEvent::RawKeyDown; 281 key_down.type = blink::WebInputEvent::RawKeyDown;
282 key_down.modifiers = 0; 282 key_down.modifiers = 0;
283 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY 283 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY
284 view()->handleInputEvent(key_down); 284 view()->handleInputEvent(key_down,
285 std::vector<const blink::WebInputEvent*>());
285 286
286 // The value returned by std::string::length() may not correspond to the 287 // The value returned by std::string::length() may not correspond to the
287 // actual number of encoded characters in sequences of multi-byte or 288 // actual number of encoded characters in sequences of multi-byte or
288 // variable-length characters. 289 // variable-length characters.
289 blink::WebString newText = blink::WebString::fromUTF8(text); 290 blink::WebString newText = blink::WebString::fromUTF8(text);
290 size_t textLength = newText.length(); 291 size_t textLength = newText.length();
291 292
292 std::vector<blink::WebCompositionUnderline> underlines; 293 std::vector<blink::WebCompositionUnderline> underlines;
293 underlines.push_back(blink::WebCompositionUnderline( 294 underlines.push_back(blink::WebCompositionUnderline(
294 0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT)); 295 0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT));
295 view()->setComposition( 296 view()->setComposition(
296 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines), 297 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines),
297 textLength, textLength); 298 textLength, textLength);
298 } 299 }
299 300
300 blink::WebView* TextInputController::view() { 301 blink::WebView* TextInputController::view() {
301 return web_view_test_proxy_base_->web_view(); 302 return web_view_test_proxy_base_->web_view();
302 } 303 }
303 304
304 } // namespace test_runner 305 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698