| 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 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 if (gestureEvent.shiftKey()) | 2224 if (gestureEvent.shiftKey()) |
| 2225 modifierFlags |= PlatformEvent::ShiftKey; | 2225 modifierFlags |= PlatformEvent::ShiftKey; |
| 2226 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m
odifierFlags); | 2226 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m
odifierFlags); |
| 2227 | 2227 |
| 2228 HitTestResult currentHitTest = targetedEvent.hitTestResult(); | 2228 HitTestResult currentHitTest = targetedEvent.hitTestResult(); |
| 2229 | 2229 |
| 2230 // We use the adjusted position so the application isn't surprised to see a
event with | 2230 // We use the adjusted position so the application isn't surprised to see a
event with |
| 2231 // co-ordinates outside the target's bounds. | 2231 // co-ordinates outside the target's bounds. |
| 2232 IntPoint adjustedPoint = m_frame->view()->windowToContents(gestureEvent.posi
tion()); | 2232 IntPoint adjustedPoint = m_frame->view()->windowToContents(gestureEvent.posi
tion()); |
| 2233 | 2233 |
| 2234 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(
), | 2234 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa
lPosition(), |
| 2235 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | 2235 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, |
| 2236 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2236 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2237 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0,
fakeMouseMove, true); | 2237 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0,
fakeMouseMove, true); |
| 2238 | 2238 |
| 2239 // Do a new hit-test in case the mousemove event changed the DOM. | 2239 // Do a new hit-test in case the mousemove event changed the DOM. |
| 2240 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we | 2240 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we |
| 2241 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page | 2241 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page |
| 2242 // could have seen the event anyway). | 2242 // could have seen the event anyway). |
| 2243 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 2243 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
| 2244 if (currentHitTest.innerNode()) | 2244 if (currentHitTest.innerNode()) |
| 2245 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); | 2245 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
| 2246 m_clickNode = currentHitTest.innerNode(); | 2246 m_clickNode = currentHitTest.innerNode(); |
| 2247 if (m_clickNode && m_clickNode->isTextNode()) | 2247 if (m_clickNode && m_clickNode->isTextNode()) |
| 2248 m_clickNode = NodeRenderingTraversal::parent(m_clickNode.get()); | 2248 m_clickNode = NodeRenderingTraversal::parent(m_clickNode.get()); |
| 2249 | 2249 |
| 2250 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(
), | 2250 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), |
| 2251 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), | 2251 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), |
| 2252 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2252 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2253 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); | 2253 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); |
| 2254 if (!swallowMouseDownEvent) | 2254 if (!swallowMouseDownEvent) |
| 2255 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown); | 2255 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown); |
| 2256 if (!swallowMouseDownEvent) | 2256 if (!swallowMouseDownEvent) |
| 2257 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, currentHitTest)); | 2257 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, currentHitTest)); |
| 2258 | 2258 |
| 2259 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 2259 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
| 2260 if (currentHitTest.innerNode()) | 2260 if (currentHitTest.innerNode()) |
| 2261 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); | 2261 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
| 2262 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), | 2262 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP
osition(), |
| 2263 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), | 2263 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), |
| 2264 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2264 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2265 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr
entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); | 2265 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr
entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); |
| 2266 | 2266 |
| 2267 bool swallowClickEvent = false; | 2267 bool swallowClickEvent = false; |
| 2268 if (m_clickNode) { | 2268 if (m_clickNode) { |
| 2269 if (currentHitTest.innerNode()) { | 2269 if (currentHitTest.innerNode()) { |
| 2270 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
m_clickNode, parentForClickEvent); | 2270 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
m_clickNode, parentForClickEvent); |
| 2271 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, gestureEvent.tapCount(), fakeMouseUp, true); | 2271 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, gestureEvent.tapCount(), fakeMouseUp, true); |
| 2272 } | 2272 } |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3874 unsigned EventHandler::accessKeyModifiers() | 3874 unsigned EventHandler::accessKeyModifiers() |
| 3875 { | 3875 { |
| 3876 #if OS(MACOSX) | 3876 #if OS(MACOSX) |
| 3877 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3877 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3878 #else | 3878 #else |
| 3879 return PlatformEvent::AltKey; | 3879 return PlatformEvent::AltKey; |
| 3880 #endif | 3880 #endif |
| 3881 } | 3881 } |
| 3882 | 3882 |
| 3883 } // namespace blink | 3883 } // namespace blink |
| OLD | NEW |