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

Unified Diff: Source/core/page/EventHandler.h

Issue 338543003: Gesture event hit test refactoring and reduction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix release build Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.h
diff --git a/Source/core/page/EventHandler.h b/Source/core/page/EventHandler.h
index ff7245f5b5761e13da6a95112552aa5202262e7b..5204ef06073a847f3cc8ca3e237b665933f15de9 100644
--- a/Source/core/page/EventHandler.h
+++ b/Source/core/page/EventHandler.h
@@ -49,18 +49,20 @@ namespace WebCore {
class AutoscrollController;
class DataTransfer;
class Document;
+class DragState;
class Element;
class Event;
class EventTarget;
+template <typename EventType>
+class EventWithHitTestResults;
class FloatPoint;
class FloatQuad;
class FullscreenElementStack;
-class LocalFrame;
class HTMLFrameSetElement;
class HitTestRequest;
class HitTestResult;
class KeyboardEvent;
-class MouseEventWithHitTestResults;
+class LocalFrame;
class Node;
class OptionalCursor;
class PlatformGestureEvent;
@@ -79,7 +81,8 @@ class VisibleSelection;
class WheelEvent;
class Widget;
-class DragState;
+typedef EventWithHitTestResults<PlatformGestureEvent> GestureEventWithHitTestResults;
+typedef EventWithHitTestResults<PlatformMouseEvent> MouseEventWithHitTestResults;
enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis };
@@ -143,19 +146,32 @@ public:
bool handleWheelEvent(const PlatformWheelEvent&);
void defaultWheelEventHandler(Node*, WheelEvent*);
+ // Called on the local root frame exactly once per gesture event.
bool handleGestureEvent(const PlatformGestureEvent&);
+
+ // Hit-test the provided (non-scroll) gesture event, applying touch-adjustment and updating
+ // hover/active state across all frames if necessary. This should be called at most once
+ // per gesture event, and called on the local root frame.
+ // Note: This is similar to (the less clearly named) prepareMouseEvent.
+ // FIXME: Remove readOnly param when there is only ever a single call to this.
+ GestureEventWithHitTestResults targetGestureEvent(const PlatformGestureEvent&, bool readOnly = false);
+
+ // Handle the provided non-scroll gesture event. Should be called only on the inner frame.
+ bool handleGestureEventInFrame(const GestureEventWithHitTestResults&);
+
+ // Handle the provided scroll gesture event, propagating down to child frames as necessary.
+ bool handleGestureScrollEvent(const PlatformGestureEvent&);
bool handleGestureScrollEnd(const PlatformGestureEvent&);
bool isScrollbarHandlingGestures() const;
- bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
- bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
+ bool bestClickableNodeForHitTestResult(const HitTestResult&, IntPoint& targetPoint, Node*& targetNode);
+ bool bestContextMenuNodeForHitTestResult(const HitTestResult&, IntPoint& targetPoint, Node*& targetNode);
+ // FIXME: This doesn't appear to be used outside tests anymore, what path are we using now and is it tested?
bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode);
- void adjustGesturePosition(const PlatformGestureEvent&, IntPoint& adjustedPoint);
-
bool sendContextMenuEvent(const PlatformMouseEvent&);
bool sendContextMenuEventForKey();
- bool sendContextMenuEventForGesture(const PlatformGestureEvent&);
+ bool sendContextMenuEventForGesture(const GestureEventWithHitTestResults&);
void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; }
@@ -204,10 +220,11 @@ private:
bool handlePasteGlobalSelection(const PlatformMouseEvent&);
- bool handleGestureTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
- bool handleGestureLongPress(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
- bool handleGestureLongTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
- bool handleGestureTwoFingerTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
+ HitTestRequest::HitTestRequestType getHitTypeForGestureType(PlatformEvent::Type);
+ void applyTouchAdjustment(PlatformGestureEvent*, HitTestResult*);
+ bool handleGestureTap(const GestureEventWithHitTestResults&);
+ bool handleGestureLongPress(const GestureEventWithHitTestResults&);
+ bool handleGestureLongTap(const GestureEventWithHitTestResults&);
bool handleGestureScrollUpdate(const PlatformGestureEvent&);
bool handleGestureScrollBegin(const PlatformGestureEvent&);
void clearGestureScrollNodes();
@@ -299,10 +316,8 @@ private:
bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&);
- bool passGestureEventToWidget(const PlatformGestureEvent&, Widget*);
- bool passGestureEventToWidgetIfPossible(const PlatformGestureEvent&, RenderObject*);
+ bool passScrollGestureEventToWidget(const PlatformGestureEvent&, RenderObject*);
bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&);
- LocalFrame* getSubFrameForGestureEvent(const IntPoint& touchAdjustedPoint, const PlatformGestureEvent&);
AutoscrollController* autoscrollController() const;
bool panScrollInProgress() const;
@@ -377,12 +392,11 @@ private:
bool m_touchPressed;
RefPtrWillBeMember<Node> m_scrollGestureHandlingNode;
- bool m_lastHitTestResultOverWidget;
+ bool m_lastGestureScrollOverWidget;
RefPtrWillBeMember<Node> m_previousGestureScrolledNode;
RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture;
double m_maxMouseMovedDuration;
- PlatformEvent::Type m_baseEventType;
bool m_didStartDrag;
bool m_longTapShouldInvokeContextMenu;
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698