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

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

Issue 2333813002: Introduce WebInputMethodController to blink (Closed)
Patch Set: Updated a comment Created 4 years, 2 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/web_widget_test_client.h" 5 #include "components/test_runner/web_widget_test_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "components/test_runner/mock_screen_orientation_client.h" 11 #include "components/test_runner/mock_screen_orientation_client.h"
12 #include "components/test_runner/test_interfaces.h" 12 #include "components/test_runner/test_interfaces.h"
13 #include "components/test_runner/test_runner.h" 13 #include "components/test_runner/test_runner.h"
14 #include "components/test_runner/test_runner_for_specific_view.h" 14 #include "components/test_runner/test_runner_for_specific_view.h"
15 #include "components/test_runner/web_test_delegate.h" 15 #include "components/test_runner/web_test_delegate.h"
16 #include "components/test_runner/web_view_test_proxy.h" 16 #include "components/test_runner/web_view_test_proxy.h"
17 #include "components/test_runner/web_widget_test_proxy.h" 17 #include "components/test_runner/web_widget_test_proxy.h"
18 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 18 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
19 #include "third_party/WebKit/public/web/WebFrameWidget.h"
20 #include "third_party/WebKit/public/web/WebInputMethodController.h"
21 #include "third_party/WebKit/public/web/WebLocalFrame.h"
19 #include "third_party/WebKit/public/web/WebPagePopup.h" 22 #include "third_party/WebKit/public/web/WebPagePopup.h"
23 #include "third_party/WebKit/public/web/WebView.h"
20 #include "third_party/WebKit/public/web/WebWidget.h" 24 #include "third_party/WebKit/public/web/WebWidget.h"
21 25
22 namespace test_runner { 26 namespace test_runner {
23 27
24 WebWidgetTestClient::WebWidgetTestClient( 28 WebWidgetTestClient::WebWidgetTestClient(
25 TestRunner* test_runner, 29 TestRunner* test_runner,
26 WebWidgetTestProxyBase* web_widget_test_proxy_base) 30 WebWidgetTestProxyBase* web_widget_test_proxy_base)
27 : test_runner_(test_runner), 31 : test_runner_(test_runner),
28 web_view_test_proxy_base_(nullptr), 32 web_view_test_proxy_base_(nullptr),
29 web_widget_test_proxy_base_(web_widget_test_proxy_base), 33 web_widget_test_proxy_base_(web_widget_test_proxy_base),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 bool WebWidgetTestClient::isPointerLocked() { 97 bool WebWidgetTestClient::isPointerLocked() {
94 return web_view_test_proxy_base_->view_test_runner()->isPointerLocked(); 98 return web_view_test_proxy_base_->view_test_runner()->isPointerLocked();
95 } 99 }
96 100
97 void WebWidgetTestClient::setToolTipText(const blink::WebString& text, 101 void WebWidgetTestClient::setToolTipText(const blink::WebString& text,
98 blink::WebTextDirection direction) { 102 blink::WebTextDirection direction) {
99 test_runner_->setToolTipText(text); 103 test_runner_->setToolTipText(text);
100 } 104 }
101 105
102 void WebWidgetTestClient::resetInputMethod() { 106 void WebWidgetTestClient::resetInputMethod() {
103 // If a composition text exists, then we need to let the browser process 107 // We should finish any ongoing composition.
104 // to cancel the input method's ongoing composition session. 108 blink::WebFrameWidget* frame_widget = nullptr;
105 if (web_widget_test_proxy_base_) 109 if (web_widget_test_proxy_base_ &&
106 web_widget_test_proxy_base_->web_widget()->finishComposingText( 110 web_widget_test_proxy_base_->web_widget()->isWebFrameWidget()) {
107 blink::WebWidget::KeepSelection); 111 frame_widget = static_cast<blink::WebFrameWidget*>(
112 web_widget_test_proxy_base_->web_widget());
113 } else if (web_view_test_proxy_base_) {
114 blink::WebLocalFrame* main_frame =
115 web_view_test_proxy_base_->web_view()->mainFrame()->toWebLocalFrame();
116 DCHECK(main_frame);
117 frame_widget = main_frame->frameWidget();
118 }
119
120 if (frame_widget && frame_widget->getActiveWebInputMethodController()) {
121 frame_widget->getActiveWebInputMethodController()->finishComposingText(
122 blink::WebInputMethodController::DoNotKeepSelection);
123 }
108 } 124 }
109 125
110 } // namespace test_runner 126 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698