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

Unified Diff: content/renderer/render_widget.cc

Issue 2285923002: Simplify handling of text input types in RenderWidget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the glitch. Created 4 years, 4 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 cb2afbcc623807384a97bb66e7a6fb376251af6d..296485b2c653ce2525404d2076448da3c62d8c9e 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -187,14 +187,6 @@ 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)
@@ -241,7 +233,6 @@ 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),
@@ -907,13 +898,11 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
return;
}
- ui::TextInputType new_type = GetTextInputType();
- if (IsDateTimeInput(new_type))
- return; // Not considered as a text input field in WebKit/Chromium.
+ if (!webwidget_)
+ return;
+
+ blink::WebTextInputInfo new_info = webwidget_->textInputInfo();
- 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();
@@ -922,15 +911,14 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
// shown.
if (show_ime == ShowIme::IF_NEEDED ||
(IsUsingImeThread() && change_source == ChangeSource::FROM_IME) ||
- (text_input_type_ != new_type || text_input_mode_ != new_mode ||
- text_input_info_ != new_info ||
+ (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 = new_type;
+ params.type = WebKitToUiTextInputType(new_info.type);
params.mode = new_mode;
params.flags = new_info.flags;
params.value = new_info.value.utf8();
@@ -953,7 +941,6 @@ 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;
@@ -1898,7 +1885,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_type_ != ui::TEXT_INPUT_TYPE_NONE) {
+ if (text_input_info_.type != blink::WebTextInputTypeNone) {
// If a composition text exists, then we need to let the browser process
// to cancel the input method's ongoing composition session.
if (webwidget_->confirmComposition())
« 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