OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 26 matching lines...) Expand all Loading... |
37 class Node; | 37 class Node; |
38 class Page; | 38 class Page; |
39 class PlatformMouseEvent; | 39 class PlatformMouseEvent; |
40 class LayoutBox; | 40 class LayoutBox; |
41 class LayoutObject; | 41 class LayoutObject; |
42 | 42 |
43 enum AutoscrollType { | 43 enum AutoscrollType { |
44 NoAutoscroll, | 44 NoAutoscroll, |
45 AutoscrollForDragAndDrop, | 45 AutoscrollForDragAndDrop, |
46 AutoscrollForSelection, | 46 AutoscrollForSelection, |
47 #if OS(WIN) | 47 AutoscrollForMiddleClickCanStop, |
48 AutoscrollForPanCanStop, | 48 AutoscrollForMiddleClick, |
49 AutoscrollForPan, | |
50 #endif | |
51 }; | 49 }; |
52 | 50 |
53 // AutscrollController handels autoscroll and pan scroll for EventHandler. | 51 // AutscrollController handels autoscroll and middle click autoscroll for EventH
andler. |
54 class CORE_EXPORT AutoscrollController final : public GarbageCollected<Autoscrol
lController> { | 52 class CORE_EXPORT AutoscrollController final : public GarbageCollected<Autoscrol
lController> { |
55 public: | 53 public: |
56 static AutoscrollController* create(Page&); | 54 static AutoscrollController* create(Page&); |
57 DECLARE_TRACE(); | 55 DECLARE_TRACE(); |
58 | 56 |
59 static const int noPanScrollRadius = 15; | 57 static const int noMiddleClickAutoscrollRadius = 15; |
60 | 58 |
61 void animate(double monotonicFrameBeginTime); | 59 void animate(double monotonicFrameBeginTime); |
62 bool autoscrollInProgress() const; | 60 bool autoscrollInProgress() const; |
63 bool autoscrollInProgress(const LayoutBox*) const; | 61 bool autoscrollInProgress(const LayoutBox*) const; |
64 bool panScrollInProgress() const; | 62 bool middleClickAutoscrollInProgress() const; |
65 void startAutoscrollForSelection(LayoutObject*); | 63 void startAutoscrollForSelection(LayoutObject*); |
66 void stopAutoscroll(); | 64 void stopAutoscroll(); |
67 void stopAutoscrollIfNeeded(LayoutObject*); | 65 void stopAutoscrollIfNeeded(LayoutObject*); |
68 void updateAutoscrollLayoutObject(); | 66 void updateAutoscrollLayoutObject(); |
69 void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, doub
le eventTime); | 67 void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, doub
le eventTime); |
70 #if OS(WIN) | 68 void handleMouseReleaseForMiddleClickAutoscroll(LocalFrame*, const PlatformM
ouseEvent&); |
71 void handleMouseReleaseForPanScrolling(LocalFrame*, const PlatformMouseEvent
&); | 69 void startMiddleClickAutoscroll(LayoutBox*, const IntPoint&); |
72 void startPanScrolling(LayoutBox*, const IntPoint&); | |
73 #endif | |
74 | 70 |
75 private: | 71 private: |
76 explicit AutoscrollController(Page&); | 72 explicit AutoscrollController(Page&); |
77 | 73 |
78 void startAutoscroll(); | 74 void startAutoscroll(); |
79 | 75 |
80 #if OS(WIN) | 76 void updateMiddleClickAutoscrollState(FrameView*, const IntPoint& lastKnownM
ousePosition); |
81 void updatePanScrollState(FrameView*, const IntPoint& lastKnownMousePosition
); | |
82 #endif | |
83 | 77 |
84 Member<Page> m_page; | 78 Member<Page> m_page; |
85 LayoutBox* m_autoscrollLayoutObject; | 79 LayoutBox* m_autoscrollLayoutObject; |
86 LayoutBox* m_pressedLayoutObject; | 80 LayoutBox* m_pressedLayoutObject; |
87 AutoscrollType m_autoscrollType; | 81 AutoscrollType m_autoscrollType; |
88 IntPoint m_dragAndDropAutoscrollReferencePosition; | 82 IntPoint m_dragAndDropAutoscrollReferencePosition; |
89 double m_dragAndDropAutoscrollStartTime; | 83 double m_dragAndDropAutoscrollStartTime; |
90 #if OS(WIN) | 84 IntPoint m_middleClickAutoscrollStartPos; |
91 IntPoint m_panScrollStartPos; | |
92 #endif | |
93 }; | 85 }; |
94 | 86 |
95 } // namespace blink | 87 } // namespace blink |
96 | 88 |
97 #endif // AutoscrollController_h | 89 #endif // AutoscrollController_h |
OLD | NEW |