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

Side by Side Diff: sky/engine/core/page/EventHandler.h

Issue 874823002: Move GestureEvent to NewEventDispatcher (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Build fixes Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/frame/NewEventHandler.cpp ('k') | sky/engine/core/page/EventHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 template <typename EventType> 52 template <typename EventType>
53 class EventWithHitTestResults; 53 class EventWithHitTestResults;
54 class FloatPoint; 54 class FloatPoint;
55 class FloatQuad; 55 class FloatQuad;
56 class HitTestRequest; 56 class HitTestRequest;
57 class HitTestResult; 57 class HitTestResult;
58 class KeyboardEvent; 58 class KeyboardEvent;
59 class LocalFrame; 59 class LocalFrame;
60 class Node; 60 class Node;
61 class OptionalCursor; 61 class OptionalCursor;
62 class PlatformGestureEvent;
63 class PlatformKeyboardEvent; 62 class PlatformKeyboardEvent;
64 class RenderLayer; 63 class RenderLayer;
65 class RenderLayerScrollableArea; 64 class RenderLayerScrollableArea;
66 class RenderObject; 65 class RenderObject;
67 class ScrollableArea; 66 class ScrollableArea;
68 class Scrollbar; 67 class Scrollbar;
69 class TextEvent; 68 class TextEvent;
70 class VisibleSelection; 69 class VisibleSelection;
71 class Widget; 70 class Widget;
72 71
73 typedef EventWithHitTestResults<PlatformGestureEvent> GestureEventWithHitTestRes ults;
74
75 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili ngWhitespace }; 72 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili ngWhitespace };
76 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; 73 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis };
77 74
78 class EventHandler { 75 class EventHandler {
79 WTF_MAKE_NONCOPYABLE(EventHandler); 76 WTF_MAKE_NONCOPYABLE(EventHandler);
80 public: 77 public:
81 explicit EventHandler(LocalFrame*); 78 explicit EventHandler(LocalFrame*);
82 ~EventHandler(); 79 ~EventHandler();
83 80
84 void clear(); 81 void clear();
(...skipping 15 matching lines...) Expand all
100 void scheduleHoverStateUpdate(); 97 void scheduleHoverStateUpdate();
101 void scheduleCursorUpdate(); 98 void scheduleCursorUpdate();
102 99
103 IntPoint lastKnownMousePosition() const; 100 IntPoint lastKnownMousePosition() const;
104 Cursor currentMouseCursor() const { return m_currentMouseCursor; } 101 Cursor currentMouseCursor() const { return m_currentMouseCursor; }
105 102
106 // Attempts to scroll the DOM tree. If that fails, scrolls the view. 103 // Attempts to scroll the DOM tree. If that fails, scrolls the view.
107 // If the view can't be scrolled either, recursively bubble to the parent fr ame. 104 // If the view can't be scrolled either, recursively bubble to the parent fr ame.
108 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode = 0); 105 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode = 0);
109 106
110 // Called on the local root frame exactly once per gesture event.
111 bool handleGestureEvent(const PlatformGestureEvent&);
112
113 // Hit-test the provided (non-scroll) gesture event, applying touch-adjustme nt and updating
114 // hover/active state across all frames if necessary. This should be called at most once
115 // per gesture event, and called on the local root frame.
116 // Note: This is similar to (the less clearly named) prepareMouseEvent.
117 // FIXME: Remove readOnly param when there is only ever a single call to thi s.
118 GestureEventWithHitTestResults targetGestureEvent(const PlatformGestureEvent &, bool readOnly = false);
119
120 // Handle the provided non-scroll gesture event. Should be called only on th e inner frame.
121 bool handleGestureEventInFrame(const GestureEventWithHitTestResults&);
122
123 // Handle the provided scroll gesture event, propagating down to child frame s as necessary.
124 bool handleGestureScrollEvent(const PlatformGestureEvent&);
125 bool handleGestureScrollEnd(const PlatformGestureEvent&);
126 bool isScrollbarHandlingGestures() const;
127
128 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; } 107 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; }
129 108
130 bool keyEvent(const PlatformKeyboardEvent&); 109 bool keyEvent(const PlatformKeyboardEvent&);
131 void defaultKeyboardEventHandler(KeyboardEvent*); 110 void defaultKeyboardEventHandler(KeyboardEvent*);
132 111
133 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te xtEventInputType = TextEventInputKeyboard); 112 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te xtEventInputType = TextEventInputKeyboard);
134 void defaultTextInputEventHandler(TextEvent*); 113 void defaultTextInputEventHandler(TextEvent*);
135 114
136 void focusDocumentView(); 115 void focusDocumentView();
137 116
138 void capsLockStateMayHaveChanged(); // Only called by FrameSelection 117 void capsLockStateMayHaveChanged(); // Only called by FrameSelection
139 118
140 bool useHandCursor(Node*, bool isOverLink); 119 bool useHandCursor(Node*, bool isOverLink);
141 120
142 void notifyElementActivated(); 121 void notifyElementActivated();
143 122
144 private: 123 private:
145 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleS election&, TextGranularity); 124 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleS election&, TextGranularity);
146 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing Whitespace); 125 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing Whitespace);
147 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT railingWhitespace); 126 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT railingWhitespace);
148 127
149 HitTestRequest::HitTestRequestType getHitTypeForGestureType(PlatformEvent::T ype);
150
151 bool handleGestureTap(const GestureEventWithHitTestResults&);
152 bool handleGestureLongPress(const GestureEventWithHitTestResults&);
153 bool handleGestureLongTap(const GestureEventWithHitTestResults&);
154 bool handleGestureScrollUpdate(const PlatformGestureEvent&);
155 bool handleGestureScrollBegin(const PlatformGestureEvent&);
156 void clearGestureScrollNodes();
157
158 OptionalCursor selectCursor(const HitTestResult&); 128 OptionalCursor selectCursor(const HitTestResult&);
159 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i Beam); 129 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i Beam);
160 130
161 void hoverTimerFired(Timer<EventHandler>*); 131 void hoverTimerFired(Timer<EventHandler>*);
162 void cursorUpdateTimerFired(Timer<EventHandler>*); 132 void cursorUpdateTimerFired(Timer<EventHandler>*);
163 void activeIntervalTimerFired(Timer<EventHandler>*); 133 void activeIntervalTimerFired(Timer<EventHandler>*);
164 134
165 bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; } 135 bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
166 136
167 bool isCursorVisible() const; 137 bool isCursorVisible() const;
(...skipping 27 matching lines...) Expand all
195 bool dragHysteresisExceeded(const IntPoint&) const; 165 bool dragHysteresisExceeded(const IntPoint&) const;
196 166
197 void defaultTabEventHandler(KeyboardEvent*); 167 void defaultTabEventHandler(KeyboardEvent*);
198 168
199 void updateSelectionForMouseDrag(const HitTestResult&); 169 void updateSelectionForMouseDrag(const HitTestResult&);
200 170
201 void updateLastScrollbarUnderMouse(Scrollbar*, bool); 171 void updateLastScrollbarUnderMouse(Scrollbar*, bool);
202 172
203 bool capturesDragging() const { return m_capturesDragging; } 173 bool capturesDragging() const { return m_capturesDragging; }
204 174
205 bool handleGestureShowPress();
206
207 bool passScrollGestureEventToWidget(const PlatformGestureEvent&, RenderObjec t*);
208 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&);
209
210 AutoscrollController* autoscrollController() const; 175 AutoscrollController* autoscrollController() const;
211 176
212 LocalFrame* const m_frame; 177 LocalFrame* const m_frame;
213 178
214 bool m_mousePressed; 179 bool m_mousePressed;
215 bool m_capturesDragging; 180 bool m_capturesDragging;
216 RefPtr<Node> m_mousePressNode; 181 RefPtr<Node> m_mousePressNode;
217 182
218 bool m_mouseDownMayStartSelect; 183 bool m_mouseDownMayStartSelect;
219 bool m_mouseDownMayStartDrag; 184 bool m_mouseDownMayStartDrag;
(...skipping 18 matching lines...) Expand all
238 RefPtr<Node> m_dragTarget; 203 RefPtr<Node> m_dragTarget;
239 bool m_shouldOnlyFireDragOverEvent; 204 bool m_shouldOnlyFireDragOverEvent;
240 205
241 bool m_mousePositionIsUnknown; 206 bool m_mousePositionIsUnknown;
242 IntPoint m_lastKnownMousePosition; 207 IntPoint m_lastKnownMousePosition;
243 IntPoint m_lastKnownMouseGlobalPosition; 208 IntPoint m_lastKnownMouseGlobalPosition;
244 IntPoint m_mouseDownPos; // In our view's coords. 209 IntPoint m_mouseDownPos; // In our view's coords.
245 210
246 RefPtr<Node> m_previousWheelScrolledNode; 211 RefPtr<Node> m_previousWheelScrolledNode;
247 212
248 RefPtr<Node> m_scrollGestureHandlingNode;
249 bool m_lastGestureScrollOverWidget;
250 RefPtr<Node> m_previousGestureScrolledNode;
251 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture;
252
253 double m_maxMouseMovedDuration; 213 double m_maxMouseMovedDuration;
254 bool m_didStartDrag; 214 bool m_didStartDrag;
255 215
256 Timer<EventHandler> m_activeIntervalTimer; 216 Timer<EventHandler> m_activeIntervalTimer;
257 double m_lastShowPressTimestamp; 217 double m_lastShowPressTimestamp;
258 RefPtr<Element> m_lastDeferredTapElement; 218 RefPtr<Element> m_lastDeferredTapElement;
259 }; 219 };
260 220
261 } // namespace blink 221 } // namespace blink
262 222
263 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ 223 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/frame/NewEventHandler.cpp ('k') | sky/engine/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698