| 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 | 1239 |
| 1240 return swallowEvent; | 1240 return swallowEvent; |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 void EventHandler::invalidateClick() | 1243 void EventHandler::invalidateClick() |
| 1244 { | 1244 { |
| 1245 m_clickCount = 0; | 1245 m_clickCount = 0; |
| 1246 m_clickNode = nullptr; | 1246 m_clickNode = nullptr; |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 static Node* parentForClickEvent(const Node& node) | |
| 1250 { | |
| 1251 // IE doesn't dispatch click events for mousedown/mouseup events across form | |
| 1252 // controls. | |
| 1253 if (node.isHTMLElement() && toHTMLElement(node).isInteractiveContent()) | |
| 1254 return 0; | |
| 1255 return NodeRenderingTraversal::parent(&node); | |
| 1256 } | |
| 1257 | |
| 1258 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) | 1249 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) |
| 1259 { | 1250 { |
| 1260 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); | 1251 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); |
| 1261 | 1252 |
| 1262 RefPtr<FrameView> protector(m_frame->view()); | 1253 RefPtr<FrameView> protector(m_frame->view()); |
| 1263 | 1254 |
| 1264 m_frame->selection().setCaretBlinkingSuspended(false); | 1255 m_frame->selection().setCaretBlinkingSuspended(false); |
| 1265 | 1256 |
| 1266 OwnPtr<UserGestureIndicator> gestureIndicator; | 1257 OwnPtr<UserGestureIndicator> gestureIndicator; |
| 1267 | 1258 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1286 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; | 1277 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; |
| 1287 HitTestRequest request(hitType); | 1278 HitTestRequest request(hitType); |
| 1288 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1279 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
| 1289 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1280 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 1290 m_capturingMouseEventsNode = nullptr; | 1281 m_capturingMouseEventsNode = nullptr; |
| 1291 | 1282 |
| 1292 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.
targetNode(), m_clickCount, mouseEvent, false); | 1283 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.
targetNode(), m_clickCount, mouseEvent, false); |
| 1293 | 1284 |
| 1294 bool swallowClickEvent = false; | 1285 bool swallowClickEvent = false; |
| 1295 if (m_clickCount > 0 && mev.targetNode() && m_clickNode) { | 1286 if (m_clickCount > 0 && mev.targetNode() && m_clickNode) { |
| 1296 if (Node* clickTargetNode = mev.targetNode()->commonAncestor(*m_clickNod
e, parentForClickEvent)) | 1287 if (Node* clickTargetNode = NodeRenderingTraversal::commonAncestor(*mev.
targetNode(), *m_clickNode)) |
| 1297 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, m_clickCount, mouseEvent, true); | 1288 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, m_clickCount, mouseEvent, true); |
| 1298 } | 1289 } |
| 1299 | 1290 |
| 1300 if (m_resizeScrollableArea) { | 1291 if (m_resizeScrollableArea) { |
| 1301 m_resizeScrollableArea->setInResizeMode(false); | 1292 m_resizeScrollableArea->setInResizeMode(false); |
| 1302 m_resizeScrollableArea = 0; | 1293 m_resizeScrollableArea = 0; |
| 1303 } | 1294 } |
| 1304 | 1295 |
| 1305 bool swallowMouseReleaseEvent = false; | 1296 bool swallowMouseReleaseEvent = false; |
| 1306 if (!swallowMouseUpEvent) | 1297 if (!swallowMouseUpEvent) |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 if (currentHitTest.innerNode()) | 1754 if (currentHitTest.innerNode()) |
| 1764 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestReq
uest::ReadOnly); | 1755 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestReq
uest::ReadOnly); |
| 1765 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), | 1756 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), |
| 1766 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), | 1757 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), |
| 1767 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 1758 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 1768 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr
entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); | 1759 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr
entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); |
| 1769 | 1760 |
| 1770 bool swallowClickEvent = false; | 1761 bool swallowClickEvent = false; |
| 1771 if (m_clickNode) { | 1762 if (m_clickNode) { |
| 1772 if (currentHitTest.innerNode()) { | 1763 if (currentHitTest.innerNode()) { |
| 1773 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
m_clickNode, parentForClickEvent); | 1764 Node* clickTargetNode = NodeRenderingTraversal::commonAncestor(*curr
entHitTest.innerNode(), *m_clickNode); |
| 1774 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, gestureEvent.tapCount(), fakeMouseUp, true); | 1765 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click
TargetNode, gestureEvent.tapCount(), fakeMouseUp, true); |
| 1775 } | 1766 } |
| 1776 m_clickNode = nullptr; | 1767 m_clickNode = nullptr; |
| 1777 } | 1768 } |
| 1778 | 1769 |
| 1779 if (!swallowMouseUpEvent) | 1770 if (!swallowMouseUpEvent) |
| 1780 swallowMouseUpEvent = handleMouseReleaseEvent(MouseEventWithHitTestResul
ts(fakeMouseUp, currentHitTest)); | 1771 swallowMouseUpEvent = handleMouseReleaseEvent(MouseEventWithHitTestResul
ts(fakeMouseUp, currentHitTest)); |
| 1781 | 1772 |
| 1782 return swallowMouseDownEvent | swallowMouseUpEvent | swallowClickEvent; | 1773 return swallowMouseDownEvent | swallowMouseUpEvent | swallowClickEvent; |
| 1783 } | 1774 } |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 // IE matches lower and upper case access keys regardless of Shift key state
- but if both upper and | 2254 // IE matches lower and upper case access keys regardless of Shift key state
- but if both upper and |
| 2264 // lower case variants are present in a document, the correct element is mat
ched based on Shift key state. | 2255 // lower case variants are present in a document, the correct element is mat
ched based on Shift key state. |
| 2265 // Firefox only matches an access key if Shift is not pressed, and does that
case-insensitively. | 2256 // Firefox only matches an access key if Shift is not pressed, and does that
case-insensitively. |
| 2266 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); | 2257 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); |
| 2267 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) | 2258 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) |
| 2268 return false; | 2259 return false; |
| 2269 String key = evt.unmodifiedText(); | 2260 String key = evt.unmodifiedText(); |
| 2270 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); | 2261 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); |
| 2271 if (!elem) | 2262 if (!elem) |
| 2272 return false; | 2263 return false; |
| 2273 elem->accessKeyAction(false); | 2264 // FIXME(sky): We should probably pass SendMouseUpDownEvents here, not |
| 2265 // firing mouseup and mousedown is IE legacy. |
| 2266 elem->dispatchSimulatedClick(0, SendNoEvents); |
| 2274 return true; | 2267 return true; |
| 2275 } | 2268 } |
| 2276 | 2269 |
| 2277 bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) | 2270 bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) |
| 2278 { | 2271 { |
| 2279 RefPtr<FrameView> protector(m_frame->view()); | 2272 RefPtr<FrameView> protector(m_frame->view()); |
| 2280 | 2273 |
| 2281 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) | 2274 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) |
| 2282 capsLockStateMayHaveChanged(); | 2275 capsLockStateMayHaveChanged(); |
| 2283 | 2276 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2812 unsigned EventHandler::accessKeyModifiers() | 2805 unsigned EventHandler::accessKeyModifiers() |
| 2813 { | 2806 { |
| 2814 #if OS(MACOSX) | 2807 #if OS(MACOSX) |
| 2815 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 2808 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 2816 #else | 2809 #else |
| 2817 return PlatformEvent::AltKey; | 2810 return PlatformEvent::AltKey; |
| 2818 #endif | 2811 #endif |
| 2819 } | 2812 } |
| 2820 | 2813 |
| 2821 } // namespace blink | 2814 } // namespace blink |
| OLD | NEW |