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

Unified Diff: components/test_runner/text_input_controller.cc

Issue 2333813002: Introduce WebInputMethodController to blink (Closed)
Patch Set: Moved ConfirmCompositionBehavior to WebInputMethodController 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/text_input_controller.cc
diff --git a/components/test_runner/text_input_controller.cc b/components/test_runner/text_input_controller.cc
index c2241267b8bef72a4d07a80203a24516772ecfdc..50b3393c8f84775c5c0e943f30e3e49d5ade18bc 100644
--- a/components/test_runner/text_input_controller.cc
+++ b/components/test_runner/text_input_controller.cc
@@ -11,7 +11,9 @@
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
+#include "third_party/WebKit/public/web/WebFrameWidget.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
+#include "third_party/WebKit/public/web/WebInputMethodController.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebRange.h"
@@ -160,11 +162,11 @@ void TextInputController::Install(blink::WebLocalFrame* frame) {
}
void TextInputController::InsertText(const std::string& text) {
- view()->commitText(blink::WebString::fromUTF8(text), 0);
+ inputMethodController()->commitText(blink::WebString::fromUTF8(text), 0);
}
void TextInputController::UnmarkText() {
- view()->finishComposingText(blink::WebWidget::KeepSelection);
+ inputMethodController()->finishComposingText(blink::WebWidget::KeepSelection);
}
void TextInputController::DoCommand(const std::string& text) {
@@ -203,7 +205,8 @@ void TextInputController::SetMarkedText(const std::string& text,
underlines.push_back(underline);
}
- view()->setComposition(web_text, underlines, start, start + length);
+ inputMethodController()->setComposition(web_text, underlines, start,
+ start + length);
}
bool TextInputController::HasMarkedText() {
@@ -292,7 +295,7 @@ void TextInputController::SetComposition(const std::string& text) {
std::vector<blink::WebCompositionUnderline> underlines;
underlines.push_back(blink::WebCompositionUnderline(
0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT));
- view()->setComposition(
+ inputMethodController()->setComposition(
newText, blink::WebVector<blink::WebCompositionUnderline>(underlines),
textLength, textLength);
}
@@ -301,4 +304,13 @@ blink::WebView* TextInputController::view() {
return web_view_test_proxy_base_->web_view();
}
+blink::WebInputMethodController* TextInputController::inputMethodController() {
+ blink::WebLocalFrame* mainFrame = view()->mainFrame()->toWebLocalFrame();
+ if (!mainFrame) {
+ CHECK(false) << "WebView does not have a local main frame and"
+ " cannot handle input method controller tasks.";
+ }
+ return mainFrame->frameWidget()->getActiveWebInputMethodController();
+}
+
} // namespace test_runner

Powered by Google App Engine
This is Rietveld 408576698