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

Unified Diff: content/renderer/render_widget.cc

Issue 2522353002: Remove the CHECK in RenderWidget::GetInputMethodController (Closed)
Patch Set: Removing the override from WebFrameWidget Created 4 years, 1 month 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: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 2d27a73bd52c0b5f31f1ef5b3fdbee254a315783..7f8cd73f92dc13f9aa5b26cecc815fdae21c071d 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1532,7 +1532,8 @@ void RenderWidget::OnImeSetComposition(
if (!ShouldHandleImeEvent())
return;
ImeEventGuard guard(this);
- blink::WebInputMethodController* controller = GetInputMethodController();
+ blink::WebInputMethodController* controller =
+ GetWebWidget()->getActiveInputMethodController();
DCHECK(controller);
if (!controller ||
!controller->setComposition(
@@ -1565,7 +1566,7 @@ void RenderWidget::OnImeCommitText(const base::string16& text,
return;
ImeEventGuard guard(this);
input_handler_->set_handling_input_event(true);
- if (auto* controller = GetInputMethodController())
+ if (auto* controller = GetWebWidget()->getActiveInputMethodController())
controller->commitText(text, relative_cursor_pos);
input_handler_->set_handling_input_event(false);
UpdateCompositionInfo(false /* not an immediate request */);
@@ -1584,7 +1585,7 @@ void RenderWidget::OnImeFinishComposingText(bool keep_selection) {
return;
ImeEventGuard guard(this);
input_handler_->set_handling_input_event(true);
- if (auto* controller = GetInputMethodController()) {
+ if (auto* controller = GetWebWidget()->getActiveInputMethodController()) {
controller->finishComposingText(
keep_selection ? WebInputMethodController::KeepSelection
: WebInputMethodController::DoNotKeepSelection);
@@ -2137,7 +2138,8 @@ void RenderWidget::resetInputMethod() {
if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) {
// If a composition text exists, then we need to let the browser process
// to cancel the input method's ongoing composition session.
- blink::WebInputMethodController* controller = GetInputMethodController();
+ blink::WebInputMethodController* controller =
+ GetWebWidget()->getActiveInputMethodController();
if (controller &&
controller->finishComposingText(
WebInputMethodController::DoNotKeepSelection))
@@ -2303,13 +2305,4 @@ blink::WebWidget* RenderWidget::GetWebWidget() const {
return webwidget_internal_;
}
-blink::WebInputMethodController* RenderWidget::GetInputMethodController()
- const {
- // TODO(ekaramad): Remove this CHECK when GetWebWidget() is
- // always a WebFrameWidget.
- CHECK(GetWebWidget()->isWebFrameWidget());
- return static_cast<blink::WebFrameWidget*>(GetWebWidget())
- ->getActiveWebInputMethodController();
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698