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

Unified Diff: components/test_runner/web_widget_test_client.cc

Issue 2333813002: Introduce WebInputMethodController to blink (Closed)
Patch Set: Replacing the angry copyright with the shorter one. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/test_runner/web_widget_test_client.cc
diff --git a/components/test_runner/web_widget_test_client.cc b/components/test_runner/web_widget_test_client.cc
index c38af4205d2721d2a65b6782e588728d8231df2a..f24c9f4235e2f2aa22e2990f665a4ba8785499e9 100644
--- a/components/test_runner/web_widget_test_client.cc
+++ b/components/test_runner/web_widget_test_client.cc
@@ -17,7 +17,11 @@
#include "components/test_runner/web_view_test_proxy.h"
#include "components/test_runner/web_widget_test_proxy.h"
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
+#include "third_party/WebKit/public/web/WebFrameWidget.h"
+#include "third_party/WebKit/public/web/WebInputMethodController.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPagePopup.h"
+#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebWidget.h"
namespace test_runner {
@@ -103,9 +107,22 @@ void WebWidgetTestClient::setToolTipText(const blink::WebString& text,
void WebWidgetTestClient::resetInputMethod() {
// If a composition text exists, then we need to let the browser process
// to cancel the input method's ongoing composition session.
- if (web_widget_test_proxy_base_)
- web_widget_test_proxy_base_->web_widget()->finishComposingText(
+ blink::WebFrameWidget* frame_widget = nullptr;
+ if (web_widget_test_proxy_base_ &&
+ web_widget_test_proxy_base_->web_widget()->isWebFrameWidget()) {
+ frame_widget = static_cast<blink::WebFrameWidget*>(
+ web_widget_test_proxy_base_->web_widget());
+ } else if (web_view_test_proxy_base_) {
+ blink::WebLocalFrame* main_frame =
+ web_view_test_proxy_base_->web_view()->mainFrame()->toWebLocalFrame();
+ DCHECK(main_frame);
+ frame_widget = mainFrame->frameWidget();
+ }
+
+ if (frame_widget && frame_widget->getActiveWebInputMethodController()) {
+ frame_widget->getActiveWebInputMethodController()->finishComposingText(
blink::WebWidget::KeepSelection);
+ }
}
} // namespace test_runner

Powered by Google App Engine
This is Rietveld 408576698