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

Unified Diff: content/renderer/render_widget.cc

Issue 2445383003: Revert "Simplify handling of text input types in RenderWidget." (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index b4be9c3755e6ea17824202a93bbb7134de90eaea..a88f17283c454800546b416e000d4d037a87add5 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -191,6 +191,14 @@ ui::TextInputMode ConvertInputMode(const blink::WebString& input_mode) {
return it->second;
}
+bool IsDateTimeInput(ui::TextInputType type) {
+ return type == ui::TEXT_INPUT_TYPE_DATE ||
+ type == ui::TEXT_INPUT_TYPE_DATE_TIME ||
+ type == ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL ||
+ type == ui::TEXT_INPUT_TYPE_MONTH ||
+ type == ui::TEXT_INPUT_TYPE_TIME || type == ui::TEXT_INPUT_TYPE_WEEK;
+}
+
content::RenderWidgetInputHandlerDelegate* GetRenderWidgetInputHandlerDelegate(
content::RenderWidget* widget) {
#if defined(USE_AURA)
@@ -244,6 +252,7 @@ RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
host_closing_(false),
is_swapped_out_(swapped_out),
for_oopif_(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),
@@ -954,11 +963,13 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
return;
}
- if (!GetWebWidget())
- return;
-
- blink::WebTextInputInfo new_info = GetWebWidget()->textInputInfo();
+ ui::TextInputType new_type = GetTextInputType();
+ if (IsDateTimeInput(new_type))
+ return; // Not considered as a text input field in WebKit/Chromium.
+ blink::WebTextInputInfo new_info;
+ if (GetWebWidget())
+ new_info = GetWebWidget()->textInputInfo();
const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode);
bool new_can_compose_inline = CanComposeInline();
@@ -967,14 +978,15 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
// shown.
if (show_ime == ShowIme::IF_NEEDED ||
(IsUsingImeThread() && change_source == ChangeSource::FROM_IME) ||
- (text_input_mode_ != new_mode || text_input_info_ != new_info ||
+ (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)
|| text_field_is_dirty_
#endif
) {
TextInputState params;
- params.type = WebKitToUiTextInputType(new_info.type);
+ params.type = new_type;
params.mode = new_mode;
params.flags = new_info.flags;
params.value = new_info.value.utf8();
@@ -998,6 +1010,7 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params));
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;
@@ -2031,7 +2044,7 @@ void RenderWidget::resetInputMethod() {
ImeEventGuard guard(this);
// If the last text input type is not None, then we should finish any
// ongoing composition regardless of the new text input type.
- if (text_input_info_.type != blink::WebTextInputTypeNone) {
+ 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.
if (GetWebWidget()->finishComposingText(WebWidget::DoNotKeepSelection))
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698