| Index: third_party/WebKit/Source/core/page/AutoscrollController.h
|
| diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.h b/third_party/WebKit/Source/core/page/AutoscrollController.h
|
| index b2e5093b69416ef68d761c8e928d5be472eb161b..d4a34b6677c118acebb69a3cfe76a231fc99e8a5 100644
|
| --- a/third_party/WebKit/Source/core/page/AutoscrollController.h
|
| +++ b/third_party/WebKit/Source/core/page/AutoscrollController.h
|
| @@ -27,6 +27,7 @@
|
| #define AutoscrollController_h
|
|
|
| #include "core/CoreExport.h"
|
| +#include "platform/geometry/FloatPoint.h"
|
| #include "platform/geometry/FloatSize.h"
|
| #include "platform/geometry/IntPoint.h"
|
| #include "platform/heap/Handle.h"
|
| @@ -35,21 +36,30 @@
|
| namespace blink {
|
|
|
| class LocalFrame;
|
| -class LocalFrameView;
|
| class Node;
|
| class Page;
|
| class LayoutBox;
|
| class LayoutObject;
|
| -class WebMouseEvent;
|
|
|
| enum AutoscrollType {
|
| kNoAutoscroll,
|
| kAutoscrollForDragAndDrop,
|
| kAutoscrollForSelection,
|
| - kAutoscrollForMiddleClickCanStop,
|
| kAutoscrollForMiddleClick,
|
| };
|
|
|
| +enum MiddleClickMode {
|
| + // Middle button was just pressed but was neither released nor moved out of
|
| + // the deadzone yet.
|
| + kMiddleClickInitial,
|
| + // Mouse was moved out of the deadzone while still holding middle mouse
|
| + // button. In this mode, we'll stop autoscrolling when it's released.
|
| + kMiddleClickHolding,
|
| + // Middle button was released while still in the deadzone. In this mode,
|
| + // we'll stop autoscrolling when any button is clicked.
|
| + kMiddleClickToggled,
|
| +};
|
| +
|
| // AutscrollController handels autoscroll and middle click autoscroll for
|
| // EventHandler.
|
| class CORE_EXPORT AutoscrollController final
|
| @@ -58,12 +68,10 @@ class CORE_EXPORT AutoscrollController final
|
| static AutoscrollController* Create(Page&);
|
| DECLARE_TRACE();
|
|
|
| - static const int kNoMiddleClickAutoscrollRadius = 15;
|
| -
|
| + // Selection and drag-and-drop autoscroll.
|
| void Animate(double monotonic_frame_begin_time);
|
| - bool AutoscrollInProgress() const;
|
| + bool SelectionAutoscrollInProgress() const;
|
| bool AutoscrollInProgress(const LayoutBox*) const;
|
| - bool MiddleClickAutoscrollInProgress() const;
|
| void StartAutoscrollForSelection(LayoutObject*);
|
| void StopAutoscroll();
|
| void StopAutoscrollIfNeeded(LayoutObject*);
|
| @@ -71,28 +79,37 @@ class CORE_EXPORT AutoscrollController final
|
| void UpdateDragAndDrop(Node* target_node,
|
| const IntPoint& event_position,
|
| TimeTicks event_time);
|
| +
|
| + // Middle-click autoscroll.
|
| + void StartMiddleClickAutoscroll(LocalFrame*,
|
| + const FloatPoint& position,
|
| + const FloatPoint& position_global);
|
| + void HandleMouseMoveForMiddleClickAutoscroll(
|
| + LocalFrame*,
|
| + const FloatPoint& position_global,
|
| + bool is_middle_button);
|
| void HandleMouseReleaseForMiddleClickAutoscroll(LocalFrame*,
|
| - const WebMouseEvent&);
|
| - void StartMiddleClickAutoscroll(LayoutBox*, const IntPoint&);
|
| + bool is_middle_button);
|
| + void StopMiddleClickAutoscroll(LocalFrame*);
|
| + bool MiddleClickAutoscrollInProgress() const;
|
|
|
| private:
|
| explicit AutoscrollController(Page&);
|
|
|
| - void StartAutoscroll();
|
| -
|
| - void UpdateMiddleClickAutoscrollState(
|
| - LocalFrameView*,
|
| - const IntPoint& last_known_mouse_position);
|
| - FloatSize CalculateAutoscrollDelta();
|
| -
|
| Member<Page> page_;
|
| - LayoutBox* autoscroll_layout_object_;
|
| - LayoutBox* pressed_layout_object_;
|
| - AutoscrollType autoscroll_type_;
|
| + AutoscrollType autoscroll_type_ = kNoAutoscroll;
|
| +
|
| + // Selection and drag-and-drop autoscroll.
|
| + void ScheduleMainThreadAnimation();
|
| + LayoutBox* autoscroll_layout_object_ = nullptr;
|
| + LayoutBox* pressed_layout_object_ = nullptr;
|
| IntPoint drag_and_drop_autoscroll_reference_position_;
|
| TimeTicks drag_and_drop_autoscroll_start_time_;
|
| - IntPoint middle_click_autoscroll_start_pos_;
|
| - bool did_latch_for_middle_click_autoscroll_;
|
| +
|
| + // Middle-click autoscroll.
|
| + FloatPoint middle_click_autoscroll_start_pos_global_;
|
| + FloatSize last_velocity_;
|
| + MiddleClickMode middle_click_mode_ = kMiddleClickInitial;
|
| };
|
|
|
| } // namespace blink
|
|
|