OLD | NEW |
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_delegate.h" | 8 #include "components/test_runner/web_test_delegate.h" |
9 #include "components/test_runner/web_view_test_proxy.h" | 9 #include "components/test_runner/web_view_test_proxy.h" |
10 #include "gin/arguments.h" | 10 #include "gin/arguments.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 view()->handleInputEvent(key_down); | 303 view()->handleInputEvent(key_down); |
304 | 304 |
305 // The value returned by std::string::length() may not correspond to the | 305 // The value returned by std::string::length() may not correspond to the |
306 // actual number of encoded characters in sequences of multi-byte or | 306 // actual number of encoded characters in sequences of multi-byte or |
307 // variable-length characters. | 307 // variable-length characters. |
308 blink::WebString newText = blink::WebString::fromUTF8(text); | 308 blink::WebString newText = blink::WebString::fromUTF8(text); |
309 size_t textLength = newText.length(); | 309 size_t textLength = newText.length(); |
310 | 310 |
311 std::vector<blink::WebCompositionUnderline> underlines; | 311 std::vector<blink::WebCompositionUnderline> underlines; |
312 underlines.push_back(blink::WebCompositionUnderline( | 312 underlines.push_back(blink::WebCompositionUnderline( |
313 0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT)); | 313 0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT, false)); |
314 if (auto* controller = GetInputMethodController()) { | 314 if (auto* controller = GetInputMethodController()) { |
315 controller->setComposition( | 315 controller->setComposition( |
316 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines), | 316 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines), |
317 textLength, textLength); | 317 textLength, textLength); |
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 void TextInputController::ForceTextInputStateUpdate() { | 321 void TextInputController::ForceTextInputStateUpdate() { |
322 web_view_test_proxy_base_->delegate()->ForceTextInputStateUpdate( | 322 web_view_test_proxy_base_->delegate()->ForceTextInputStateUpdate( |
323 view()->mainFrame()); | 323 view()->mainFrame()); |
(...skipping 10 matching lines...) Expand all Loading... |
334 | 334 |
335 blink::WebLocalFrame* mainFrame = view()->mainFrame()->toWebLocalFrame(); | 335 blink::WebLocalFrame* mainFrame = view()->mainFrame()->toWebLocalFrame(); |
336 if (!mainFrame) { | 336 if (!mainFrame) { |
337 CHECK(false) << "WebView does not have a local main frame and" | 337 CHECK(false) << "WebView does not have a local main frame and" |
338 " cannot handle input method controller tasks."; | 338 " cannot handle input method controller tasks."; |
339 } | 339 } |
340 return mainFrame->frameWidget()->getActiveWebInputMethodController(); | 340 return mainFrame->frameWidget()->getActiveWebInputMethodController(); |
341 } | 341 } |
342 | 342 |
343 } // namespace test_runner | 343 } // namespace test_runner |
OLD | NEW |