| 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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 m_mouseDownMayStartSelect = false; | 1215 m_mouseDownMayStartSelect = false; |
| 1216 m_mouseDownMayStartAutoscroll = false; | 1216 m_mouseDownMayStartAutoscroll = false; |
| 1217 if (FrameView* view = m_frame->view()) | 1217 if (FrameView* view = m_frame->view()) |
| 1218 m_mouseDownPos = view->windowToContents(mouseEvent.position()); | 1218 m_mouseDownPos = view->windowToContents(mouseEvent.position()); |
| 1219 else { | 1219 else { |
| 1220 invalidateClick(); | 1220 invalidateClick(); |
| 1221 return false; | 1221 return false; |
| 1222 } | 1222 } |
| 1223 m_mouseDownWasInSubframe = false; | 1223 m_mouseDownWasInSubframe = false; |
| 1224 | 1224 |
| 1225 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Active; | 1225 // Mouse events simulated from touch should not hit-test again. |
| 1226 if (mouseEvent.fromTouch()) | 1226 ASSERT(!mouseEvent.fromTouch()); |
| 1227 hitType |= HitTestRequest::ReadOnly; | 1227 |
| 1228 HitTestRequest request(hitType); | 1228 HitTestRequest request(HitTestRequest::Active); |
| 1229 // Save the document point we generate in case the window coordinate is inva
lidated by what happens | 1229 // Save the document point we generate in case the window coordinate is inva
lidated by what happens |
| 1230 // when we dispatch the event. | 1230 // when we dispatch the event. |
| 1231 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.
position()); | 1231 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.
position()); |
| 1232 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re
quest, documentPoint, mouseEvent); | 1232 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re
quest, documentPoint, mouseEvent); |
| 1233 | 1233 |
| 1234 if (!mev.targetNode()) { | 1234 if (!mev.targetNode()) { |
| 1235 invalidateClick(); | 1235 invalidateClick(); |
| 1236 return false; | 1236 return false; |
| 1237 } | 1237 } |
| 1238 | 1238 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 m_resizeScrollableArea->setInResizeMode(true); | 1275 m_resizeScrollableArea->setInResizeMode(true); |
| 1276 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC
orner(p); | 1276 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC
orner(p); |
| 1277 invalidateClick(); | 1277 invalidateClick(); |
| 1278 return true; | 1278 return true; |
| 1279 } | 1279 } |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 m_frame->selection().setCaretBlinkingSuspended(true); | 1282 m_frame->selection().setCaretBlinkingSuspended(true); |
| 1283 | 1283 |
| 1284 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targe
tNode(), m_clickCount, mouseEvent, true); | 1284 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targe
tNode(), m_clickCount, mouseEvent, true); |
| 1285 swallowEvent = swallowEvent || !handleMouseFocus(mouseEvent); | 1285 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); |
| 1286 m_capturesDragging = !swallowEvent || mev.scrollbar(); | 1286 m_capturesDragging = !swallowEvent || mev.scrollbar(); |
| 1287 | 1287 |
| 1288 // If the hit testing originally determined the event was in a scrollbar, re
fetch the MouseEventWithHitTestResults | 1288 // If the hit testing originally determined the event was in a scrollbar, re
fetch the MouseEventWithHitTestResults |
| 1289 // in case the scrollbar widget was destroyed when the mouse event was handl
ed. | 1289 // in case the scrollbar widget was destroyed when the mouse event was handl
ed. |
| 1290 if (mev.scrollbar()) { | 1290 if (mev.scrollbar()) { |
| 1291 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); | 1291 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); |
| 1292 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); | 1292 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); |
| 1293 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); | 1293 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); |
| 1294 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get
()) | 1294 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get
()) |
| 1295 m_lastScrollbarUnderMouse = nullptr; | 1295 m_lastScrollbarUnderMouse = nullptr; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 | 1397 |
| 1398 if (m_frameSetBeingResized) | 1398 if (m_frameSetBeingResized) |
| 1399 return !dispatchMouseEvent(EventTypeNames::mousemove, m_frameSetBeingRes
ized.get(), 0, mouseEvent, false); | 1399 return !dispatchMouseEvent(EventTypeNames::mousemove, m_frameSetBeingRes
ized.get(), 0, mouseEvent, false); |
| 1400 | 1400 |
| 1401 // Send events right to a scrollbar if the mouse is pressed. | 1401 // Send events right to a scrollbar if the mouse is pressed. |
| 1402 if (m_lastScrollbarUnderMouse && m_mousePressed) { | 1402 if (m_lastScrollbarUnderMouse && m_mousePressed) { |
| 1403 m_lastScrollbarUnderMouse->mouseMoved(mouseEvent); | 1403 m_lastScrollbarUnderMouse->mouseMoved(mouseEvent); |
| 1404 return true; | 1404 return true; |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 // Mouse events simulated from touch should not hit-test again. |
| 1408 ASSERT(!mouseEvent.fromTouch()); |
| 1409 |
| 1407 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; | 1410 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; |
| 1408 if (mouseEvent.fromTouch()) | |
| 1409 hitType |= HitTestRequest::ReadOnly; | |
| 1410 | |
| 1411 if (m_mousePressed) | 1411 if (m_mousePressed) |
| 1412 hitType |= HitTestRequest::Active; | 1412 hitType |= HitTestRequest::Active; |
| 1413 else if (onlyUpdateScrollbars) { | 1413 else if (onlyUpdateScrollbars) { |
| 1414 // Mouse events should be treated as "read-only" if we're updating only
scrollbars. This | 1414 // Mouse events should be treated as "read-only" if we're updating only
scrollbars. This |
| 1415 // means that :hover and :active freeze in the state they were in, rathe
r than updating | 1415 // means that :hover and :active freeze in the state they were in, rathe
r than updating |
| 1416 // for nodes the mouse moves while the window is not key (which will be
the case if | 1416 // for nodes the mouse moves while the window is not key (which will be
the case if |
| 1417 // onlyUpdateScrollbars is true). | 1417 // onlyUpdateScrollbars is true). |
| 1418 hitType |= HitTestRequest::ReadOnly; | 1418 hitType |= HitTestRequest::ReadOnly; |
| 1419 } | 1419 } |
| 1420 | 1420 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 if (m_frameSetBeingResized) | 1528 if (m_frameSetBeingResized) |
| 1529 return !dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResiz
ed.get(), m_clickCount, mouseEvent, false); | 1529 return !dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResiz
ed.get(), m_clickCount, mouseEvent, false); |
| 1530 | 1530 |
| 1531 if (m_lastScrollbarUnderMouse) { | 1531 if (m_lastScrollbarUnderMouse) { |
| 1532 invalidateClick(); | 1532 invalidateClick(); |
| 1533 m_lastScrollbarUnderMouse->mouseUp(mouseEvent); | 1533 m_lastScrollbarUnderMouse->mouseUp(mouseEvent); |
| 1534 bool setUnder = false; | 1534 bool setUnder = false; |
| 1535 return !dispatchMouseEvent(EventTypeNames::mouseup, m_lastNodeUnderMouse
.get(), m_clickCount, mouseEvent, setUnder); | 1535 return !dispatchMouseEvent(EventTypeNames::mouseup, m_lastNodeUnderMouse
.get(), m_clickCount, mouseEvent, setUnder); |
| 1536 } | 1536 } |
| 1537 | 1537 |
| 1538 // Mouse events simulated from touch should not hit-test again. |
| 1539 ASSERT(!mouseEvent.fromTouch()); |
| 1540 |
| 1538 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; | 1541 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; |
| 1539 if (mouseEvent.fromTouch()) | |
| 1540 hitType |= HitTestRequest::ReadOnly; | |
| 1541 HitTestRequest request(hitType); | 1542 HitTestRequest request(hitType); |
| 1542 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1543 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
| 1543 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN
ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1544 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN
ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
| 1544 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1545 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 1545 m_capturingMouseEventsNode = nullptr; | 1546 m_capturingMouseEventsNode = nullptr; |
| 1546 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) | 1547 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) |
| 1547 return true; | 1548 return true; |
| 1548 | 1549 |
| 1549 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.
targetNode(), m_clickCount, mouseEvent, false); | 1550 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.
targetNode(), m_clickCount, mouseEvent, false); |
| 1550 | 1551 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 } | 1861 } |
| 1861 } | 1862 } |
| 1862 | 1863 |
| 1863 // The return value means 'continue default handling.' | 1864 // The return value means 'continue default handling.' |
| 1864 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
tNode, int clickCount, const PlatformMouseEvent& mouseEvent, bool setUnder) | 1865 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
tNode, int clickCount, const PlatformMouseEvent& mouseEvent, bool setUnder) |
| 1865 { | 1866 { |
| 1866 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); | 1867 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); |
| 1867 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); | 1868 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); |
| 1868 } | 1869 } |
| 1869 | 1870 |
| 1870 // The return value means 'continue default handling.' | 1871 // The return value means 'swallow event' (was handled), as for other handle* fu
nctions. |
| 1871 bool EventHandler::handleMouseFocus(const PlatformMouseEvent& mouseEvent) | 1872 bool EventHandler::handleMouseFocus(const PlatformMouseEvent& mouseEvent) |
| 1872 { | 1873 { |
| 1873 // If clicking on a frame scrollbar, do not mess up with content focus. | 1874 // If clicking on a frame scrollbar, do not mess up with content focus. |
| 1874 if (FrameView* view = m_frame->view()) { | 1875 if (FrameView* view = m_frame->view()) { |
| 1875 if (view->scrollbarAtPoint(mouseEvent.position())) | 1876 if (view->scrollbarAtPoint(mouseEvent.position())) |
| 1876 return true; | 1877 return false; |
| 1877 } | 1878 } |
| 1878 | 1879 |
| 1879 // The layout needs to be up to date to determine if an element is focusable
. | 1880 // The layout needs to be up to date to determine if an element is focusable
. |
| 1880 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 1881 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 1881 | 1882 |
| 1882 Element* element = 0; | 1883 Element* element = 0; |
| 1883 if (m_nodeUnderMouse) | 1884 if (m_nodeUnderMouse) |
| 1884 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse
) : m_nodeUnderMouse->parentOrShadowHostElement(); | 1885 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse
) : m_nodeUnderMouse->parentOrShadowHostElement(); |
| 1885 for (; element; element = element->parentOrShadowHostElement()) { | 1886 for (; element; element = element->parentOrShadowHostElement()) { |
| 1886 if (element->isFocusable() && element->focused()) | 1887 if (element->isFocusable() && element->focused()) |
| 1887 return true; | 1888 return false; |
| 1888 if (element->isMouseFocusable()) | 1889 if (element->isMouseFocusable()) |
| 1889 break; | 1890 break; |
| 1890 } | 1891 } |
| 1891 ASSERT(!element || element->isMouseFocusable()); | 1892 ASSERT(!element || element->isMouseFocusable()); |
| 1892 | 1893 |
| 1893 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus | 1894 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus |
| 1894 // a node on mouse down if it's selected and inside a focused node. It will | 1895 // a node on mouse down if it's selected and inside a focused node. It will |
| 1895 // be focused if the user does a mouseup over it, however, because the | 1896 // be focused if the user does a mouseup over it, however, because the |
| 1896 // mouseup will set a selection inside it, which will call | 1897 // mouseup will set a selection inside it, which will call |
| 1897 // FrameSelection::setFocusedNodeIfNeeded. | 1898 // FrameSelection::setFocusedNodeIfNeeded. |
| 1898 if (element | 1899 if (element |
| 1899 && m_frame->selection().isRange() | 1900 && m_frame->selection().isRange() |
| 1900 && m_frame->selection().toNormalizedRange()->compareNode(element, IGNORE
_EXCEPTION) == Range::NODE_INSIDE | 1901 && m_frame->selection().toNormalizedRange()->compareNode(element, IGNORE
_EXCEPTION) == Range::NODE_INSIDE |
| 1901 && element->isDescendantOf(m_frame->document()->focusedElement())) | 1902 && element->isDescendantOf(m_frame->document()->focusedElement())) |
| 1902 return true; | 1903 return false; |
| 1903 | 1904 |
| 1904 // Only change the focus when clicking scrollbars if it can transfered to a | 1905 // Only change the focus when clicking scrollbars if it can transfered to a |
| 1905 // mouse focusable node. | 1906 // mouse focusable node. |
| 1906 if (!element && isInsideScrollbar(mouseEvent.position())) | 1907 if (!element && isInsideScrollbar(mouseEvent.position())) |
| 1907 return false; | 1908 return true; |
| 1908 | 1909 |
| 1909 if (Page* page = m_frame->page()) { | 1910 if (Page* page = m_frame->page()) { |
| 1910 // If focus shift is blocked, we eat the event. Note we should never | 1911 // If focus shift is blocked, we eat the event. Note we should never |
| 1911 // clear swallowEvent if the page already set it (e.g., by canceling | 1912 // clear swallowEvent if the page already set it (e.g., by canceling |
| 1912 // default behavior). | 1913 // default behavior). |
| 1913 if (element) { | 1914 if (element) { |
| 1914 if (!page->focusController().setFocusedElement(element, m_frame, Foc
usTypeMouse)) | 1915 if (!page->focusController().setFocusedElement(element, m_frame, Foc
usTypeMouse)) |
| 1915 return false; | 1916 return true; |
| 1916 } else { | 1917 } else { |
| 1917 // We call setFocusedElement even with !element in order to blur | 1918 // We call setFocusedElement even with !element in order to blur |
| 1918 // current focus element when a link is clicked; this is expected by | 1919 // current focus element when a link is clicked; this is expected by |
| 1919 // some sites that rely on onChange handlers running from form | 1920 // some sites that rely on onChange handlers running from form |
| 1920 // fields before the button click is processed. | 1921 // fields before the button click is processed. |
| 1921 if (!page->focusController().setFocusedElement(0, m_frame)) | 1922 if (!page->focusController().setFocusedElement(0, m_frame)) |
| 1922 return false; | 1923 return true; |
| 1923 } | 1924 } |
| 1924 } | 1925 } |
| 1925 | 1926 |
| 1926 return true; | 1927 return false; |
| 1927 } | 1928 } |
| 1928 | 1929 |
| 1929 bool EventHandler::isInsideScrollbar(const IntPoint& windowPoint) const | 1930 bool EventHandler::isInsideScrollbar(const IntPoint& windowPoint) const |
| 1930 { | 1931 { |
| 1931 if (RenderView* renderView = m_frame->contentRenderer()) { | 1932 if (RenderView* renderView = m_frame->contentRenderer()) { |
| 1932 HitTestRequest request(HitTestRequest::ReadOnly); | 1933 HitTestRequest request(HitTestRequest::ReadOnly); |
| 1933 HitTestResult result(windowPoint); | 1934 HitTestResult result(windowPoint); |
| 1934 renderView->hitTest(request, result); | 1935 renderView->hitTest(request, result); |
| 1935 return result.scrollbar(); | 1936 return result.scrollbar(); |
| 1936 } | 1937 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 default: | 2200 default: |
| 2200 ASSERT_NOT_REACHED(); | 2201 ASSERT_NOT_REACHED(); |
| 2201 return false; | 2202 return false; |
| 2202 } | 2203 } |
| 2203 } | 2204 } |
| 2204 | 2205 |
| 2205 bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target
edEvent) | 2206 bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target
edEvent) |
| 2206 { | 2207 { |
| 2207 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2208 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 2208 | 2209 |
| 2209 // FIXME: Refactor this code to not hit test multiple times. We use the adju
sted position to ensure that the correct node is targeted by the later redundant
hit tests. | 2210 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 2210 | 2211 |
| 2211 unsigned modifierFlags = 0; | 2212 unsigned modifierFlags = 0; |
| 2212 if (gestureEvent.altKey()) | 2213 if (gestureEvent.altKey()) |
| 2213 modifierFlags |= PlatformEvent::AltKey; | 2214 modifierFlags |= PlatformEvent::AltKey; |
| 2214 if (gestureEvent.ctrlKey()) | 2215 if (gestureEvent.ctrlKey()) |
| 2215 modifierFlags |= PlatformEvent::CtrlKey; | 2216 modifierFlags |= PlatformEvent::CtrlKey; |
| 2216 if (gestureEvent.metaKey()) | 2217 if (gestureEvent.metaKey()) |
| 2217 modifierFlags |= PlatformEvent::MetaKey; | 2218 modifierFlags |= PlatformEvent::MetaKey; |
| 2218 if (gestureEvent.shiftKey()) | 2219 if (gestureEvent.shiftKey()) |
| 2219 modifierFlags |= PlatformEvent::ShiftKey; | 2220 modifierFlags |= PlatformEvent::ShiftKey; |
| 2220 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m
odifierFlags); | 2221 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m
odifierFlags); |
| 2221 | 2222 |
| 2223 // We use the adjusted position so the application isn't surprised to see a
event with |
| 2224 // co-ordinates outside the target's bounds. |
| 2222 IntPoint adjustedPoint = gestureEvent.position(); | 2225 IntPoint adjustedPoint = gestureEvent.position(); |
| 2223 | 2226 |
| 2224 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(
), | 2227 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(
), |
| 2225 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | 2228 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, |
| 2226 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2229 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2227 handleMouseMoveEvent(fakeMouseMove); | 2230 dispatchMouseEvent(EventTypeNames::mousemove, targetedEvent.targetNode(), 0,
fakeMouseMove, true); |
| 2228 | 2231 |
| 2229 bool defaultPrevented = false; | |
| 2230 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(
), | 2232 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(
), |
| 2231 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), | 2233 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), |
| 2232 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2234 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2233 defaultPrevented |= handleMousePressEvent(fakeMouseDown); | 2235 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
targetedEvent.targetNode(), gestureEvent.tapCount(), fakeMouseDown, true); |
| 2236 if (!swallowMouseDownEvent) |
| 2237 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown); |
| 2238 if (!swallowMouseDownEvent) |
| 2239 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, targetedEvent.hitTestResult())); |
| 2234 | 2240 |
| 2235 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), | 2241 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), |
| 2236 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), | 2242 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), |
| 2237 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2243 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
| 2238 defaultPrevented |= handleMouseReleaseEvent(fakeMouseUp); | 2244 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, targ
etedEvent.targetNode(), gestureEvent.tapCount(), fakeMouseUp, false); |
| 2245 bool swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, targeted
Event.targetNode(), gestureEvent.tapCount(), fakeMouseUp, true); |
| 2246 if (!swallowMouseUpEvent) |
| 2247 swallowMouseUpEvent = handleMouseReleaseEvent(MouseEventWithHitTestResul
ts(fakeMouseUp, targetedEvent.hitTestResult())); |
| 2239 | 2248 |
| 2240 return defaultPrevented; | 2249 return swallowMouseDownEvent | swallowMouseUpEvent | swallowClickEvent; |
| 2241 } | 2250 } |
| 2242 | 2251 |
| 2243 bool EventHandler::handleGestureLongPress(const GestureEventWithHitTestResults&
targetedEvent) | 2252 bool EventHandler::handleGestureLongPress(const GestureEventWithHitTestResults&
targetedEvent) |
| 2244 { | 2253 { |
| 2245 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2254 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 2246 IntPoint adjustedPoint = gestureEvent.position(); | 2255 IntPoint adjustedPoint = gestureEvent.position(); |
| 2247 | 2256 |
| 2248 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the | 2257 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the |
| 2249 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code | 2258 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code |
| 2250 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. | 2259 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. |
| (...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3807 unsigned EventHandler::accessKeyModifiers() | 3816 unsigned EventHandler::accessKeyModifiers() |
| 3808 { | 3817 { |
| 3809 #if OS(MACOSX) | 3818 #if OS(MACOSX) |
| 3810 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3819 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3811 #else | 3820 #else |
| 3812 return PlatformEvent::AltKey; | 3821 return PlatformEvent::AltKey; |
| 3813 #endif | 3822 #endif |
| 3814 } | 3823 } |
| 3815 | 3824 |
| 3816 } // namespace WebCore | 3825 } // namespace WebCore |
| OLD | NEW |