Chromium Code Reviews| 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 #include "core/page/DragActions.h" | 37 #include "core/page/DragActions.h" |
| 38 #include "core/page/EventWithHitTestResults.h" | 38 #include "core/page/EventWithHitTestResults.h" |
| 39 #include "core/style/ComputedStyleConstants.h" | 39 #include "core/style/ComputedStyleConstants.h" |
| 40 #include "platform/Cursor.h" | 40 #include "platform/Cursor.h" |
| 41 #include "platform/PlatformMouseEvent.h" | 41 #include "platform/PlatformMouseEvent.h" |
| 42 #include "platform/PlatformTouchPoint.h" | 42 #include "platform/PlatformTouchPoint.h" |
| 43 #include "platform/UserGestureIndicator.h" | 43 #include "platform/UserGestureIndicator.h" |
| 44 #include "platform/geometry/LayoutPoint.h" | 44 #include "platform/geometry/LayoutPoint.h" |
| 45 #include "platform/heap/Handle.h" | 45 #include "platform/heap/Handle.h" |
| 46 #include "platform/scroll/ScrollTypes.h" | 46 #include "platform/scroll/ScrollTypes.h" |
| 47 #include "public/platform/WebGestureEvent.h" | |
|
majidvp
2016/12/15 17:40:45
nit: why not forward declare?
dtapuska
2016/12/15 21:29:38
Done.
| |
| 47 #include "public/platform/WebInputEvent.h" | 48 #include "public/platform/WebInputEvent.h" |
| 48 #include "public/platform/WebInputEventResult.h" | 49 #include "public/platform/WebInputEventResult.h" |
| 49 #include "wtf/Forward.h" | 50 #include "wtf/Forward.h" |
| 50 #include "wtf/HashMap.h" | 51 #include "wtf/HashMap.h" |
| 51 #include "wtf/HashTraits.h" | 52 #include "wtf/HashTraits.h" |
| 52 #include "wtf/RefPtr.h" | 53 #include "wtf/RefPtr.h" |
| 53 | 54 |
| 54 namespace blink { | 55 namespace blink { |
| 55 | 56 |
| 56 class DataTransfer; | 57 class DataTransfer; |
| 57 class PaintLayer; | 58 class PaintLayer; |
| 58 class Element; | 59 class Element; |
| 59 class Event; | 60 class Event; |
| 60 class EventTarget; | 61 class EventTarget; |
| 61 template <typename EventType> | 62 template <typename EventType> |
| 62 class EventWithHitTestResults; | 63 class EventWithHitTestResults; |
| 63 class FloatQuad; | 64 class FloatQuad; |
| 64 class FrameHost; | 65 class FrameHost; |
| 65 class HTMLFrameSetElement; | 66 class HTMLFrameSetElement; |
| 66 class HitTestRequest; | 67 class HitTestRequest; |
| 67 class HitTestResult; | 68 class HitTestResult; |
| 68 class LayoutObject; | 69 class LayoutObject; |
| 69 class LocalFrame; | 70 class LocalFrame; |
| 70 class Node; | 71 class Node; |
| 71 class OptionalCursor; | 72 class OptionalCursor; |
| 72 class PlatformGestureEvent; | |
| 73 class PlatformTouchEvent; | 73 class PlatformTouchEvent; |
| 74 class PlatformWheelEvent; | 74 class PlatformWheelEvent; |
| 75 class ScrollableArea; | 75 class ScrollableArea; |
| 76 class Scrollbar; | 76 class Scrollbar; |
| 77 class SelectionController; | 77 class SelectionController; |
| 78 class TextEvent; | 78 class TextEvent; |
| 79 | 79 |
| 80 class CORE_EXPORT EventHandler final | 80 class CORE_EXPORT EventHandler final |
| 81 : public GarbageCollectedFinalized<EventHandler> { | 81 : public GarbageCollectedFinalized<EventHandler> { |
| 82 WTF_MAKE_NONCOPYABLE(EventHandler); | 82 WTF_MAKE_NONCOPYABLE(EventHandler); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 WebInputEventResult handleMouseMoveEvent( | 142 WebInputEventResult handleMouseMoveEvent( |
| 143 const PlatformMouseEvent&, | 143 const PlatformMouseEvent&, |
| 144 const Vector<PlatformMouseEvent>& coalescedEvents); | 144 const Vector<PlatformMouseEvent>& coalescedEvents); |
| 145 void handleMouseLeaveEvent(const PlatformMouseEvent&); | 145 void handleMouseLeaveEvent(const PlatformMouseEvent&); |
| 146 | 146 |
| 147 WebInputEventResult handleMousePressEvent(const PlatformMouseEvent&); | 147 WebInputEventResult handleMousePressEvent(const PlatformMouseEvent&); |
| 148 WebInputEventResult handleMouseReleaseEvent(const PlatformMouseEvent&); | 148 WebInputEventResult handleMouseReleaseEvent(const PlatformMouseEvent&); |
| 149 WebInputEventResult handleWheelEvent(const PlatformWheelEvent&); | 149 WebInputEventResult handleWheelEvent(const PlatformWheelEvent&); |
| 150 | 150 |
| 151 // Called on the local root frame exactly once per gesture event. | 151 // Called on the local root frame exactly once per gesture event. |
| 152 WebInputEventResult handleGestureEvent(const PlatformGestureEvent&); | 152 WebInputEventResult handleGestureEvent(const WebGestureEvent&); |
| 153 WebInputEventResult handleGestureEvent(const GestureEventWithHitTestResults&); | 153 WebInputEventResult handleGestureEvent(const GestureEventWithHitTestResults&); |
| 154 | 154 |
| 155 // Clear the old hover/active state within frames before moving the hover | 155 // Clear the old hover/active state within frames before moving the hover |
| 156 // state to the another frame | 156 // state to the another frame |
| 157 void updateGestureHoverActiveState(const HitTestRequest&, Element*); | 157 void updateGestureHoverActiveState(const HitTestRequest&, Element*); |
| 158 | 158 |
| 159 // Hit-test the provided (non-scroll) gesture event, applying touch-adjustment | 159 // Hit-test the provided (non-scroll) gesture event, applying touch-adjustment |
| 160 // and updating hover/active state across all frames if necessary. This should | 160 // and updating hover/active state across all frames if necessary. This should |
| 161 // be called at most once per gesture event, and called on the local root | 161 // be called at most once per gesture event, and called on the local root |
| 162 // frame. | 162 // frame. |
| 163 // Note: This is similar to (the less clearly named) prepareMouseEvent. | 163 // Note: This is similar to (the less clearly named) prepareMouseEvent. |
| 164 // FIXME: Remove readOnly param when there is only ever a single call to this. | 164 // FIXME: Remove readOnly param when there is only ever a single call to this. |
| 165 GestureEventWithHitTestResults targetGestureEvent(const PlatformGestureEvent&, | 165 GestureEventWithHitTestResults targetGestureEvent(const WebGestureEvent&, |
| 166 bool readOnly = false); | 166 bool readOnly = false); |
| 167 GestureEventWithHitTestResults hitTestResultForGestureEvent( | 167 GestureEventWithHitTestResults hitTestResultForGestureEvent( |
| 168 const PlatformGestureEvent&, | 168 const WebGestureEvent&, |
| 169 HitTestRequest::HitTestRequestType); | 169 HitTestRequest::HitTestRequestType); |
| 170 // Handle the provided non-scroll gesture event. Should be called only on the | 170 // Handle the provided non-scroll gesture event. Should be called only on the |
| 171 // inner frame. | 171 // inner frame. |
| 172 WebInputEventResult handleGestureEventInFrame( | 172 WebInputEventResult handleGestureEventInFrame( |
| 173 const GestureEventWithHitTestResults&); | 173 const GestureEventWithHitTestResults&); |
| 174 | 174 |
| 175 // Handle the provided scroll gesture event, propagating down to child frames | 175 // Handle the provided scroll gesture event, propagating down to child frames |
| 176 // as necessary. | 176 // as necessary. |
| 177 WebInputEventResult handleGestureScrollEvent(const PlatformGestureEvent&); | 177 WebInputEventResult handleGestureScrollEvent(const WebGestureEvent&); |
| 178 WebInputEventResult handleGestureScrollEnd(const PlatformGestureEvent&); | 178 WebInputEventResult handleGestureScrollEnd(const WebGestureEvent&); |
| 179 bool isScrollbarHandlingGestures() const; | 179 bool isScrollbarHandlingGestures() const; |
| 180 | 180 |
| 181 bool bestClickableNodeForHitTestResult(const HitTestResult&, | 181 bool bestClickableNodeForHitTestResult(const HitTestResult&, |
| 182 IntPoint& targetPoint, | 182 IntPoint& targetPoint, |
| 183 Node*& targetNode); | 183 Node*& targetNode); |
| 184 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, | 184 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, |
| 185 IntPoint& targetPoint, | 185 IntPoint& targetPoint, |
| 186 Node*& targetNode); | 186 Node*& targetNode); |
| 187 // FIXME: This doesn't appear to be used outside tests anymore, what path are | 187 // FIXME: This doesn't appear to be used outside tests anymore, what path are |
| 188 // we using now and is it tested? | 188 // we using now and is it tested? |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 private: | 259 private: |
| 260 WebInputEventResult handleMouseMoveOrLeaveEvent( | 260 WebInputEventResult handleMouseMoveOrLeaveEvent( |
| 261 const PlatformMouseEvent&, | 261 const PlatformMouseEvent&, |
| 262 const Vector<PlatformMouseEvent>&, | 262 const Vector<PlatformMouseEvent>&, |
| 263 HitTestResult* hoveredNode = nullptr, | 263 HitTestResult* hoveredNode = nullptr, |
| 264 bool onlyUpdateScrollbars = false, | 264 bool onlyUpdateScrollbars = false, |
| 265 bool forceLeave = false); | 265 bool forceLeave = false); |
| 266 | 266 |
| 267 HitTestRequest::HitTestRequestType getHitTypeForGestureType( | 267 HitTestRequest::HitTestRequestType getHitTypeForGestureType( |
| 268 PlatformEvent::EventType); | 268 PlatformEvent::EventType); |
| 269 void applyTouchAdjustment(PlatformGestureEvent*, HitTestResult*); | 269 void applyTouchAdjustment(WebGestureEvent*, HitTestResult*); |
| 270 WebInputEventResult handleGestureTapDown( | 270 WebInputEventResult handleGestureTapDown( |
| 271 const GestureEventWithHitTestResults&); | 271 const GestureEventWithHitTestResults&); |
| 272 WebInputEventResult handleGestureTap(const GestureEventWithHitTestResults&); | 272 WebInputEventResult handleGestureTap(const GestureEventWithHitTestResults&); |
| 273 WebInputEventResult handleGestureLongPress( | 273 WebInputEventResult handleGestureLongPress( |
| 274 const GestureEventWithHitTestResults&); | 274 const GestureEventWithHitTestResults&); |
| 275 WebInputEventResult handleGestureLongTap( | 275 WebInputEventResult handleGestureLongTap( |
| 276 const GestureEventWithHitTestResults&); | 276 const GestureEventWithHitTestResults&); |
| 277 | 277 |
| 278 void updateGestureTargetNodeForMouseEvent( | 278 void updateGestureTargetNodeForMouseEvent( |
| 279 const GestureEventWithHitTestResults&); | 279 const GestureEventWithHitTestResults&); |
| 280 | 280 |
| 281 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; | 281 bool shouldApplyTouchAdjustment(const WebGestureEvent&) const; |
| 282 | 282 |
| 283 OptionalCursor selectCursor(const HitTestResult&); | 283 OptionalCursor selectCursor(const HitTestResult&); |
| 284 OptionalCursor selectAutoCursor(const HitTestResult&, | 284 OptionalCursor selectAutoCursor(const HitTestResult&, |
| 285 Node*, | 285 Node*, |
| 286 const Cursor& iBeam); | 286 const Cursor& iBeam); |
| 287 | 287 |
| 288 void hoverTimerFired(TimerBase*); | 288 void hoverTimerFired(TimerBase*); |
| 289 void cursorUpdateTimerFired(TimerBase*); | 289 void cursorUpdateTimerFired(TimerBase*); |
| 290 void activeIntervalTimerFired(TimerBase*); | 290 void activeIntervalTimerFired(TimerBase*); |
| 291 | 291 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 | 385 |
| 386 // Set on GestureTapDown if the |pointerdown| event corresponding to the | 386 // Set on GestureTapDown if the |pointerdown| event corresponding to the |
| 387 // triggering |touchstart| event was canceled. This suppresses mouse event | 387 // triggering |touchstart| event was canceled. This suppresses mouse event |
| 388 // firing for the current gesture sequence (i.e. until next GestureTapDown). | 388 // firing for the current gesture sequence (i.e. until next GestureTapDown). |
| 389 bool m_suppressMouseEventsFromGestures; | 389 bool m_suppressMouseEventsFromGestures; |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 } // namespace blink | 392 } // namespace blink |
| 393 | 393 |
| 394 #endif // EventHandler_h | 394 #endif // EventHandler_h |
| OLD | NEW |