OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 #include "core/svg/SVGElementInstance.h" | 104 #include "core/svg/SVGElementInstance.h" |
105 #include "core/svg/SVGUseElement.h" | 105 #include "core/svg/SVGUseElement.h" |
106 #endif | 106 #endif |
107 | 107 |
108 #if ENABLE(CSS_IMAGE_SET) | 108 #if ENABLE(CSS_IMAGE_SET) |
109 #include "core/rendering/style/StyleCachedImageSet.h" | 109 #include "core/rendering/style/StyleCachedImageSet.h" |
110 #endif | 110 #endif |
111 | 111 |
112 namespace WebCore { | 112 namespace WebCore { |
113 | 113 |
| 114 DEFINE_GC_MAP(EventHandler); |
| 115 |
114 using namespace HTMLNames; | 116 using namespace HTMLNames; |
115 | 117 |
116 // The link drag hysteresis is much larger than the others because there | 118 // The link drag hysteresis is much larger than the others because there |
117 // needs to be enough space to cancel the link press without starting a link dra
g, | 119 // needs to be enough space to cancel the link press without starting a link dra
g, |
118 // and because dragging links is rare. | 120 // and because dragging links is rare. |
119 const int LinkDragHysteresis = 40; | 121 const int LinkDragHysteresis = 40; |
120 const int ImageDragHysteresis = 5; | 122 const int ImageDragHysteresis = 5; |
121 const int TextDragHysteresis = 3; | 123 const int TextDragHysteresis = 3; |
122 const int GeneralDragHysteresis = 3; | 124 const int GeneralDragHysteresis = 3; |
123 | 125 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 m_mousePositionIsUnknown = true; | 356 m_mousePositionIsUnknown = true; |
355 m_lastKnownMousePosition = IntPoint(); | 357 m_lastKnownMousePosition = IntPoint(); |
356 m_lastKnownMouseGlobalPosition = IntPoint(); | 358 m_lastKnownMouseGlobalPosition = IntPoint(); |
357 m_lastMouseDownUserGestureToken.clear(); | 359 m_lastMouseDownUserGestureToken.clear(); |
358 m_mousePressNode = nullptr; | 360 m_mousePressNode = nullptr; |
359 m_mousePressed = false; | 361 m_mousePressed = false; |
360 m_capturesDragging = false; | 362 m_capturesDragging = false; |
361 m_capturingMouseEventsNode = nullptr; | 363 m_capturingMouseEventsNode = nullptr; |
362 m_latchedWheelEventNode = nullptr; | 364 m_latchedWheelEventNode = nullptr; |
363 m_previousWheelScrolledNode = nullptr; | 365 m_previousWheelScrolledNode = nullptr; |
364 m_originatingTouchPointTargets->clear(); | 366 m_originatingTouchPointTargets.clear(); |
365 m_originatingTouchPointDocument.clear(); | 367 m_originatingTouchPointDocument.clear(); |
366 m_originatingTouchPointTargetKey = 0; | 368 m_originatingTouchPointTargetKey = 0; |
367 m_scrollGestureHandlingNode = nullptr; | 369 m_scrollGestureHandlingNode = nullptr; |
368 m_lastHitTestResultOverWidget = false; | 370 m_lastHitTestResultOverWidget = false; |
369 m_previousGestureScrolledNode = nullptr; | 371 m_previousGestureScrolledNode = nullptr; |
370 m_scrollbarHandlingScrollGesture = 0; | 372 m_scrollbarHandlingScrollGesture = 0; |
371 m_maxMouseMovedDuration = 0; | 373 m_maxMouseMovedDuration = 0; |
372 m_baseEventType = PlatformEvent::NoType; | 374 m_baseEventType = PlatformEvent::NoType; |
373 m_didStartDrag = false; | 375 m_didStartDrag = false; |
374 m_didLongPressInvokeContextMenu = false; | 376 m_didLongPressInvokeContextMenu = false; |
(...skipping 3390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3765 HANDLE(Document) doc = node->document(); | 3767 HANDLE(Document) doc = node->document(); |
3766 // Record the originating touch document even if it does not have a
touch listener. | 3768 // Record the originating touch document even if it does not have a
touch listener. |
3767 if (freshTouchEvents) { | 3769 if (freshTouchEvents) { |
3768 m_originatingTouchPointDocument = doc; | 3770 m_originatingTouchPointDocument = doc; |
3769 freshTouchEvents = false; | 3771 freshTouchEvents = false; |
3770 } | 3772 } |
3771 if (!doc) | 3773 if (!doc) |
3772 continue; | 3774 continue; |
3773 if (!doc->hasTouchEventHandlers()) | 3775 if (!doc->hasTouchEventHandlers()) |
3774 continue; | 3776 continue; |
3775 m_originatingTouchPointTargets->set(touchPointTargetKey, node); | 3777 m_originatingTouchPointTargets.set(touchPointTargetKey, node); |
3776 touchTarget = node; | 3778 touchTarget = node; |
3777 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState
== PlatformTouchPoint::TouchCancelled) { | 3779 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState
== PlatformTouchPoint::TouchCancelled) { |
3778 // We only perform a hittest on release or cancel to unset :active o
r :hover state. | 3780 // We only perform a hittest on release or cancel to unset :active o
r :hover state. |
3779 if (touchPointTargetKey == m_originatingTouchPointTargetKey) { | 3781 if (touchPointTargetKey == m_originatingTouchPointTargetKey) { |
3780 hitTestResultAtPoint(pagePoint, hitType); | 3782 hitTestResultAtPoint(pagePoint, hitType); |
3781 m_originatingTouchPointTargetKey = 0; | 3783 m_originatingTouchPointTargetKey = 0; |
3782 } else if (m_originatingTouchPointDocument && m_originatingTouchPoin
tDocument->frame()) { | 3784 } else if (m_originatingTouchPointDocument && m_originatingTouchPoin
tDocument->frame()) { |
3783 LayoutPoint pagePointInOriginatingDocument = documentPointForWin
dowPoint(m_originatingTouchPointDocument->frame(), point.pos()); | 3785 LayoutPoint pagePointInOriginatingDocument = documentPointForWin
dowPoint(m_originatingTouchPointDocument->frame(), point.pos()); |
3784 hitTestResultInFrame(m_originatingTouchPointDocument->frame(), p
agePointInOriginatingDocument, hitType); | 3786 hitTestResultInFrame(m_originatingTouchPointDocument->frame(), p
agePointInOriginatingDocument, hitType); |
3785 } | 3787 } |
3786 // The target should be the original target for this touch, so get i
t from the hashmap. As it's a release or cancel | 3788 // The target should be the original target for this touch, so get i
t from the hashmap. As it's a release or cancel |
3787 // we also remove it from the map. | 3789 // we also remove it from the map. |
3788 touchTarget = m_originatingTouchPointTargets->take(touchPointTargetK
ey); | 3790 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe
y); |
3789 } else | 3791 } else |
3790 // No hittest is performed on move or stationary, since the target i
s not allowed to change anyway. | 3792 // No hittest is performed on move or stationary, since the target i
s not allowed to change anyway. |
3791 touchTarget = m_originatingTouchPointTargets->get(touchPointTargetKe
y); | 3793 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey
); |
3792 | 3794 |
3793 if (!touchTarget) | 3795 if (!touchTarget) |
3794 continue; | 3796 continue; |
3795 HANDLE(Document) doc = touchTarget->toNode()->document(); | 3797 HANDLE(Document) doc = touchTarget->toNode()->document(); |
3796 if (!doc) | 3798 if (!doc) |
3797 continue; | 3799 continue; |
3798 if (!doc->hasTouchEventHandlers()) | 3800 if (!doc->hasTouchEventHandlers()) |
3799 continue; | 3801 continue; |
3800 Frame* targetFrame = doc->frame(); | 3802 Frame* targetFrame = doc->frame(); |
3801 if (!targetFrame) | 3803 if (!targetFrame) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4002 | 4004 |
4003 unsigned EventHandler::accessKeyModifiers() | 4005 unsigned EventHandler::accessKeyModifiers() |
4004 { | 4006 { |
4005 #if OS(DARWIN) | 4007 #if OS(DARWIN) |
4006 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4008 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4007 #else | 4009 #else |
4008 return PlatformEvent::AltKey; | 4010 return PlatformEvent::AltKey; |
4009 #endif | 4011 #endif |
4010 } | 4012 } |
4011 | 4013 |
| 4014 void EventHandler::accept(Visitor* visitor) const |
| 4015 { |
| 4016 visitor->visit(m_mousePressNode); |
| 4017 visitor->visit(m_capturingMouseEventsNode); |
| 4018 visitor->visit(m_nodeUnderMouse); |
| 4019 visitor->visit(m_lastNodeUnderMouse); |
| 4020 visitor->visit(m_clickNode); |
| 4021 visitor->visit(m_dragTarget); |
| 4022 visitor->visit(m_frameSetBeingResized); |
| 4023 visitor->visit(m_latchedWheelEventNode); |
| 4024 visitor->visit(m_previousWheelScrolledNode); |
| 4025 visitor->visit(m_originatingTouchPointDocument); |
| 4026 visitor->visit(m_scrollGestureHandlingNode); |
| 4027 visitor->visit(m_previousGestureScrolledNode); |
| 4028 visitor->visit(m_originatingTouchPointTargets); |
| 4029 } |
| 4030 |
4012 } // namespace WebCore | 4031 } // namespace WebCore |
OLD | NEW |