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

Unified Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 29943002: Limit display of the virtual keyboard to state changes triggered from a user gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer feedback. Created 6 years, 11 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: ui/views/controls/textfield/native_textfield_views.cc
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index 5e42d9dc9c87412f4e4ee0ef20a43acacfcaf0e9..cd46c5681f863b172c6d07a80ef06d556f1a326a 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -166,6 +166,7 @@ void NativeTextfieldViews::OnGestureEvent(ui::GestureEvent* event) {
case ui::ET_GESTURE_TAP_DOWN:
OnBeforeUserAction();
textfield_->RequestFocus();
+ ShowImeIfNeeded();
// We don't deselect if the point is in the selection
// because TAP_DOWN may turn into a LONG_PRESS.
if (!GetRenderText()->IsPointInSelection(event->location()) &&
@@ -610,6 +611,10 @@ void NativeTextfieldViews::UpdateVerticalMargins() {
OnBoundsChanged(GetBounds());
}
+void NativeTextfieldViews::ShowImeIfNeeded() const {
+ GetInputMethod()->ShowImeIfNeeded();
+}
+
bool NativeTextfieldViews::IsIMEComposing() const {
return model_->HasCompositionText();
}
@@ -1444,8 +1449,10 @@ void NativeTextfieldViews::TrackMouseClicks(const ui::MouseEvent& event) {
}
void NativeTextfieldViews::HandleMousePressEvent(const ui::MouseEvent& event) {
- if (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())
+ if (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) {
textfield_->RequestFocus();
+ ShowImeIfNeeded();
+ }
if (!event.IsOnlyLeftMouseButton())
return;

Powered by Google App Engine
This is Rietveld 408576698