diff options
author | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 04:15:55 +0000 |
---|---|---|
committer | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 04:15:55 +0000 |
commit | 6bf30d0a453f8647c63d261a2f603a2c3939566b (patch) | |
tree | 3e2969ee7debe447e7e0e32af851d567b754aeae | |
parent | d97626717c075142fb955b3e2429ca1c70332327 (diff) | |
download | chromium_src-6bf30d0a453f8647c63d261a2f603a2c3939566b.zip chromium_src-6bf30d0a453f8647c63d261a2f603a2c3939566b.tar.gz chromium_src-6bf30d0a453f8647c63d261a2f603a2c3939566b.tar.bz2 |
TextInputPanel (for on-screen keyboard input) on Windows 8 is crashy - disable it until better understood.
BUG=159616,131196
TEST=(from Issue 159616) On Windows 8, Start chrome, enable App Launcher in chrome://flags and relaunch,
try starting an app (repeat with a full relaunch a few times, since it is unpredictable).
Review URL: https://chromiumcodereview.appspot.com/11411081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168971 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 18 insertions, 117 deletions
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.h b/chrome/browser/ui/views/omnibox/omnibox_view_win.h index 7bcb9dc..d3e7a6f 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.h @@ -10,7 +10,6 @@ #include <atlcrack.h> #include <atlctrls.h> #include <atlmisc.h> -#include <peninputpanel.h> #include <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl. #include "base/memory/scoped_ptr.h" diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index dcc9f1a..28247bc 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -6,7 +6,6 @@ #include <algorithm> #include <map> -#include <peninputpanel_i.c> #include <stack> #include "base/bind.h" @@ -102,13 +101,6 @@ const int kDestroyCompositorHostWindowDelay = 10000; // of the border area, in percentage of the corresponding dimension. const int kMouseLockBorderPercentage = 15; -// We display the onscreen keyboard in the context of a WM_POINTERDOWN message. -// This context is reset in a delayed task. Theory being that the page should -// have enough time to change focus before this context is reset. -// TODO(ananta) -// Refine this. -const int kPointerDownContextResetDelay = 200; - // A callback function for EnumThreadWindows to enumerate and dismiss // any owned popup windows. BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { @@ -382,8 +374,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) touch_state_(new WebTouchState(this))), pointer_down_context_(false), last_touch_location_(-1, -1), - focus_on_editable_field_(false), - received_focus_change_after_pointer_down_(false), touch_events_enabled_(false), ALLOW_THIS_IN_INITIALIZER_LIST( gesture_recognizer_(ui::GestureRecognizer::Create(this))) { @@ -391,9 +381,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, - NOTIFICATION_FOCUS_CHANGED_IN_PAGE, - NotificationService::AllBrowserContextsAndSources()); } RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { @@ -404,21 +391,6 @@ RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { void RenderWidgetHostViewWin::CreateWnd(HWND parent) { // ATL function to create the window. Create(parent); - // Creating an instance of the text input panel is crashy. Will reenable this - // after investigation. - // TODO(ananta) -#if 0 - if (base::win::GetVersion() >= base::win::VERSION_WIN8 && - !base::win::IsMetroProcess()) { - virtual_keyboard_.CreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC); - if (virtual_keyboard_) { - virtual_keyboard_->put_AttachedEditWindow(m_hWnd); - virtual_keyboard_->SetInPlaceVisibility(FALSE); - } else { - NOTREACHED() << "Failed to create instance of pen input panel"; - } - } -#endif } /////////////////////////////////////////////////////////////////////////////// @@ -2310,30 +2282,22 @@ void RenderWidgetHostViewWin::Observe( int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED || - type == NOTIFICATION_FOCUS_CHANGED_IN_PAGE); - - if (type == NOTIFICATION_FOCUS_CHANGED_IN_PAGE) { - if (pointer_down_context_) - received_focus_change_after_pointer_down_ = true; - focus_on_editable_field_ = *Details<bool>(details).ptr(); - if (virtual_keyboard_) - DisplayOnScreenKeyboardIfNeeded(); - } else { - // Get the RenderProcessHost that posted this notification, and exit - // if it's not the one associated with this host view. - RenderProcessHost* render_process_host = - Source<RenderProcessHost>(source).ptr(); - DCHECK(render_process_host); - if (!render_widget_host_ || - render_process_host != render_widget_host_->GetProcess()) - return; - - // If it was our RenderProcessHost that posted the notification, - // clear the BrowserAccessibilityManager, because the renderer is - // dead and any accessibility information we have is now stale. - SetBrowserAccessibilityManager(NULL); + DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED); + + // Get the RenderProcessHost that posted this notification, and exit + // if it's not the one associated with this host view. + RenderProcessHost* render_process_host = + Source<RenderProcessHost>(source).ptr(); + DCHECK(render_process_host); + if (!render_widget_host_ || + render_process_host != render_widget_host_->GetProcess()) { + return; } + + // If it was our RenderProcessHost that posted the notification, + // clear the BrowserAccessibilityManager, because the renderer is + // dead and any accessibility information we have is now stale. + SetBrowserAccessibilityManager(NULL); } static void PaintCompositorHostWindow(HWND hWnd) { @@ -3018,25 +2982,4 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( return new RenderWidgetHostViewWin(widget); } -void RenderWidgetHostViewWin::DisplayOnScreenKeyboardIfNeeded() { - if (focus_on_editable_field_) { - if (pointer_down_context_) { - virtual_keyboard_->SetInPlaceVisibility(TRUE); - } - } else { - virtual_keyboard_->SetInPlaceVisibility(FALSE); - } -} - -void RenderWidgetHostViewWin::ResetPointerDownContext() { - // If the default focus on the page is on an edit field and we did not - // receive a focus change in the context of a pointer down message, it means - // that the pointer down message occurred on the edit field and we should - // display the on screen keyboard - if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) - DisplayOnScreenKeyboardIfNeeded(); - received_focus_change_after_pointer_down_ = false; - pointer_down_context_ = false; -} - } // namespace content diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h index 5f91667..c52b494 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.h +++ b/content/browser/renderer_host/render_widget_host_view_win.h @@ -9,7 +9,6 @@ #include <atlapp.h> #include <atlcrack.h> #include <atlmisc.h> -#include <peninputpanel.h> #include <vector> #include "base/compiler_specific.h" @@ -402,13 +401,6 @@ class RenderWidgetHostViewWin LRESULT OnReconvertString(RECONVERTSTRING* reconv); LRESULT OnQueryCharPosition(IMECHARPOSITION* position); - // Displays the on screen keyboard for editable fields. - void DisplayOnScreenKeyboardIfNeeded(); - - // Invoked in a delayed task to reset the fact that we are in the context of - // a WM_POINTERDOWN message. - void ResetPointerDownContext(); - // Sets the appropriate mode for raw-touches or gestures. Currently touch mode // will only take effect when kEnableTouchEvents is in effect (on Win7+). void UpdateDesiredTouchMode(); @@ -544,14 +536,9 @@ class RenderWidgetHostViewWin gfx::Rect caret_rect_; // TODO(ananta) - // The WM_POINTERDOWN and on screen keyboard handling related members should - // be moved to an independent class to reduce the clutter. This includes all - // members starting from virtual_keyboard_ to - // received_focus_change_after_pointer_down_. - - // ITextInputPanel to allow us to show the Windows virtual keyboard when a - // user touches an editable field on the page. - base::win::ScopedComPtr<ITextInputPanel> virtual_keyboard_; + // The WM_POINTERDOWN and touch related members should be moved to an + // independent class to reduce the clutter. This includes members + // pointer_down_context_ and last_touch_location_; // Set to true if we are in the context of a WM_POINTERDOWN message bool pointer_down_context_; @@ -561,12 +548,6 @@ class RenderWidgetHostViewWin // keyboard. Reset when the window loses focus. gfx::Point last_touch_location_; - // Set to true if the focus is currently on an editable field on the page. - bool focus_on_editable_field_; - - // Set to true if we received a focus change after a WM_POINTERDOWN message. - bool received_focus_change_after_pointer_down_; - // Region in which the view will be transparent to clicks. scoped_ptr<SkRegion> transparent_region_; diff --git a/ui/views/controls/textfield/native_textfield_win.cc b/ui/views/controls/textfield/native_textfield_win.cc index 85233c8..760ac53 100644 --- a/ui/views/controls/textfield/native_textfield_win.cc +++ b/ui/views/controls/textfield/native_textfield_win.cc @@ -130,13 +130,6 @@ NativeTextfieldWin::NativeTextfieldWin(Textfield* textfield) if (ole_interface) text_object_model_.QueryFrom(ole_interface); - if (base::win::GetVersion() >= base::win::VERSION_WIN8 && - !base::win::IsMetroProcess()) { - keyboard_.CreateInstance(__uuidof(TextInputPanel), NULL, CLSCTX_INPROC); - if (keyboard_ != NULL) - keyboard_->put_AttachedEditWindow(m_hWnd); - } - InitializeAccessibilityInfo(); } @@ -734,15 +727,6 @@ LRESULT NativeTextfieldWin::OnPointerDown(UINT message, WPARAM wparam, return 0; } -LRESULT NativeTextfieldWin::OnPointerUp(UINT message, WPARAM wparam, - LPARAM lparam) { - // ITextInputPanel is not supported on all platforms. NULL is fine. - if (keyboard_ != NULL) - keyboard_->SetInPlaceVisibility(TRUE); - SetMsgHandled(FALSE); - return 0; -} - void NativeTextfieldWin::OnKeyDown(TCHAR key, UINT repeat_count, UINT flags) { // NOTE: Annoyingly, ctrl-alt-<key> generates WM_KEYDOWN rather than // WM_SYSKEYDOWN, so we need to check (flags & KF_ALTDOWN) in various places diff --git a/ui/views/controls/textfield/native_textfield_win.h b/ui/views/controls/textfield/native_textfield_win.h index 313b238..bbe9477 100644 --- a/ui/views/controls/textfield/native_textfield_win.h +++ b/ui/views/controls/textfield/native_textfield_win.h @@ -11,7 +11,6 @@ #include <atlctrls.h> #include <atlmisc.h> #include <oleacc.h> -#include <peninputpanel.h> #include <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl #include <vsstyle.h> @@ -136,7 +135,6 @@ class NativeTextfieldWin MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeComposition) MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeEndComposition) MESSAGE_HANDLER_EX(WM_POINTERDOWN, OnPointerDown) - MESSAGE_HANDLER_EX(WM_POINTERUP, OnPointerUp) MSG_WM_KEYDOWN(OnKeyDown) MSG_WM_LBUTTONDBLCLK(OnLButtonDblClk) MSG_WM_LBUTTONDOWN(OnLButtonDown) @@ -202,7 +200,6 @@ class NativeTextfieldWin LRESULT OnImeComposition(UINT message, WPARAM wparam, LPARAM lparam); LRESULT OnImeEndComposition(UINT message, WPARAM wparam, LPARAM lparam); LRESULT OnPointerDown(UINT message, WPARAM wparam, LPARAM lparam); - LRESULT OnPointerUp(UINT message, WPARAM wparam, LPARAM lparam); void OnKeyDown(TCHAR key, UINT repeat_count, UINT flags); void OnLButtonDblClk(UINT keys, const CPoint& point); void OnLButtonDown(UINT keys, const CPoint& point); @@ -298,9 +295,6 @@ class NativeTextfieldWin // This interface is useful for accessing the CRichEditCtrl at a low level. mutable base::win::ScopedComPtr<ITextDocument> text_object_model_; - // To support the Windows virtual keyboard when used with a touch screen. - base::win::ScopedComPtr<ITextInputPanel> keyboard_; - // The position and the length of the ongoing composition string. // These values are used for removing a composition string from a search // text to emulate Firefox. |