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

Unified Diff: ui/views/controls/textfield/textfield.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: Fix ash_unittests 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
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/ime/input_method.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 5f3d119a53a85e892b1f57ba758f3001a42dfc17..88d4c1e334c9b1c05e8d4cbf7a416134b9a7ff1a 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -230,6 +230,10 @@ base::string16 Textfield::GetPlaceholderText() const {
return placeholder_text_;
}
+void Textfield::ShowImeIfNeeded() {
+ GetInputMethod()->ShowImeIfNeeded();
+}
+
bool Textfield::IsIMEComposing() const {
return model_->HasCompositionText();
}
@@ -463,8 +467,10 @@ bool Textfield::OnMousePressed(const ui::MouseEvent& event) {
TrackMouseClicks(event);
if (!controller_ || !controller_->HandleMouseEvent(this, event)) {
- if (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())
+ if (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) {
RequestFocus();
+ ShowImeIfNeeded();
+ }
if (event.IsOnlyLeftMouseButton()) {
initiating_drag_ = false;
@@ -634,6 +640,8 @@ void Textfield::OnGestureEvent(ui::GestureEvent* event) {
case ui::ET_GESTURE_TAP_DOWN:
OnBeforeUserAction();
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()) &&
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/ime/input_method.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698