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

Unified Diff: ui/chromeos/touch_exploration_controller.h

Issue 2007863004: Fix the double-tap to click gesture in touch accessibility mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO for second display Created 4 years, 7 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/accessibility/ax_enums.idl ('k') | ui/chromeos/touch_exploration_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/chromeos/touch_exploration_controller.h
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h
index 99aa7c10eedf66f2963742bbdc3da8278e3e49b6..a553ec6e4a3fe062769097232f68b3f2619c7c18 100644
--- a/ui/chromeos/touch_exploration_controller.h
+++ b/ui/chromeos/touch_exploration_controller.h
@@ -106,7 +106,8 @@ class TouchExplorationControllerDelegate {
// if the user releases their finger and taps before 300 ms passes.
// This will result in a click on the last successful touch exploration
// location. This allows the user to perform a single tap
-// anywhere to activate it.
+// anywhere to activate it. (See more information on simulated clicks
+// below.)
//
// The user can perform swipe gestures in one of the four cardinal directions
// which will be interpreted and used to control the UI. All gestures will only
@@ -117,20 +118,26 @@ class TouchExplorationControllerDelegate {
// completed within the grace period, the user must lift all fingers before
// completing any more actions.
//
-// If the user double-taps, the second tap is passed through, allowing the
-// user to click - however, the double-tap location is changed to the location
-// of the last successful touch exploration - that allows the user to explore
-// anywhere on the screen, hear its description, then double-tap anywhere
-// to activate it.
+// The user's initial tap sets the anchor point. Simulated events are
+// positioned relative to the anchor point, so that after exploring to find
+// an object the user can double-tap anywhere on the screen to activate it.
+// The anchor point is also set by ChromeVox every time it highlights an
+// object on the screen. During touch exploration this ensures that
+// any simulated events go to the center of the most recently highlighted
+// object, rather than to the exact tap location (which could have drifted
+// off of the object). This also ensures that when the current ChromeVox
+// object changes due to a gesture or input focus changing, simulated
+// events go to that object and not the last location touched by a finger.
//
-// If the user double taps and holds, any event from that finger is passed
-// through. These events are passed through with an offset such that the first
-// touch is offset to be at the location of the last touch exploration
-// location, and every following event is offset by the same amount.
+// When the user double-taps, this is treated as a discrete gestures, and
+// and event is sent to ChromeVox to activate the current object, whatever
+// that is. However, when the user double-taps and holds, any event from that
+// finger is passed through, allowing the user to drag. These events are
+// passed through with a location that's relative to the anchor point.
//
-// If any other fingers are added or removed, they are ignored. Once the
-// passthrough finger is released, passthrough stops and the user is reset
-// to no fingers down state.
+// If any other fingers are added or removed during a passthrough, they are
+// ignored. Once the passthrough finger is released, passthrough stops and
+// the state is reset to the no fingers down state.
//
// If the user enters touch exploration mode, they can click without lifting
// their touch exploration finger by tapping anywhere else on the screen with
@@ -178,6 +185,11 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
ui::TouchExplorationControllerDelegate* delegate);
~TouchExplorationController() override;
+ // Make synthesized touch events are anchored at this point. This is
+ // called when the object with accessibility focus is updated via something
+ // other than touch exploration.
+ void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point);
+
private:
friend class TouchExplorationControllerTestApi;
@@ -280,6 +292,8 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
void PlaySoundForTimer();
+ void SendSimulatedClick();
+
// Some constants used in touch_exploration_controller:
// Within this many dips of the screen edge, the release event generated will
@@ -384,6 +398,12 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
TWO_FINGER_TAP,
};
+ enum AnchorPointState {
+ ANCHOR_POINT_NONE,
+ ANCHOR_POINT_FROM_TOUCH_EXPLORATION,
+ ANCHOR_POINT_EXPLICITLY_SET
+ };
+
enum ScreenLocation {
// Hot "edges" of the screen are each represented by a respective bit.
NO_EDGE = 0,
@@ -442,8 +462,18 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// enters double-tap-hold passthrough, we need to update its location.)
std::unique_ptr<ui::TouchEvent> last_unused_finger_event_;
- // The last synthesized mouse move event. When the user double-taps,
- // we send the passed-through tap to the location of this event.
+ // The anchor point used as the location of a synthesized tap when the
+ // user double-taps anywhere on the screen, and similarly the initial
+ // point used when the user double-taps, holds, and drags. This can be
+ // set either via touch exploration, or by a call to
+ // SetTouchAccessibilityAnchorPoint when focus moves due to something other
+ // than touch exploration.
+ gfx::PointF anchor_point_;
+
+ // The current state of the anchor point.
+ AnchorPointState anchor_point_state_;
+
+ // The last touch exploration event.
std::unique_ptr<ui::TouchEvent> last_touch_exploration_;
// A timer that fires after the double-tap delay.
« no previous file with comments | « ui/accessibility/ax_enums.idl ('k') | ui/chromeos/touch_exploration_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698