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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); | 237 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); |
238 } | 238 } |
239 | 239 |
240 void EventHandler::trace(Visitor* visitor) | 240 void EventHandler::trace(Visitor* visitor) |
241 { | 241 { |
242 #if ENABLE(OILPAN) | 242 #if ENABLE(OILPAN) |
243 visitor->trace(m_mousePressNode); | 243 visitor->trace(m_mousePressNode); |
244 visitor->trace(m_capturingMouseEventsNode); | 244 visitor->trace(m_capturingMouseEventsNode); |
245 visitor->trace(m_nodeUnderMouse); | 245 visitor->trace(m_nodeUnderMouse); |
246 visitor->trace(m_lastNodeUnderMouse); | 246 visitor->trace(m_lastNodeUnderMouse); |
247 visitor->trace(m_lastMouseMoveEventSubframe); | |
247 visitor->trace(m_clickNode); | 248 visitor->trace(m_clickNode); |
248 visitor->trace(m_dragTarget); | 249 visitor->trace(m_dragTarget); |
249 visitor->trace(m_frameSetBeingResized); | 250 visitor->trace(m_frameSetBeingResized); |
250 visitor->trace(m_latchedWheelEventNode); | 251 visitor->trace(m_latchedWheelEventNode); |
251 visitor->trace(m_previousWheelScrolledNode); | 252 visitor->trace(m_previousWheelScrolledNode); |
252 visitor->trace(m_targetForTouchID); | 253 visitor->trace(m_targetForTouchID); |
253 visitor->trace(m_touchSequenceDocument); | 254 visitor->trace(m_touchSequenceDocument); |
254 visitor->trace(m_scrollGestureHandlingNode); | 255 visitor->trace(m_scrollGestureHandlingNode); |
255 visitor->trace(m_previousGestureScrolledNode); | 256 visitor->trace(m_previousGestureScrolledNode); |
256 visitor->trace(m_lastDeferredTapElement); | 257 visitor->trace(m_lastDeferredTapElement); |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent. position()); | 1232 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent. position()); |
1232 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re quest, documentPoint, mouseEvent); | 1233 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re quest, documentPoint, mouseEvent); |
1233 | 1234 |
1234 if (!mev.innerNode()) { | 1235 if (!mev.innerNode()) { |
1235 invalidateClick(); | 1236 invalidateClick(); |
1236 return false; | 1237 return false; |
1237 } | 1238 } |
1238 | 1239 |
1239 m_mousePressNode = mev.innerNode(); | 1240 m_mousePressNode = mev.innerNode(); |
1240 | 1241 |
1241 RefPtr<LocalFrame> subframe = subframeForHitTestResult(mev); | 1242 RefPtrWillBeRawPtr<LocalFrame> subframe = subframeForHitTestResult(mev); |
1242 if (subframe && passMousePressEventToSubframe(mev, subframe.get())) { | 1243 if (subframe && passMousePressEventToSubframe(mev, subframe.get())) { |
1243 // Start capturing future events for this frame. We only do this if we didn't clear | 1244 // Start capturing future events for this frame. We only do this if we didn't clear |
1244 // the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop. | 1245 // the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop. |
1245 m_capturesDragging = subframe->eventHandler().capturesDragging(); | 1246 m_capturesDragging = subframe->eventHandler().capturesDragging(); |
1246 if (m_mousePressed && m_capturesDragging) { | 1247 if (m_mousePressed && m_capturesDragging) { |
1247 m_capturingMouseEventsNode = mev.innerNode(); | 1248 m_capturingMouseEventsNode = mev.innerNode(); |
1248 m_eventHandlerWillResetCapturingMouseEventsNode = true; | 1249 m_eventHandlerWillResetCapturingMouseEventsNode = true; |
1249 } | 1250 } |
1250 invalidateClick(); | 1251 invalidateClick(); |
1251 return true; | 1252 return true; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1437 else { | 1438 else { |
1438 if (!scrollbar) | 1439 if (!scrollbar) |
1439 scrollbar = mev.scrollbar(); | 1440 scrollbar = mev.scrollbar(); |
1440 | 1441 |
1441 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); | 1442 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); |
1442 if (onlyUpdateScrollbars) | 1443 if (onlyUpdateScrollbars) |
1443 return true; | 1444 return true; |
1444 } | 1445 } |
1445 | 1446 |
1446 bool swallowEvent = false; | 1447 bool swallowEvent = false; |
1447 RefPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1448 RefPtrWillBeRawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get( ) ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTest Result(mev); |
1448 | 1449 |
1449 // We want mouseouts to happen first, from the inside out. First send a mov e event to the last subframe so that it will fire mouseouts. | 1450 // We want mouseouts to happen first, from the inside out. First send a mov e event to the last subframe so that it will fire mouseouts. |
1450 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) | 1451 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) |
1451 passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get()); | 1452 passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get()); |
1452 | 1453 |
1453 if (newSubframe) { | 1454 if (newSubframe) { |
1454 // Update over/out state before passing the event to the subframe. | 1455 // Update over/out state before passing the event to the subframe. |
1455 updateMouseEventTargetNode(mev.innerNode(), mouseEvent, true); | 1456 updateMouseEventTargetNode(mev.innerNode(), mouseEvent, true); |
1456 | 1457 |
1457 // Event dispatch in updateMouseEventTargetNode may have caused the subf rame of the target | 1458 // Event dispatch in updateMouseEventTargetNode may have caused the subf rame of the target |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2073 if (gestureEvent.isScrollEvent()) | 2074 if (gestureEvent.isScrollEvent()) |
2074 return handleGestureScrollEvent(gestureEvent); | 2075 return handleGestureScrollEvent(gestureEvent); |
2075 | 2076 |
2076 // Non-scrolling related gesture events instead do a single cross-frame hit- test and | 2077 // Non-scrolling related gesture events instead do a single cross-frame hit- test and |
2077 // jump directly to the inner most frame. This matches handleMousePressEvent etc. | 2078 // jump directly to the inner most frame. This matches handleMousePressEvent etc. |
2078 | 2079 |
2079 // Hit test across all frames and do touch adjustment as necessary for the e vent type. | 2080 // Hit test across all frames and do touch adjustment as necessary for the e vent type. |
2080 GestureEventWithHitTestResults targetedEvent = targetGestureEvent(gestureEve nt); | 2081 GestureEventWithHitTestResults targetedEvent = targetGestureEvent(gestureEve nt); |
2081 | 2082 |
2082 // Route to the correct frame. | 2083 // Route to the correct frame. |
2083 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame()) | 2084 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame()) { |
Mads Ager (chromium)
2014/09/16 12:17:45
Left-over edit from debugging? :)
sof
2014/09/17 09:42:58
Spot on :)
| |
2084 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); | 2085 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); |
2086 } | |
2085 | 2087 |
2086 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? | 2088 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? |
2087 return handleGestureEventInFrame(targetedEvent); | 2089 return handleGestureEventInFrame(targetedEvent); |
2088 } | 2090 } |
2089 | 2091 |
2090 bool EventHandler::handleGestureEventInFrame(const GestureEventWithHitTestResult s& targetedEvent) | 2092 bool EventHandler::handleGestureEventInFrame(const GestureEventWithHitTestResult s& targetedEvent) |
2091 { | 2093 { |
2092 ASSERT(!targetedEvent.event().isScrollEvent()); | 2094 ASSERT(!targetedEvent.event().isScrollEvent()); |
2093 | 2095 |
2094 RefPtrWillBeRawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNo de(); | 2096 RefPtrWillBeRawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNo de(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2195 return false; | 2197 return false; |
2196 default: | 2198 default: |
2197 ASSERT_NOT_REACHED(); | 2199 ASSERT_NOT_REACHED(); |
2198 return false; | 2200 return false; |
2199 } | 2201 } |
2200 } | 2202 } |
2201 | 2203 |
2202 bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target edEvent) | 2204 bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target edEvent) |
2203 { | 2205 { |
2204 RefPtr<FrameView> protector(m_frame->view()); | 2206 RefPtr<FrameView> protector(m_frame->view()); |
2207 | |
2205 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2208 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
2206 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type()); | 2209 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type()); |
2207 | 2210 |
2208 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 2211 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
2209 | 2212 |
2210 unsigned modifierFlags = 0; | 2213 unsigned modifierFlags = 0; |
2211 if (gestureEvent.altKey()) | 2214 if (gestureEvent.altKey()) |
2212 modifierFlags |= PlatformEvent::AltKey; | 2215 modifierFlags |= PlatformEvent::AltKey; |
2213 if (gestureEvent.ctrlKey()) | 2216 if (gestureEvent.ctrlKey()) |
2214 modifierFlags |= PlatformEvent::CtrlKey; | 2217 modifierFlags |= PlatformEvent::CtrlKey; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2289 | 2292 |
2290 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1, | 2293 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1, |
2291 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), PlatformMouseEvent::FromTouch, WTF::currentTime()); | 2294 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), PlatformMouseEvent::FromTouch, WTF::currentTime()); |
2292 HitTestRequest request(HitTestRequest::ReadOnly); | 2295 HitTestRequest request(HitTestRequest::ReadOnly); |
2293 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); | 2296 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); |
2294 m_didStartDrag = false; | 2297 m_didStartDrag = false; |
2295 m_mouseDownMayStartDrag = true; | 2298 m_mouseDownMayStartDrag = true; |
2296 dragState().m_dragSrc = nullptr; | 2299 dragState().m_dragSrc = nullptr; |
2297 m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.positi on()); | 2300 m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.positi on()); |
2298 RefPtr<FrameView> protector(m_frame->view()); | 2301 RefPtr<FrameView> protector(m_frame->view()); |
2302 | |
2299 handleDrag(mev, DontCheckDragHysteresis); | 2303 handleDrag(mev, DontCheckDragHysteresis); |
2300 if (m_didStartDrag) { | 2304 if (m_didStartDrag) { |
2301 m_longTapShouldInvokeContextMenu = true; | 2305 m_longTapShouldInvokeContextMenu = true; |
2302 return true; | 2306 return true; |
2303 } | 2307 } |
2304 } | 2308 } |
2305 #if OS(ANDROID) | 2309 #if OS(ANDROID) |
2306 bool shouldLongPressSelectWord = true; | 2310 bool shouldLongPressSelectWord = true; |
2307 #else | 2311 #else |
2308 bool shouldLongPressSelectWord = m_frame->settings() && m_frame->settings()- >touchEditingEnabled(); | 2312 bool shouldLongPressSelectWord = m_frame->settings() && m_frame->settings()- >touchEditingEnabled(); |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3868 unsigned EventHandler::accessKeyModifiers() | 3872 unsigned EventHandler::accessKeyModifiers() |
3869 { | 3873 { |
3870 #if OS(MACOSX) | 3874 #if OS(MACOSX) |
3871 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3875 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3872 #else | 3876 #else |
3873 return PlatformEvent::AltKey; | 3877 return PlatformEvent::AltKey; |
3874 #endif | 3878 #endif |
3875 } | 3879 } |
3876 | 3880 |
3877 } // namespace blink | 3881 } // namespace blink |
OLD | NEW |