summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authortdanderson@google.com <tdanderson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-16 19:44:01 +0000
committertdanderson@google.com <tdanderson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-16 19:44:01 +0000
commit2fe2c58fc3abbe2a556dc4824e094d71c567adf5 (patch)
tree83d34785a905a9b23692b3804a3ed9c34ec3e484 /ui
parentc05a6d22e32698902910edae7561b94bb4886d23 (diff)
downloadchromium_src-2fe2c58fc3abbe2a556dc4824e094d71c567adf5.zip
chromium_src-2fe2c58fc3abbe2a556dc4824e094d71c567adf5.tar.gz
chromium_src-2fe2c58fc3abbe2a556dc4824e094d71c567adf5.tar.bz2
Invoke cursor-hiding logic on touch for Windows
Continue to invoke cursor-hiding logic on touch for Windows even though the OS hides the cursor for us. The reason is that this code path is needed in order to call RenderWidgetHostViewAura:: NotifyRendererOfCursorVisibilityState() in order for the renderer to know to suppress generation of synthetic mousemove events while touch scrolling. This avoids unwanted hover effects from being invoked when the cursor is not visible. To avoid regressions in behavior (such as the one mentioned in https://codereview.chromium.org/56053004), make the cursor state global among all root windows. This is done in https://codereview.chromium.org/111043002/. BUG=322250 TEST=To be added later (crbug.com/328549) R=sky@chromium.org Review URL: https://codereview.chromium.org/82463002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/corewm/compound_event_filter.cc8
-rw-r--r--ui/views/corewm/compound_event_filter_unittest.cc9
2 files changed, 10 insertions, 7 deletions
diff --git a/ui/views/corewm/compound_event_filter.cc b/ui/views/corewm/compound_event_filter.cc
index efeca5c..f5fa2a4 100644
--- a/ui/views/corewm/compound_event_filter.cc
+++ b/ui/views/corewm/compound_event_filter.cc
@@ -72,12 +72,12 @@ bool ShouldHideCursorOnKeyEvent(const ui::KeyEvent& event) {
// Returns true if the cursor should be hidden on touch events.
bool ShouldHideCursorOnTouch() {
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
return true;
#else
- // Not necessary on windows as windows does it for us. If we do need this
- // funcionality on linux (non-chromeos) we need to make sure
- // CompoundEventFilter shows on the right root (it currently doesn't always).
+ // Linux Aura does not hide the cursor on touch by default.
+ // TODO(tdanderson): Change this if having consistency across
+ // all platforms which use Aura is desired.
return false;
#endif
}
diff --git a/ui/views/corewm/compound_event_filter_unittest.cc b/ui/views/corewm/compound_event_filter_unittest.cc
index 6b852e4..293e2d3 100644
--- a/ui/views/corewm/compound_event_filter_unittest.cc
+++ b/ui/views/corewm/compound_event_filter_unittest.cc
@@ -18,11 +18,11 @@
namespace {
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
base::TimeDelta GetTime() {
return ui::EventTimeForNow();
}
-#endif // defined(OS_CHROMEOS)
+#endif // defined(OS_CHROMEOS) || defined(OS_WIN)
}
@@ -97,7 +97,10 @@ TEST_F(CompoundEventFilterTest, CursorVisibilityChange) {
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit);
EXPECT_FALSE(cursor_client.IsCursorVisible());
}
+#endif // defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
+// Touch only hides the cursor on ChromeOS and Windows (crbug.com/322250).
TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
@@ -145,7 +148,7 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
}
-#endif // defined(OS_CHROMEOS)
+#endif // defined(OS_CHROMEOS) || defined(OS_WIN)
// Tests that if an event filter consumes a gesture, then it doesn't focus the
// window.