diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-14 23:30:07 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-14 23:30:07 +0000 |
commit | 92f82ede0e6e397bfb2c4288232c31526a4810fc (patch) | |
tree | 33f325396b1786fcfad00701fa38b8ecbfa82133 /ui/views/controls/textfield | |
parent | 9bb5a525fcb2fc5fa24cb412ed0a425c9f82cfce (diff) | |
download | chromium_src-92f82ede0e6e397bfb2c4288232c31526a4810fc.zip chromium_src-92f82ede0e6e397bfb2c4288232c31526a4810fc.tar.gz chromium_src-92f82ede0e6e397bfb2c4288232c31526a4810fc.tar.bz2 |
Display the on screen keyboard on receiving a tap down gesture on an editable text field
in AURA/ASH Windows.
This is achieved by calling the DisplayVirtualKeyboard helper function in base\win_util.
This function will be a no op on Windows 7 and below.
BUG=166516
R=sky
Review URL: https://codereview.chromium.org/12256034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/textfield')
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.cc | 23 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.h | 3 |
2 files changed, 21 insertions, 5 deletions
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index d9c4348..08ba3ff 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -45,6 +45,10 @@ #include "ui/base/cursor/cursor.h" #endif +#if defined(OS_WIN) && defined(USE_AURA) +#include "base/win/win_util.h" +#endif + namespace { // Default "system" color for text cursor. @@ -157,22 +161,23 @@ void NativeTextfieldViews::OnGestureEvent(ui::GestureEvent* event) { SchedulePaint(); OnAfterUserAction(); event->SetHandled(); - return; + break; case ui::ET_GESTURE_DOUBLE_TAP: SelectAll(false); event->SetHandled(); - return; + break; case ui::ET_GESTURE_SCROLL_UPDATE: OnBeforeUserAction(); if (MoveCursorTo(event->location(), true)) SchedulePaint(); OnAfterUserAction(); event->SetHandled(); - return; - default: break; + default: + View::OnGestureEvent(event); + return; } - View::OnGestureEvent(event); + PlatformGestureEventHandling(event); } bool NativeTextfieldViews::OnKeyPressed(const ui::KeyEvent& event) { @@ -1317,4 +1322,12 @@ bool NativeTextfieldViews::ShouldInsertChar(char16 ch, int flags) { (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; } +void NativeTextfieldViews::PlatformGestureEventHandling( + const ui::GestureEvent* event) { +#if defined(OS_WIN) && defined(USE_AURA) + if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) + base::win::DisplayVirtualKeyboard(); +#endif +} + } // namespace views diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h index 166d9bb..b9a0a73 100644 --- a/ui/views/controls/textfield/native_textfield_views.h +++ b/ui/views/controls/textfield/native_textfield_views.h @@ -272,6 +272,9 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, // modified character, i.e., modifiers took effect when generating this char. static bool ShouldInsertChar(char16 ch, int flags); + // Platform specific gesture event handling. + void PlatformGestureEventHandling(const ui::GestureEvent* event); + // The parent textfield, the owner of this object. Textfield* textfield_; |