Index: content/renderer/render_widget.cc |
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
index 25475adaf5ae38f2b6f5dcd311ef7baa1957300b..22fa834432e08a4f8f9bf05e0c4ee9dc58421602 100644 |
--- a/content/renderer/render_widget.cc |
+++ b/content/renderer/render_widget.cc |
@@ -64,6 +64,7 @@ |
#include "third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h" |
#include "third_party/WebKit/public/web/WebDeviceEmulationParams.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/WebNode.h" |
#include "third_party/WebKit/public/web/WebPagePopup.h" |
@@ -106,6 +107,7 @@ using blink::WebDeviceEmulationParams; |
using blink::WebGestureEvent; |
using blink::WebInputEvent; |
using blink::WebInputEventResult; |
+using blink::WebInputMethodController; |
using blink::WebKeyboardEvent; |
using blink::WebMouseEvent; |
using blink::WebMouseWheelEvent; |
@@ -1414,7 +1416,9 @@ void RenderWidget::OnImeSetComposition( |
if (!ShouldHandleImeEvent()) |
return; |
ImeEventGuard guard(this); |
- if (!GetWebWidget()->setComposition( |
+ DCHECK(GetInputMethodController()); |
+ if (!GetInputMethodController() || |
dglazkov
2016/10/06 22:18:58
this can be inverted and done the same way as I su
EhsanK
2016/11/01 15:46:04
Acknowledged.
|
+ !GetInputMethodController()->setComposition( |
text, WebVector<WebCompositionUnderline>(underlines), selection_start, |
selection_end)) { |
// If we failed to set the composition text, then we need to let the browser |
@@ -1444,7 +1448,8 @@ void RenderWidget::OnImeCommitText(const base::string16& text, |
return; |
ImeEventGuard guard(this); |
input_handler_->set_handling_input_event(true); |
- GetWebWidget()->commitText(text, relative_cursor_pos); |
+ if (GetInputMethodController()) |
+ GetInputMethodController()->commitText(text, relative_cursor_pos); |
dglazkov
2016/10/06 22:18:58
if (auto* controller = GetInputMethodController())
EhsanK
2016/11/01 15:46:04
Acknowledged.
|
input_handler_->set_handling_input_event(false); |
UpdateCompositionInfo(false /* not an immediate request */); |
} |
@@ -1462,9 +1467,11 @@ void RenderWidget::OnImeFinishComposingText(bool keep_selection) { |
return; |
ImeEventGuard guard(this); |
input_handler_->set_handling_input_event(true); |
- GetWebWidget()->finishComposingText(keep_selection |
- ? WebWidget::KeepSelection |
- : WebWidget::DoNotKeepSelection); |
+ if (GetInputMethodController()) { |
dglazkov
2016/10/06 22:18:58
same here.
EhsanK
2016/11/01 15:46:04
Done.
|
+ GetInputMethodController()->finishComposingText( |
+ keep_selection ? WebInputMethodController::KeepSelection |
+ : WebInputMethodController::DoNotKeepSelection); |
+ } |
input_handler_->set_handling_input_event(false); |
UpdateCompositionInfo(false /* not an immediate request */); |
} |
@@ -2007,7 +2014,9 @@ void RenderWidget::resetInputMethod() { |
if (text_input_info_.type != blink::WebTextInputTypeNone) { |
// If a composition text exists, then we need to let the browser process |
// to cancel the input method's ongoing composition session. |
- if (GetWebWidget()->finishComposingText(WebWidget::DoNotKeepSelection)) |
+ if (GetInputMethodController() && |
dglazkov
2016/10/06 22:18:58
same here.
EhsanK
2016/11/01 15:46:04
Acknowledged.
|
+ GetInputMethodController()->finishComposingText( |
+ WebInputMethodController::DoNotKeepSelection)) |
Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
} |
@@ -2172,4 +2181,13 @@ blink::WebWidget* RenderWidget::GetWebWidget() const { |
return webwidget_internal_; |
} |
+blink::WebInputMethodController* RenderWidget::GetInputMethodController() |
+ const { |
+ // TODO(ekaramad): Will this DCHECK ever fire? Remove when GetWebWidget() is |
+ // always a WebFrameWidget. |
+ DCHECK(GetWebWidget()->isWebFrameWidget()); |
+ return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
+ ->getActiveWebInputMethodController(); |
+} |
+ |
} // namespace content |