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

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: Using the Old Logic for Determining the State Change Created 4 years, 9 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 6963b213ad3806a21bdf94826a1268a601d402f4..231a05b0da5fda116f1cb2accd02bef858f57aa5 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -462,10 +462,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),
@@ -1010,23 +1006,20 @@ 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() {
+ if (!GetInputMethod())
+ return;
+
+ RenderWidgetHostViewBase* focused_view = GetFocusedView();
+ const TextInputState* state = focused_view->text_input_state();
+
+ if (focused_view->ShouldProcessTextInputState()) {
EhsanK 2016/03/08 05:21:03 This function must only return true, and the code
+ cached_text_input_state_ = state;
+ GetInputMethod()->OnTextInputTypeChanged(this);
}
+
+ if (state->show_ime_if_needed && state->type != ui::TEXT_INPUT_TYPE_NONE)
EhsanK 2016/03/08 05:21:03 This one also will be called regardless of whether
+ GetInputMethod()->ShowImeIfNeeded();
}
void RenderWidgetHostViewAura::ImeCancelComposition() {
@@ -1659,7 +1652,7 @@ void RenderWidgetHostViewAura::ClearCompositionText() {
}
void RenderWidgetHostViewAura::InsertText(const base::string16& text) {
- DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE);
+ DCHECK(cached_text_input_state_->type != ui::TEXT_INPUT_TYPE_NONE);
// TODO(wjmaclean): can host_ ever be null?
if (host_)
host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false);
@@ -1682,19 +1675,19 @@ void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) {
}
ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
- return text_input_type_;
+ return cached_text_input_state_->type;
}
ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const {
- return text_input_mode_;
+ return cached_text_input_state_->mode;
}
int RenderWidgetHostViewAura::GetTextInputFlags() const {
- return text_input_flags_;
+ return cached_text_input_state_->flags;
}
bool RenderWidgetHostViewAura::CanComposeInline() const {
- return can_compose_inline_;
+ return cached_text_input_state_->can_compose_inline;
}
gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(

Powered by Google App Engine
This is Rietveld 408576698