| Index: content/renderer/render_widget.cc
|
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
|
| index d4097830ae789584c4dbbaf26709ef67d0019a18..f68f9899105c4414445e63e209d1289b63f42d78 100644
|
| --- a/content/renderer/render_widget.cc
|
| +++ b/content/renderer/render_widget.cc
|
| @@ -63,6 +63,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"
|
| @@ -101,6 +102,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;
|
| @@ -1400,7 +1402,9 @@ void RenderWidget::OnImeSetComposition(
|
| if (!ShouldHandleImeEvent())
|
| return;
|
| ImeEventGuard guard(this);
|
| - if (!GetWebWidget()->setComposition(
|
| + DCHECK(GetInputMethodController());
|
| + if (!GetInputMethodController() ||
|
| + !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
|
| @@ -1430,7 +1434,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);
|
| input_handler_->set_handling_input_event(false);
|
| UpdateCompositionInfo(false /* not an immediate request */);
|
| }
|
| @@ -1448,9 +1453,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()) {
|
| + GetInputMethodController()->finishComposingText(
|
| + keep_selection ? WebInputMethodController::KeepSelection
|
| + : WebInputMethodController::DoNotKeepSelection);
|
| + }
|
| input_handler_->set_handling_input_event(false);
|
| UpdateCompositionInfo(false /* not an immediate request */);
|
| }
|
| @@ -1980,7 +1987,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() &&
|
| + GetInputMethodController()->finishComposingText(
|
| + WebInputMethodController::DoNotKeepSelection))
|
| Send(new InputHostMsg_ImeCancelComposition(routing_id()));
|
| }
|
|
|
| @@ -2155,4 +2164,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
|
|
|