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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.h

Issue 1670073004: Send node transition events for touch events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing the comment Created 4 years, 10 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
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef EventHandler_h 26 #ifndef EventHandler_h
27 #define EventHandler_h 27 #define EventHandler_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/events/PointerEventManager.h"
31 #include "core/events/TextEventInputType.h" 30 #include "core/events/TextEventInputType.h"
31 #include "core/input/PointerEventManager.h"
32 #include "core/layout/HitTestRequest.h" 32 #include "core/layout/HitTestRequest.h"
33 #include "core/page/DragActions.h" 33 #include "core/page/DragActions.h"
34 #include "core/page/EventWithHitTestResults.h" 34 #include "core/page/EventWithHitTestResults.h"
35 #include "core/style/ComputedStyleConstants.h" 35 #include "core/style/ComputedStyleConstants.h"
36 #include "platform/Cursor.h" 36 #include "platform/Cursor.h"
37 #include "platform/PlatformMouseEvent.h" 37 #include "platform/PlatformMouseEvent.h"
38 #include "platform/PlatformTouchPoint.h" 38 #include "platform/PlatformTouchPoint.h"
39 #include "platform/Timer.h" 39 #include "platform/Timer.h"
40 #include "platform/UserGestureIndicator.h" 40 #include "platform/UserGestureIndicator.h"
41 #include "platform/geometry/LayoutPoint.h" 41 #include "platform/geometry/LayoutPoint.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, IntPoint& tar getPoint, Node*& targetNode); 171 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, IntPoint& tar getPoint, Node*& targetNode);
172 // FIXME: This doesn't appear to be used outside tests anymore, what path ar e we using now and is it tested? 172 // FIXME: This doesn't appear to be used outside tests anymore, what path ar e we using now and is it tested?
173 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSiz e& touchRadius, IntRect& targetArea, Node*& targetNode); 173 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSiz e& touchRadius, IntRect& targetArea, Node*& targetNode);
174 174
175 WebInputEventResult sendContextMenuEvent(const PlatformMouseEvent&, Node* ov errideTargetNode = nullptr); 175 WebInputEventResult sendContextMenuEvent(const PlatformMouseEvent&, Node* ov errideTargetNode = nullptr);
176 WebInputEventResult sendContextMenuEventForKey(Element* overrideTargetElemen t = nullptr); 176 WebInputEventResult sendContextMenuEventForKey(Element* overrideTargetElemen t = nullptr);
177 WebInputEventResult sendContextMenuEventForGesture(const GestureEventWithHit TestResults&); 177 WebInputEventResult sendContextMenuEventForGesture(const GestureEventWithHit TestResults&);
178 178
179 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; } 179 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; }
180 180
181 static WebInputEventResult mergeEventResult(WebInputEventResult resultA, Web InputEventResult resultB);
182 static WebInputEventResult eventToEventResult(PassRefPtrWillBeRawPtr<Event>, bool);
183
181 static PlatformEvent::Modifiers accessKeyModifiers(); 184 static PlatformEvent::Modifiers accessKeyModifiers();
182 bool handleAccessKey(const PlatformKeyboardEvent&); 185 bool handleAccessKey(const PlatformKeyboardEvent&);
183 WebInputEventResult keyEvent(const PlatformKeyboardEvent&); 186 WebInputEventResult keyEvent(const PlatformKeyboardEvent&);
184 void defaultKeyboardEventHandler(KeyboardEvent*); 187 void defaultKeyboardEventHandler(KeyboardEvent*);
185 188
186 bool handleTextInputEvent(const String& text, Event* underlyingEvent = nullp tr, TextEventInputType = TextEventInputKeyboard); 189 bool handleTextInputEvent(const String& text, Event* underlyingEvent = nullp tr, TextEventInputType = TextEventInputKeyboard);
187 void defaultTextInputEventHandler(TextEvent*); 190 void defaultTextInputEventHandler(TextEvent*);
188 191
189 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); 192 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation);
190 193
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void handleOverscroll(const ScrollResult&, const FloatPoint& position = Floa tPoint(), const FloatSize& velocity = FloatSize()); 280 void handleOverscroll(const ScrollResult&, const FloatPoint& position = Floa tPoint(), const FloatSize& velocity = FloatSize());
278 281
279 void customizedScroll(const Node& startNode, ScrollState&); 282 void customizedScroll(const Node& startNode, ScrollState&);
280 283
281 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest:: Active); 284 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest:: Active);
282 285
283 void invalidateClick(); 286 void invalidateClick();
284 287
285 void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&); 288 void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&);
286 289
287 WebInputEventResult dispatchPointerEvent(EventTarget*, PassRefPtrWillBeRawPt r<PointerEvent>);
288 EventTarget* getEffectiveTargetForPointerEvent(EventTarget*, PassRefPtrWillB eRawPtr<PointerEvent>);
289
290 // Dispatches (pointer|mouse)(over|out|enter|leave) events to the specified node.
291 void sendPointerAndMouseTransitionEvents(Node* target, const AtomicString& m ouseEventType,
292 const PlatformMouseEvent&, Node* relatedTarget, bool checkForListener);
293
294 // Locates the target nodes in DOM based on the transition and dispatches (p ointer|mouse)(over|out|enter|leave) events to them.
295 void sendNodeTransitionEvents(Node*, Node*, const PlatformMouseEvent&);
296
297 MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&); 290 MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
298 291
299 WebInputEventResult dispatchMouseEvent(const AtomicString& eventType, Node* target, int clickCount, const PlatformMouseEvent&); 292 WebInputEventResult dispatchMouseEvent(const AtomicString& eventType, Node* target, int clickCount, const PlatformMouseEvent&);
300 293
301 // Dispatches ME after corresponding PE provided the PE has not been cancele d. The eventType arg 294 // Dispatches ME after corresponding PE provided the PE has not been cancele d. The eventType arg
302 // must be a mouse event that can be gated though a preventDefaulted pointer down (i.e., one of 295 // must be a mouse event that can be gated though a preventDefaulted pointer down (i.e., one of
303 // {mousedown, mousemove, mouseup}). 296 // {mousedown, mousemove, mouseup}).
304 // TODO(mustaq): Can we avoid the clickCount param, instead use PlatformMous eEvent's count? 297 // TODO(mustaq): Can we avoid the clickCount param, instead use PlatformMous eEvent's count?
305 // Same applied to dispatchMouseEvent() above. 298 // Same applied to dispatchMouseEvent() above.
306 WebInputEventResult updatePointerTargetAndDispatchEvents(const AtomicString& mouseEventType, Node* target, 299 WebInputEventResult updatePointerTargetAndDispatchEvents(const AtomicString& mouseEventType, Node* target,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 WebInputEventResult handleGestureShowPress(); 333 WebInputEventResult handleGestureShowPress();
341 334
342 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); 335 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&);
343 336
344 WebInputEventResult passScrollGestureEventToWidget(const PlatformGestureEven t&, LayoutObject*); 337 WebInputEventResult passScrollGestureEventToWidget(const PlatformGestureEven t&, LayoutObject*);
345 338
346 AutoscrollController* autoscrollController() const; 339 AutoscrollController* autoscrollController() const;
347 bool panScrollInProgress() const; 340 bool panScrollInProgress() const;
348 void setLastKnownMousePosition(const PlatformMouseEvent&); 341 void setLastKnownMousePosition(const PlatformMouseEvent&);
349 342
350 void conditionallyEnableMouseEventForPointerTypeMouse(const PlatformMouseEve nt&);
351
352 bool shouldTopControlsConsumeScroll(FloatSize) const; 343 bool shouldTopControlsConsumeScroll(FloatSize) const;
353 344
354 // If the given element is a shadow host and its root has delegatesFocus=fal se flag, 345 // If the given element is a shadow host and its root has delegatesFocus=fal se flag,
355 // slide focus to its inner element. Returns true if the resulting focus is different from 346 // slide focus to its inner element. Returns true if the resulting focus is different from
356 // the given element. 347 // the given element.
357 bool slideFocusOnShadowHostIfNecessary(const Element&); 348 bool slideFocusOnShadowHostIfNecessary(const Element&);
358 349
359 void dispatchPointerEvents(const PlatformTouchEvent&, WillBeHeapVector<Touch Info>&); 350 void dispatchPointerEvents(const PlatformTouchEvent&, WillBeHeapVector<Touch Info>&);
360 void sendPointerCancels(WillBeHeapVector<TouchInfo>&); 351 void sendPointerCancels(WillBeHeapVector<TouchInfo>&);
361 352
(...skipping 26 matching lines...) Expand all
388 379
389 Timer<EventHandler> m_fakeMouseMoveEventTimer; 380 Timer<EventHandler> m_fakeMouseMoveEventTimer;
390 381
391 bool m_svgPan; 382 bool m_svgPan;
392 383
393 RawPtrWillBeMember<PaintLayerScrollableArea> m_resizeScrollableArea; 384 RawPtrWillBeMember<PaintLayerScrollableArea> m_resizeScrollableArea;
394 385
395 RefPtrWillBeMember<Node> m_capturingMouseEventsNode; 386 RefPtrWillBeMember<Node> m_capturingMouseEventsNode;
396 bool m_eventHandlerWillResetCapturingMouseEventsNode; 387 bool m_eventHandlerWillResetCapturingMouseEventsNode;
397 388
389 // Note the difference of this and m_nodeUnderPointer in PointerEventManager
398 RefPtrWillBeMember<Node> m_nodeUnderMouse; 390 RefPtrWillBeMember<Node> m_nodeUnderMouse;
391
399 RefPtrWillBeMember<LocalFrame> m_lastMouseMoveEventSubframe; 392 RefPtrWillBeMember<LocalFrame> m_lastMouseMoveEventSubframe;
400 RefPtrWillBeMember<Scrollbar> m_lastScrollbarUnderMouse; 393 RefPtrWillBeMember<Scrollbar> m_lastScrollbarUnderMouse;
401 394
402 int m_clickCount; 395 int m_clickCount;
403 RefPtrWillBeMember<Node> m_clickNode; 396 RefPtrWillBeMember<Node> m_clickNode;
404 397
405 RefPtrWillBeMember<Node> m_dragTarget; 398 RefPtrWillBeMember<Node> m_dragTarget;
406 bool m_shouldOnlyFireDragOverEvent; 399 bool m_shouldOnlyFireDragOverEvent;
407 400
408 RefPtrWillBeMember<HTMLFrameSetElement> m_frameSetBeingResized; 401 RefPtrWillBeMember<HTMLFrameSetElement> m_frameSetBeingResized;
(...skipping 18 matching lines...) Expand all
427 TouchTargetMap m_targetForTouchID; 420 TouchTargetMap m_targetForTouchID;
428 421
429 // If set, the document of the active touch sequence. Unset if no touch sequ ence active. 422 // If set, the document of the active touch sequence. Unset if no touch sequ ence active.
430 RefPtrWillBeMember<Document> m_touchSequenceDocument; 423 RefPtrWillBeMember<Document> m_touchSequenceDocument;
431 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; 424 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
432 425
433 bool m_touchPressed; 426 bool m_touchPressed;
434 427
435 PointerEventManager m_pointerEventManager; 428 PointerEventManager m_pointerEventManager;
436 429
437 // Prevents firing mousedown, mousemove & mouseup in-between a canceled poin terdown and next pointerup/pointercancel.
438 // See "PREVENT MOUSE EVENT flag" in the spec:
439 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-e vents
440 bool m_preventMouseEventForPointerTypeMouse;
441
442 // This is set upon sending a pointercancel for touch, prevents PE dispatche s for touches until 430 // This is set upon sending a pointercancel for touch, prevents PE dispatche s for touches until
443 // all touch-points become inactive. 431 // all touch-points become inactive.
444 // TODO(mustaq): Consider a state per pointerType, as in PointerIdManager? E xclude mouse? 432 // TODO(mustaq): Consider a state per pointerType, as in PointerIdManager? E xclude mouse?
445 bool m_inPointerCanceledState; 433 bool m_inPointerCanceledState;
446 434
447 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode; 435 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode;
448 bool m_lastGestureScrollOverWidget; 436 bool m_lastGestureScrollOverWidget;
449 // The most recent element to scroll natively during this scroll 437 // The most recent element to scroll natively during this scroll
450 // sequence. Null if no native element has scrolled this scroll 438 // sequence. Null if no native element has scrolled this scroll
451 // sequence, or if the most recent element to scroll used scroll 439 // sequence, or if the most recent element to scroll used scroll
(...skipping 17 matching lines...) Expand all
469 // scroll which shouldn't propagate can't cause any element to 457 // scroll which shouldn't propagate can't cause any element to
470 // scroll other than the |m_previousGestureScrolledNode|. 458 // scroll other than the |m_previousGestureScrolledNode|.
471 bool m_deltaConsumedForScrollSequence; 459 bool m_deltaConsumedForScrollSequence;
472 }; 460 };
473 461
474 } // namespace blink 462 } // namespace blink
475 463
476 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::EventHandler::TouchInfo); 464 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::EventHandler::TouchInfo);
477 465
478 #endif // EventHandler_h 466 #endif // EventHandler_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698