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

Unified Diff: content/renderer/render_widget.cc

Issue 1249013005: Merge ViewHostMsg_TextInputTypeChanged and ViewHostMsg_TextInputStateChanged into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 5 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/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 16f9c2532ff45104833f48b8c10e6c6ae1863ddb..15df7a7915097f8d11a70325eb8243bf95b548f0 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1383,10 +1383,7 @@ void RenderWidget::WillBeginCompositorFrame() {
// The following two can result in further layout and possibly
// enable GPU acceleration so they need to be called before any painting
// is done.
- UpdateTextInputType();
-#if defined(OS_ANDROID)
UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME);
-#endif
UpdateSelectionBounds();
}
@@ -1918,37 +1915,6 @@ void RenderWidget::FinishHandlingImeEvent() {
#endif
}
-void RenderWidget::UpdateTextInputType() {
- TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputType");
- ui::TextInputType new_type = GetTextInputType();
- if (IsDateTimeInput(new_type))
- return; // Not considered as a text input field in WebKit/Chromium.
-
- bool new_can_compose_inline = CanComposeInline();
-
- blink::WebTextInputInfo new_info;
- if (webwidget_)
- new_info = webwidget_->textInputInfo();
- const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode);
- int new_flags = new_info.flags;
-
- if (text_input_type_ != new_type
- || can_compose_inline_ != new_can_compose_inline
- || text_input_mode_ != new_mode
- || text_input_flags_ != new_flags) {
- Send(new ViewHostMsg_TextInputTypeChanged(routing_id(),
- new_type,
- new_mode,
- new_can_compose_inline,
- new_flags));
- text_input_type_ = new_type;
- can_compose_inline_ = new_can_compose_inline;
- text_input_mode_ = new_mode;
- text_input_flags_ = new_flags;
- }
-}
-
-#if defined(OS_ANDROID) || defined(USE_AURA)
void RenderWidget::UpdateTextInputState(ShowIme show_ime,
ChangeSource change_source) {
TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState");
@@ -1961,6 +1927,7 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
blink::WebTextInputInfo new_info;
if (webwidget_)
new_info = webwidget_->textInputInfo();
+ const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode);
bool new_can_compose_inline = CanComposeInline();
@@ -1968,6 +1935,7 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
// shown.
if (show_ime == SHOW_IME_IF_NEEDED ||
(text_input_type_ != new_type ||
+ text_input_mode_ != new_mode ||
text_input_info_ != new_info ||
can_compose_inline_ != new_can_compose_inline)
#if defined(OS_ANDROID)
@@ -1976,6 +1944,7 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
) {
ViewHostMsg_TextInputState_Params p;
nasko 2015/07/29 17:41:08 nit: s/p/params/
Shu Chen 2015/07/30 00:47:22 Done.
p.type = new_type;
+ p.mode = new_mode;
p.flags = new_info.flags;
p.value = new_info.value.utf8();
p.selection_start = new_info.selectionStart;
@@ -1994,22 +1963,15 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
IncrementOutstandingImeEventAcks();
text_field_is_dirty_ = false;
#endif
-#if defined(USE_AURA)
- Send(new ViewHostMsg_TextInputTypeChanged(routing_id(),
- new_type,
- text_input_mode_,
- new_can_compose_inline,
- new_info.flags));
-#endif
Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p));
text_input_info_ = new_info;
text_input_type_ = new_type;
+ text_input_mode_ = new_mode;
can_compose_inline_ = new_can_compose_inline;
text_input_flags_ = new_info.flags;
}
}
-#endif
void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) {
WebRect focus_webrect;

Powered by Google App Engine
This is Rietveld 408576698