#include "ui/events/gesture_detection/gesture_detector.h"
#include "ui/events/gesture_detection/scale_gesture_detector.h"
#include "ui/events/gesture_detection/snap_scroll_controller.h"
+#include "ui/gfx/display.h"
namespace ui {
struct GESTURE_DETECTION_EXPORT Config {
Config();
~Config();
+ gfx::Display display;
GestureDetector::Config gesture_detector_config;
ScaleGestureDetector::Config scale_gesture_detector_config;
- SnapScrollController::Config snap_scroll_controller_config;
+
+ // If |disable_click_delay| is true and double-tap support is disabled,
+ // there will be no delay before tap events. When double-tap support is
+ // enabled, there will always be a delay before a tap event is fired, in
+ // order to allow the double tap gesture to occur without firing any tap
+ // events.
bool disable_click_delay;
+
+ // If |gesture_begin_end_types_enabled| is true, fire an ET_GESTURE_BEGIN
+ // event for every added touch point, and an ET_GESTURE_END event for every
+ // removed touch point. Defaults to false.
+ bool gesture_begin_end_types_enabled;
};
GestureProvider(const Config& config, GestureProviderClient* client);
// be handled.
bool OnTouchEvent(const MotionEvent& event);
- // Resets all gesture detectors; called on DidStartLoading().
- void ResetGestureDetectors();
+ // Update whether multi-touch pinch zoom is supported by the platform.
+ void SetMultiTouchZoomSupportEnabled(bool enabled);
- // Update whether multi-touch gestures are supported.
- void SetMultiTouchSupportEnabled(bool enabled);
-
- // Update whether double-tap gestures are supported. This allows
- // double-tap gesture suppression independent of whether or not the page's
- // viewport and scale would normally prevent double-tap.
- // Note: This should not be called while a double-tap gesture is in progress.
+ // Update whether double-tap gestures are supported by the platform.
void SetDoubleTapSupportForPlatformEnabled(bool enabled);
- // Update whether double-tap gesture detection should be suppressed due to
- // the viewport or scale of the current page. Suppressing double-tap gesture
- // detection allows for rapid and responsive single-tap gestures.
+ // Update whether double-tap gesture detection should be suppressed, e.g.,
+ // if the page scale is fixed or the page has a mobile viewport. This disables
+ // the tap delay, allowing rapid and responsive single-tap gestures.
void SetDoubleTapSupportForPageEnabled(bool enabled);
// Whether a scroll gesture is in-progress.
// forwarded and detection is still active).
bool IsPinchInProgress() const;
- // Whether a double tap-gesture is in-progress.
+ // Whether a double-tap gesture is in-progress (either double-tap or
+ // double-tap drag zoom).
bool IsDoubleTapInProgress() const;
- // Whether the tap gesture delay is explicitly disabled (independent of
- // whether double-tap is supported), see |Config.disable_click_delay|.
- bool IsClickDelayDisabled() const;
-
// May be NULL if there is no currently active touch sequence.
const ui::MotionEvent* current_down_event() const {
return current_down_event_.get();
bool CanHandle(const MotionEvent& event) const;
- void Fling(base::TimeTicks time,
- float x,
- float y,
- float velocity_x,
- float velocity_y);
+ void Fling(const MotionEvent& e, float velocity_x, float velocity_y);
void Send(const GestureEventData& gesture);
- void SendTapCancelIfNecessary(const MotionEvent& event);
bool SendLongTapIfNecessary(const MotionEvent& event);
- void EndTouchScrollIfNecessary(base::TimeTicks time,
+ void EndTouchScrollIfNecessary(const MotionEvent& event,
bool send_scroll_end_event);
+ void OnTouchEventHandlingBegin(const MotionEvent& event);
+ void OnTouchEventHandlingEnd(const MotionEvent& event);
+ void UpdateDoubleTapDetectionSupport();
GestureProviderClient* const client_;
scoped_ptr<MotionEvent> current_down_event_;
- // Whether a GESTURE_SHOW_PRESS was sent for the current touch sequence.
- // Sending a GESTURE_TAP event will forward a GESTURE_SHOW_PRESS if one has
- // not yet been sent.
- bool needs_show_press_event_;
-
- // Whether a sent GESTURE_TAP_DOWN event has yet to be accompanied by a
- // corresponding GESTURE_TAP, GESTURE_TAP_CANCEL or GESTURE_DOUBLE_TAP.
- bool needs_tap_ending_event_;
-
// Whether the respective {SCROLL,PINCH}_BEGIN gestures have been terminated
// with a {SCROLL,PINCH}_END.
bool touch_scroll_in_progress_;
bool pinch_in_progress_;
+ // Whether double-tap gesture detection is currently supported.
+ bool double_tap_support_for_page_;
+ bool double_tap_support_for_platform_;
+
// Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is
// opened after a GESTURE_LONG_PRESS, this is used to insert a
// GESTURE_TAP_CANCEL for removing any ::active styling.
base::TimeTicks current_longpress_time_;
+
+ bool gesture_begin_end_types_enabled_;
};
} // namespace ui