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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Comments and Fixing Compile Errors Created 4 years, 10 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: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index d06fde40a5576d801c9d86386f99a1ca76309f37..6f4e093ac3d95af0413da2f5402a73d511999b7f 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -461,10 +461,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
popup_parent_host_view_(NULL),
popup_child_host_view_(NULL),
is_loading_(false),
- text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
- text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
- text_input_flags_(0),
- can_compose_inline_(true),
has_composition_text_(false),
accept_return_character_(false),
last_swapped_software_frame_scale_factor_(1.f),
@@ -1007,23 +1003,17 @@ void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
UpdateCursorIfOverSelf();
}
-void RenderWidgetHostViewAura::TextInputStateChanged(
- const ViewHostMsg_TextInputState_Params& params) {
- if (text_input_type_ != params.type ||
- text_input_mode_ != params.mode ||
- can_compose_inline_ != params.can_compose_inline ||
- text_input_flags_ != params.flags) {
- text_input_type_ = params.type;
- text_input_mode_ = params.mode;
- can_compose_inline_ = params.can_compose_inline;
- text_input_flags_ = params.flags;
- if (GetInputMethod())
- GetInputMethod()->OnTextInputTypeChanged(this);
- }
- if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) {
- if (GetInputMethod())
- GetInputMethod()->ShowImeIfNeeded();
- }
+void RenderWidgetHostViewAura::UpdateTextInputState() {
+ RenderWidgetHostViewBase::UpdateTextInputState();
+
+ if (!GetInputMethod())
+ return;
+
+ GetInputMethod()->OnTextInputTypeChanged(this);
+
+ const TextInputState* state = current_text_input_state();
+ if (state->show_ime_if_needed && state->type != ui::TEXT_INPUT_TYPE_NONE)
+ GetInputMethod()->ShowImeIfNeeded();
}
void RenderWidgetHostViewAura::ImeCancelComposition() {
@@ -1646,7 +1636,7 @@ void RenderWidgetHostViewAura::ClearCompositionText() {
}
void RenderWidgetHostViewAura::InsertText(const base::string16& text) {
- DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE);
+ DCHECK(current_text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE);
if (host_)
host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false);
has_composition_text_ = false;
@@ -1667,19 +1657,19 @@ void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) {
}
ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
- return text_input_type_;
+ return current_text_input_state()->type;
}
ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const {
- return text_input_mode_;
+ return current_text_input_state()->mode;
}
int RenderWidgetHostViewAura::GetTextInputFlags() const {
- return text_input_flags_;
+ return current_text_input_state()->flags;
}
bool RenderWidgetHostViewAura::CanComposeInline() const {
- return can_compose_inline_;
+ return current_text_input_state()->can_compose_inline;
}
gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(

Powered by Google App Engine
This is Rietveld 408576698