| Index: content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
|
| diff --git a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
|
| similarity index 49%
|
| copy from content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h
|
| copy to content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
|
| index da3e39e210410ffdc618d88f3962c27764db442e..fe9790cf98a03de0cc3af690b97c9397778f344b 100644
|
| --- a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h
|
| +++ b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h
|
| @@ -2,13 +2,16 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_SCROLL_GESTURE_H_
|
| -#define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_SCROLL_GESTURE_H_
|
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_MOVE_GESTURE_H_
|
| +#define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_MOVE_GESTURE_H_
|
| +
|
| +#include <vector>
|
|
|
| #include "base/time/time.h"
|
| #include "content/browser/renderer_host/input/synthetic_gesture.h"
|
| #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
|
| #include "content/common/content_export.h"
|
| +#include "content/common/input/synthetic_smooth_drag_gesture_params.h"
|
| #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
|
| #include "content/common/input/synthetic_web_input_event_builders.h"
|
| #include "third_party/WebKit/public/web/WebInputEvent.h"
|
| @@ -17,19 +20,35 @@
|
|
|
| namespace content {
|
|
|
| -// Simulates scrolling given a sequence of scroll distances as a continuous
|
| -// gestures (i.e. when synthesizing touch events, the touch pointer is not
|
| -// lifted when changing scroll direction).
|
| +class CONTENT_EXPORT SyntheticSmoothMoveGestureParams {
|
| + public:
|
| + SyntheticSmoothMoveGestureParams();
|
| + ~SyntheticSmoothMoveGestureParams();
|
| +
|
| + enum InputType { MOUSE_DRAG_INPUT, MOUSE_WHEEL_INPUT, TOUCH_INPUT };
|
| +
|
| + InputType input_type;
|
| + gfx::PointF start_point;
|
| + std::vector<gfx::Vector2dF> distances;
|
| + int speed_in_pixels_s;
|
| + bool prevent_fling;
|
| + bool add_slop;
|
| +};
|
| +
|
| +// This class is used as helper class for simulation of scroll and drag.
|
| +// Simulates scrolling/dragging given a sequence of distances as a continuous
|
| +// gestures (i.e. when synthesizing touch or mouse drag events, the pointer is
|
| +// not lifted when changing scroll direction).
|
| // If no distance is provided or the first one is 0, no touch events are
|
| // generated.
|
| -// When synthesizing touch events, the first distance is extended to compensate
|
| -// for the touch slop.
|
| -class CONTENT_EXPORT SyntheticSmoothScrollGesture : public SyntheticGesture {
|
| +// When synthesizing touch events for scrolling, the first distance is extended
|
| +// to compensate for the touch slop.
|
| +class CONTENT_EXPORT SyntheticSmoothMoveGesture : public SyntheticGesture {
|
| public:
|
| - explicit SyntheticSmoothScrollGesture(
|
| - const SyntheticSmoothScrollGestureParams& params);
|
| - ~SyntheticSmoothScrollGesture() override;
|
| + SyntheticSmoothMoveGesture(SyntheticSmoothMoveGestureParams params);
|
| + ~SyntheticSmoothMoveGesture() override;
|
|
|
| + // SyntheticGesture implementation:
|
| SyntheticGesture::Result ForwardInputEvents(
|
| const base::TimeTicks& timestamp,
|
| SyntheticGestureTarget* target) override;
|
| @@ -45,7 +64,9 @@ class CONTENT_EXPORT SyntheticSmoothScrollGesture : public SyntheticGesture {
|
|
|
| void ForwardTouchInputEvents(
|
| const base::TimeTicks& timestamp, SyntheticGestureTarget* target);
|
| - void ForwardMouseInputEvents(
|
| + void ForwardMouseWheelInputEvents(
|
| + const base::TimeTicks& timestamp, SyntheticGestureTarget* target);
|
| + void ForwardMouseClickInputEvents(
|
| const base::TimeTicks& timestamp, SyntheticGestureTarget* target);
|
|
|
| void ForwardTouchEvent(SyntheticGestureTarget* target,
|
| @@ -62,30 +83,36 @@ class CONTENT_EXPORT SyntheticSmoothScrollGesture : public SyntheticGesture {
|
| void ReleaseTouchPoint(SyntheticGestureTarget* target,
|
| const base::TimeTicks& timestamp);
|
|
|
| + void PressMousePoint(SyntheticGestureTarget* target,
|
| + const base::TimeTicks& timestamp);
|
| + void ReleaseMousePoint(SyntheticGestureTarget* target,
|
| + const base::TimeTicks& timestamp);
|
| + void MoveMousePoint(SyntheticGestureTarget* target,
|
| + const gfx::Vector2dF& delta,
|
| + const base::TimeTicks& timestamp);
|
| +
|
| void AddTouchSlopToFirstDistance(SyntheticGestureTarget* target);
|
| - gfx::Vector2dF GetPositionDeltaAtTime(const base::TimeTicks& timestamp)
|
| - const;
|
| - void ComputeNextScrollSegment();
|
| + gfx::Vector2dF GetPositionDeltaAtTime(const base::TimeTicks& timestamp) const;
|
| + void ComputeNextMoveSegment();
|
| base::TimeTicks ClampTimestamp(const base::TimeTicks& timestamp) const;
|
| - bool FinishedCurrentScrollSegment(const base::TimeTicks& timestamp) const;
|
| - bool IsLastScrollSegment() const;
|
| - bool ScrollIsNoOp() const;
|
| + bool FinishedCurrentMoveSegment(const base::TimeTicks& timestamp) const;
|
| + bool IsLastMoveSegment() const;
|
| + bool MoveIsNoOp() const;
|
|
|
| - SyntheticSmoothScrollGestureParams params_;
|
| + SyntheticSmoothMoveGestureParams params_;
|
| // Used for mouse input.
|
| - gfx::Vector2d current_scroll_segment_total_delta_discrete_;
|
| + gfx::Vector2d current_move_segment_total_delta_discrete_;
|
| // Used for touch input.
|
| - gfx::Point current_scroll_segment_start_position_;
|
| + gfx::PointF current_move_segment_start_position_;
|
| SyntheticWebTouchEvent touch_event_;
|
| - SyntheticGestureParams::GestureSourceType gesture_source_type_;
|
| GestureState state_;
|
| - int current_scroll_segment_;
|
| - base::TimeTicks current_scroll_segment_start_time_;
|
| - base::TimeTicks current_scroll_segment_stop_time_;
|
| + int current_move_segment_;
|
| + base::TimeTicks current_move_segment_start_time_;
|
| + base::TimeTicks current_move_segment_stop_time_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(SyntheticSmoothScrollGesture);
|
| + DISALLOW_COPY_AND_ASSIGN(SyntheticSmoothMoveGesture);
|
| };
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_SCROLL_GESTURE_H_
|
| +#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_MOVE_GESTURE_H_
|
|
|