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: content/renderer/render_widget.cc

Issue 2522353002: Remove the CHECK in RenderWidget::GetInputMethodController (Closed)
Patch Set: Addressing creis@'s comments + Removing unused forward dec. 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 637ad27559b658c23c9a6c38d8edf55d9d4391b8..4197454458a49d79744a78e7f5ec32eacc04f70d 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1535,7 +1535,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(
@@ -1568,7 +1569,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 */);
@@ -1587,7 +1588,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);
@@ -2140,7 +2141,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))
@@ -2306,13 +2308,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