Chromium Code Reviews| 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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 m_resizeScrollableArea = layer->scrollableArea(); | 1276 m_resizeScrollableArea = layer->scrollableArea(); |
| 1277 m_resizeScrollableArea->setInResizeMode(true); | 1277 m_resizeScrollableArea->setInResizeMode(true); |
| 1278 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC orner(p); | 1278 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC orner(p); |
| 1279 invalidateClick(); | 1279 invalidateClick(); |
| 1280 return true; | 1280 return true; |
| 1281 } | 1281 } |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 m_frame->selection().setCaretBlinkingSuspended(true); | 1284 m_frame->selection().setCaretBlinkingSuspended(true); |
| 1285 | 1285 |
| 1286 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targe tNode(), m_clickCount, mouseEvent, true); | 1286 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targe tNode(), m_clickCount, mouseEvent, true, false); |
| 1287 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); | 1287 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); |
| 1288 m_capturesDragging = !swallowEvent || mev.scrollbar(); | 1288 m_capturesDragging = !swallowEvent || mev.scrollbar(); |
| 1289 | 1289 |
| 1290 // If the hit testing originally determined the event was in a scrollbar, re fetch the MouseEventWithHitTestResults | 1290 // If the hit testing originally determined the event was in a scrollbar, re fetch the MouseEventWithHitTestResults |
| 1291 // in case the scrollbar widget was destroyed when the mouse event was handl ed. | 1291 // in case the scrollbar widget was destroyed when the mouse event was handl ed. |
| 1292 if (mev.scrollbar()) { | 1292 if (mev.scrollbar()) { |
| 1293 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou se.get(); | 1293 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou se.get(); |
| 1294 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active ); | 1294 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active ); |
| 1295 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou seEvent); | 1295 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou seEvent); |
| 1296 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get ()) | 1296 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get ()) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1391 m_cursorUpdateTimer.stop(); | 1391 m_cursorUpdateTimer.stop(); |
| 1392 | 1392 |
| 1393 cancelFakeMouseMoveEvent(); | 1393 cancelFakeMouseMoveEvent(); |
| 1394 | 1394 |
| 1395 if (m_svgPan) { | 1395 if (m_svgPan) { |
| 1396 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->wi ndowToContents(m_lastKnownMousePosition)); | 1396 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->wi ndowToContents(m_lastKnownMousePosition)); |
| 1397 return true; | 1397 return true; |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 if (m_frameSetBeingResized) | 1400 if (m_frameSetBeingResized) |
| 1401 return !dispatchMouseEvent(EventTypeNames::mousemove, m_frameSetBeingRes ized.get(), 0, mouseEvent, false); | 1401 return !dispatchMouseEvent(EventTypeNames::mousemove, m_frameSetBeingRes ized.get(), 0, mouseEvent, false, false); |
| 1402 | 1402 |
| 1403 // Send events right to a scrollbar if the mouse is pressed. | 1403 // Send events right to a scrollbar if the mouse is pressed. |
| 1404 if (m_lastScrollbarUnderMouse && m_mousePressed) { | 1404 if (m_lastScrollbarUnderMouse && m_mousePressed) { |
| 1405 m_lastScrollbarUnderMouse->mouseMoved(mouseEvent); | 1405 m_lastScrollbarUnderMouse->mouseMoved(mouseEvent); |
| 1406 return true; | 1406 return true; |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 // Mouse events simulated from touch should not hit-test again. | 1409 // Mouse events simulated from touch should not hit-test again. |
| 1410 ASSERT(!mouseEvent.fromTouch()); | 1410 ASSERT(!mouseEvent.fromTouch()); |
| 1411 | 1411 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1446 | 1446 |
| 1447 bool swallowEvent = false; | 1447 bool swallowEvent = false; |
| 1448 RefPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1448 RefPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
| 1449 | 1449 |
| 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 // 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. |
| 1451 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) |
| 1452 passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get()); | 1452 passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get()); |
| 1453 | 1453 |
| 1454 if (newSubframe) { | 1454 if (newSubframe) { |
| 1455 // Update over/out state before passing the event to the subframe. | 1455 // Update over/out state before passing the event to the subframe. |
| 1456 updateMouseEventTargetNode(mev.targetNode(), mouseEvent, true); | 1456 updateMouseEventTargetNode(mev.targetNode(), mouseEvent, true, false); |
| 1457 | 1457 |
| 1458 // 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 |
| 1459 // node to be detached from its FrameView, in which case the event shoul d not be passed. | 1459 // node to be detached from its FrameView, in which case the event shoul d not be passed. |
| 1460 if (newSubframe->view()) | 1460 if (newSubframe->view()) |
| 1461 swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(), hoveredNode); | 1461 swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(), hoveredNode); |
| 1462 } else { | 1462 } else { |
| 1463 if (scrollbar && !m_mousePressed) | 1463 if (scrollbar && !m_mousePressed) |
| 1464 scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platfo rms that support visual feedback on scrollbar hovering. | 1464 scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platfo rms that support visual feedback on scrollbar hovering. |
| 1465 if (FrameView* view = m_frame->view()) { | 1465 if (FrameView* view = m_frame->view()) { |
| 1466 OptionalCursor optionalCursor = selectCursor(mev.hitTestResult()); | 1466 OptionalCursor optionalCursor = selectCursor(mev.hitTestResult()); |
| 1467 if (optionalCursor.isCursorChange()) { | 1467 if (optionalCursor.isCursorChange()) { |
| 1468 m_currentMouseCursor = optionalCursor.cursor(); | 1468 m_currentMouseCursor = optionalCursor.cursor(); |
| 1469 view->setCursor(m_currentMouseCursor); | 1469 view->setCursor(m_currentMouseCursor); |
| 1470 } | 1470 } |
| 1471 } | 1471 } |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 m_lastMouseMoveEventSubframe = newSubframe; | 1474 m_lastMouseMoveEventSubframe = newSubframe; |
| 1475 | 1475 |
| 1476 if (swallowEvent) | 1476 if (swallowEvent) |
| 1477 return true; | 1477 return true; |
| 1478 | 1478 |
| 1479 swallowEvent = !dispatchMouseEvent(EventTypeNames::mousemove, mev.targetNode (), 0, mouseEvent, true); | 1479 swallowEvent = !dispatchMouseEvent(EventTypeNames::mousemove, mev.targetNode (), 0, mouseEvent, true, false); |
| 1480 if (!swallowEvent) | 1480 if (!swallowEvent) |
| 1481 swallowEvent = handleMouseDraggedEvent(mev); | 1481 swallowEvent = handleMouseDraggedEvent(mev); |
| 1482 | 1482 |
| 1483 return swallowEvent; | 1483 return swallowEvent; |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 void EventHandler::invalidateClick() | 1486 void EventHandler::invalidateClick() |
| 1487 { | 1487 { |
| 1488 m_clickCount = 0; | 1488 m_clickCount = 0; |
| 1489 m_clickNode = nullptr; | 1489 m_clickNode = nullptr; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1521 m_mousePressed = false; | 1521 m_mousePressed = false; |
| 1522 setLastKnownMousePosition(mouseEvent); | 1522 setLastKnownMousePosition(mouseEvent); |
| 1523 | 1523 |
| 1524 if (m_svgPan) { | 1524 if (m_svgPan) { |
| 1525 m_svgPan = false; | 1525 m_svgPan = false; |
| 1526 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->wi ndowToContents(m_lastKnownMousePosition)); | 1526 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->wi ndowToContents(m_lastKnownMousePosition)); |
| 1527 return true; | 1527 return true; |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 if (m_frameSetBeingResized) | 1530 if (m_frameSetBeingResized) |
| 1531 return !dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResiz ed.get(), m_clickCount, mouseEvent, false); | 1531 return !dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResiz ed.get(), m_clickCount, mouseEvent, false, false); |
| 1532 | 1532 |
| 1533 if (m_lastScrollbarUnderMouse) { | 1533 if (m_lastScrollbarUnderMouse) { |
| 1534 invalidateClick(); | 1534 invalidateClick(); |
| 1535 m_lastScrollbarUnderMouse->mouseUp(mouseEvent); | 1535 m_lastScrollbarUnderMouse->mouseUp(mouseEvent); |
| 1536 bool setUnder = false; | 1536 bool setUnder = false; |
| 1537 return !dispatchMouseEvent(EventTypeNames::mouseup, m_lastNodeUnderMouse .get(), m_clickCount, mouseEvent, setUnder); | 1537 return !dispatchMouseEvent(EventTypeNames::mouseup, m_lastNodeUnderMouse .get(), m_clickCount, mouseEvent, setUnder, false); |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 // Mouse events simulated from touch should not hit-test again. | 1540 // Mouse events simulated from touch should not hit-test again. |
| 1541 ASSERT(!mouseEvent.fromTouch()); | 1541 ASSERT(!mouseEvent.fromTouch()); |
| 1542 | 1542 |
| 1543 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; | 1543 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; |
| 1544 HitTestRequest request(hitType); | 1544 HitTestRequest request(hitType); |
| 1545 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1545 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
| 1546 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1546 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
| 1547 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1547 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 1548 m_capturingMouseEventsNode = nullptr; | 1548 m_capturingMouseEventsNode = nullptr; |
| 1549 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) | 1549 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) |
| 1550 return true; | 1550 return true; |
| 1551 | 1551 |
| 1552 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev. targetNode(), m_clickCount, mouseEvent, false); | 1552 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev. targetNode(), m_clickCount, mouseEvent, false, false); |
| 1553 | 1553 |
| 1554 bool contextMenuEvent = mouseEvent.button() == RightButton; | 1554 bool contextMenuEvent = mouseEvent.button() == RightButton; |
| 1555 #if OS(MACOSX) | 1555 #if OS(MACOSX) |
| 1556 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. | 1556 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. |
| 1557 if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEv ent::CtrlKey) | 1557 if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEv ent::CtrlKey) |
| 1558 contextMenuEvent = true; | 1558 contextMenuEvent = true; |
| 1559 #endif | 1559 #endif |
| 1560 | 1560 |
| 1561 bool swallowClickEvent = false; | 1561 bool swallowClickEvent = false; |
| 1562 if (m_clickCount > 0 && !contextMenuEvent && mev.targetNode() && m_clickNode ) { | 1562 if (m_clickCount > 0 && !contextMenuEvent && mev.targetNode() && m_clickNode ) { |
| 1563 if (Node* clickTargetNode = mev.targetNode()->commonAncestor(*m_clickNod e, parentForClickEvent)) | 1563 if (Node* clickTargetNode = mev.targetNode()->commonAncestor(*m_clickNod e, parentForClickEvent)) |
| 1564 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click TargetNode, m_clickCount, mouseEvent, true); | 1564 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click TargetNode, m_clickCount, mouseEvent, true, false); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 if (m_resizeScrollableArea) { | 1567 if (m_resizeScrollableArea) { |
| 1568 m_resizeScrollableArea->setInResizeMode(false); | 1568 m_resizeScrollableArea->setInResizeMode(false); |
| 1569 m_resizeScrollableArea = 0; | 1569 m_resizeScrollableArea = 0; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 bool swallowMouseReleaseEvent = false; | 1572 bool swallowMouseReleaseEvent = false; |
| 1573 if (!swallowMouseUpEvent) | 1573 if (!swallowMouseUpEvent) |
| 1574 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); | 1574 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques t& request, const PlatformMouseEvent& mev) | 1799 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques t& request, const PlatformMouseEvent& mev) |
| 1800 { | 1800 { |
| 1801 ASSERT(m_frame); | 1801 ASSERT(m_frame); |
| 1802 ASSERT(m_frame->document()); | 1802 ASSERT(m_frame->document()); |
| 1803 | 1803 |
| 1804 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo wPoint(m_frame, mev.position()), mev); | 1804 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo wPoint(m_frame, mev.position()), mev); |
| 1805 } | 1805 } |
| 1806 | 1806 |
| 1807 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo useEvent& mouseEvent, bool fireMouseOverOut) | 1807 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo useEvent& mouseEvent, bool fireMouseOverOut, bool derivesFromTouch) |
| 1808 { | 1808 { |
| 1809 Node* result = targetNode; | 1809 Node* result = targetNode; |
| 1810 | 1810 |
| 1811 // If we're capturing, we always go right to that node. | 1811 // If we're capturing, we always go right to that node. |
| 1812 if (m_capturingMouseEventsNode) | 1812 if (m_capturingMouseEventsNode) |
| 1813 result = m_capturingMouseEventsNode.get(); | 1813 result = m_capturingMouseEventsNode.get(); |
| 1814 else { | 1814 else { |
| 1815 // If the target node is a text node, dispatch on the parent node - rdar ://4196646 | 1815 // If the target node is a text node, dispatch on the parent node - rdar ://4196646 |
| 1816 if (result && result->isTextNode()) | 1816 if (result && result->isTextNode()) |
| 1817 result = NodeRenderingTraversal::parent(result); | 1817 result = NodeRenderingTraversal::parent(result); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1849 } | 1849 } |
| 1850 | 1850 |
| 1851 if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame- >document()) { | 1851 if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame- >document()) { |
| 1852 m_lastNodeUnderMouse = nullptr; | 1852 m_lastNodeUnderMouse = nullptr; |
| 1853 m_lastScrollbarUnderMouse = nullptr; | 1853 m_lastScrollbarUnderMouse = nullptr; |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 if (m_lastNodeUnderMouse != m_nodeUnderMouse) { | 1856 if (m_lastNodeUnderMouse != m_nodeUnderMouse) { |
| 1857 // send mouseout event to the old node | 1857 // send mouseout event to the old node |
| 1858 if (m_lastNodeUnderMouse) | 1858 if (m_lastNodeUnderMouse) |
| 1859 m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNa mes::mouseout, 0, m_nodeUnderMouse.get()); | 1859 m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNa mes::mouseout, 0, m_nodeUnderMouse.get(), derivesFromTouch); |
| 1860 // send mouseover event to the new node | 1860 // send mouseover event to the new node |
| 1861 if (m_nodeUnderMouse) | 1861 if (m_nodeUnderMouse) |
| 1862 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames: :mouseover, 0, m_lastNodeUnderMouse.get()); | 1862 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames: :mouseover, 0, m_lastNodeUnderMouse.get(), derivesFromTouch); |
| 1863 } | 1863 } |
| 1864 m_lastNodeUnderMouse = m_nodeUnderMouse; | 1864 m_lastNodeUnderMouse = m_nodeUnderMouse; |
| 1865 } | 1865 } |
| 1866 } | 1866 } |
| 1867 | 1867 |
| 1868 // The return value means 'continue default handling.' | 1868 // The return value means 'continue default handling.' |
| 1869 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe tNode, int clickCount, const PlatformMouseEvent& mouseEvent, bool setUnder) | 1869 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe tNode, int clickCount, const PlatformMouseEvent& mouseEvent, bool setUnder, bool derivesFromTouch) |
| 1870 { | 1870 { |
| 1871 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); | 1871 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder, derivesFromTouc h); |
| 1872 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount); | 1872 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount, 0, derivesFromTouch); |
| 1873 } | 1873 } |
| 1874 | 1874 |
| 1875 // The return value means 'swallow event' (was handled), as for other handle* fu nctions. | 1875 // The return value means 'swallow event' (was handled), as for other handle* fu nctions. |
| 1876 bool EventHandler::handleMouseFocus(const PlatformMouseEvent& mouseEvent) | 1876 bool EventHandler::handleMouseFocus(const PlatformMouseEvent& mouseEvent) |
| 1877 { | 1877 { |
| 1878 // If clicking on a frame scrollbar, do not mess up with content focus. | 1878 // If clicking on a frame scrollbar, do not mess up with content focus. |
| 1879 if (FrameView* view = m_frame->view()) { | 1879 if (FrameView* view = m_frame->view()) { |
| 1880 if (view->scrollbarAtPoint(mouseEvent.position())) | 1880 if (view->scrollbarAtPoint(mouseEvent.position())) |
| 1881 return false; | 1881 return false; |
| 1882 } | 1882 } |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2231 | 2231 |
| 2232 // Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessa ry because | 2232 // Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessa ry because |
| 2233 // touch adjustment sometimes returns a different node than what hit testing would return | 2233 // touch adjustment sometimes returns a different node than what hit testing would return |
| 2234 // for the same point. | 2234 // for the same point. |
| 2235 // FIXME: Fix touch adjustment to avoid the need for a redundant hit test. h ttp://crbug.com/398914 | 2235 // FIXME: Fix touch adjustment to avoid the need for a redundant hit test. h ttp://crbug.com/398914 |
| 2236 HitTestResult newHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitT estRequest::ReadOnly); | 2236 HitTestResult newHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitT estRequest::ReadOnly); |
| 2237 | 2237 |
| 2238 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition( ), | 2238 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition( ), |
| 2239 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | 2239 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, |
| 2240 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2240 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2241 dispatchMouseEvent(EventTypeNames::mousemove, newHitTest.targetNode(), 0, fa keMouseMove, true); | 2241 dispatchMouseEvent(EventTypeNames::mousemove, newHitTest.targetNode(), 0, fa keMouseMove, true, true); |
|
Rick Byers
2014/08/19 16:06:47
Rather than take a completely new bool here, this
| |
| 2242 | 2242 |
| 2243 // Do a new hit-test in case the mousemove event changed the DOM. | 2243 // Do a new hit-test in case the mousemove event changed the DOM. |
| 2244 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 | 2244 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 |
| 2245 newHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestRequest::Re adOnly); | 2245 newHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestRequest::Re adOnly); |
| 2246 m_clickNode = newHitTest.targetNode(); | 2246 m_clickNode = newHitTest.targetNode(); |
| 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(adjustedPoint, gestureEvent.globalPosition( ), |
| 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, newHitTest.targetNode(), gestureEvent.tapCount(), fakeMouseDown, true); | 2253 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, newHitTest.targetNode(), gestureEvent.tapCount(), fakeMouseDown, true, 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, newHitTest)); | 2257 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul ts(fakeMouseDown, newHitTest)); |
| 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 newHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestRequest::Re adOnly); | 2260 newHitTest = hitTestResultInFrame(m_frame, adjustedPoint, HitTestRequest::Re adOnly); |
| 2261 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), | 2261 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), |
| 2262 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), | 2262 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), |
| 2263 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2263 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2264 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, newH itTest.targetNode(), gestureEvent.tapCount(), fakeMouseUp, false); | 2264 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, newH itTest.targetNode(), gestureEvent.tapCount(), fakeMouseUp, false, true); |
| 2265 | 2265 |
| 2266 bool swallowClickEvent = false; | 2266 bool swallowClickEvent = false; |
| 2267 if (m_clickNode) { | 2267 if (m_clickNode) { |
| 2268 Node* clickTargetNode = newHitTest.targetNode()->commonAncestor(*m_click Node, parentForClickEvent); | 2268 Node* clickTargetNode = newHitTest.targetNode()->commonAncestor(*m_click Node, parentForClickEvent); |
| 2269 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, clickTarg etNode, gestureEvent.tapCount(), fakeMouseUp, true); | 2269 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, clickTarg etNode, gestureEvent.tapCount(), fakeMouseUp, true, true); |
| 2270 m_clickNode = nullptr; | 2270 m_clickNode = nullptr; |
| 2271 } | 2271 } |
| 2272 | 2272 |
| 2273 if (!swallowMouseUpEvent) | 2273 if (!swallowMouseUpEvent) |
| 2274 swallowMouseUpEvent = handleMouseReleaseEvent(MouseEventWithHitTestResul ts(fakeMouseUp, newHitTest)); | 2274 swallowMouseUpEvent = handleMouseReleaseEvent(MouseEventWithHitTestResul ts(fakeMouseUp, newHitTest)); |
| 2275 | 2275 |
| 2276 return swallowMouseDownEvent | swallowMouseUpEvent | swallowClickEvent; | 2276 return swallowMouseDownEvent | swallowMouseUpEvent | swallowClickEvent; |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 bool EventHandler::handleGestureLongPress(const GestureEventWithHitTestResults& targetedEvent) | 2279 bool EventHandler::handleGestureLongPress(const GestureEventWithHitTestResults& targetedEvent) |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2682 // available for text selections. But only if we're above text. | 2682 // available for text selections. But only if we're above text. |
| 2683 && (m_frame->selection().isContentEditable() || (mev.targetNode() && mev .targetNode()->isTextNode()))) { | 2683 && (m_frame->selection().isContentEditable() || (mev.targetNode() && mev .targetNode()->isTextNode()))) { |
| 2684 m_mouseDownMayStartSelect = true; // context menu events are always allo wed to perform a selection | 2684 m_mouseDownMayStartSelect = true; // context menu events are always allo wed to perform a selection |
| 2685 | 2685 |
| 2686 if (mev.hitTestResult().isMisspelled()) | 2686 if (mev.hitTestResult().isMisspelled()) |
| 2687 selectClosestMisspellingFromMouseEvent(mev); | 2687 selectClosestMisspellingFromMouseEvent(mev); |
| 2688 else if (m_frame->editor().behavior().shouldSelectOnContextualMenuClick( )) | 2688 else if (m_frame->editor().behavior().shouldSelectOnContextualMenuClick( )) |
| 2689 selectClosestWordOrLinkFromMouseEvent(mev); | 2689 selectClosestWordOrLinkFromMouseEvent(mev); |
| 2690 } | 2690 } |
| 2691 | 2691 |
| 2692 return !dispatchMouseEvent(EventTypeNames::contextmenu, mev.targetNode(), 0, event, false); | 2692 return !dispatchMouseEvent(EventTypeNames::contextmenu, mev.targetNode(), 0, event, false, false); |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 bool EventHandler::sendContextMenuEventForKey() | 2695 bool EventHandler::sendContextMenuEventForKey() |
| 2696 { | 2696 { |
| 2697 FrameView* view = m_frame->view(); | 2697 FrameView* view = m_frame->view(); |
| 2698 if (!view) | 2698 if (!view) |
| 2699 return false; | 2699 return false; |
| 2700 | 2700 |
| 2701 Document* doc = m_frame->document(); | 2701 Document* doc = m_frame->document(); |
| 2702 if (!doc) | 2702 if (!doc) |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3852 unsigned EventHandler::accessKeyModifiers() | 3852 unsigned EventHandler::accessKeyModifiers() |
| 3853 { | 3853 { |
| 3854 #if OS(MACOSX) | 3854 #if OS(MACOSX) |
| 3855 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3855 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3856 #else | 3856 #else |
| 3857 return PlatformEvent::AltKey; | 3857 return PlatformEvent::AltKey; |
| 3858 #endif | 3858 #endif |
| 3859 } | 3859 } |
| 3860 | 3860 |
| 3861 } // namespace blink | 3861 } // namespace blink |
| OLD | NEW |