| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 , m_clickCount(0) | 188 , m_clickCount(0) |
| 189 , m_shouldOnlyFireDragOverEvent(false) | 189 , m_shouldOnlyFireDragOverEvent(false) |
| 190 , m_mousePositionIsUnknown(true) | 190 , m_mousePositionIsUnknown(true) |
| 191 , m_mouseDownTimestamp(0) | 191 , m_mouseDownTimestamp(0) |
| 192 , m_pointerEventManager(frame) | 192 , m_pointerEventManager(frame) |
| 193 , m_scrollManager(frame) | 193 , m_scrollManager(frame) |
| 194 , m_keyboardEventManager(frame, &m_scrollManager) | 194 , m_keyboardEventManager(frame, &m_scrollManager) |
| 195 , m_longTapShouldInvokeContextMenu(false) | 195 , m_longTapShouldInvokeContextMenu(false) |
| 196 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) | 196 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) |
| 197 , m_lastShowPressTimestamp(0) | 197 , m_lastShowPressTimestamp(0) |
| 198 , m_suppressMouseEventsFromGestures(false) |
| 198 { | 199 { |
| 199 } | 200 } |
| 200 | 201 |
| 201 EventHandler::~EventHandler() | 202 EventHandler::~EventHandler() |
| 202 { | 203 { |
| 203 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); | 204 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); |
| 204 } | 205 } |
| 205 | 206 |
| 206 DEFINE_TRACE(EventHandler) | 207 DEFINE_TRACE(EventHandler) |
| 207 { | 208 { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 m_lastShowPressTimestamp = 0; | 256 m_lastShowPressTimestamp = 0; |
| 256 m_lastDeferredTapElement = nullptr; | 257 m_lastDeferredTapElement = nullptr; |
| 257 m_eventHandlerWillResetCapturingMouseEventsNode = false; | 258 m_eventHandlerWillResetCapturingMouseEventsNode = false; |
| 258 m_mouseDownMayStartAutoscroll = false; | 259 m_mouseDownMayStartAutoscroll = false; |
| 259 m_svgPan = false; | 260 m_svgPan = false; |
| 260 m_mouseDownPos = IntPoint(); | 261 m_mouseDownPos = IntPoint(); |
| 261 m_mouseDownTimestamp = 0; | 262 m_mouseDownTimestamp = 0; |
| 262 m_longTapShouldInvokeContextMenu = false; | 263 m_longTapShouldInvokeContextMenu = false; |
| 263 m_dragStartPos = LayoutPoint(); | 264 m_dragStartPos = LayoutPoint(); |
| 264 m_mouseDown = PlatformMouseEvent(); | 265 m_mouseDown = PlatformMouseEvent(); |
| 266 m_suppressMouseEventsFromGestures = false; |
| 265 } | 267 } |
| 266 | 268 |
| 267 WebInputEventResult EventHandler::mergeEventResult( | 269 WebInputEventResult EventHandler::mergeEventResult( |
| 268 WebInputEventResult resultA, WebInputEventResult resultB) | 270 WebInputEventResult resultA, WebInputEventResult resultB) |
| 269 { | 271 { |
| 270 // The ordering of the enumeration is specific. There are times that | 272 // The ordering of the enumeration is specific. There are times that |
| 271 // multiple events fire and we need to combine them into a single | 273 // multiple events fire and we need to combine them into a single |
| 272 // result code. The enumeration is based on the level of consumption that | 274 // result code. The enumeration is based on the level of consumption that |
| 273 // is most significant. The enumeration is ordered with smaller specified | 275 // is most significant. The enumeration is ordered with smaller specified |
| 274 // numbers first. Examples of merged results are: | 276 // numbers first. Examples of merged results are: |
| (...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 if (gestureDomEvent) { | 1719 if (gestureDomEvent) { |
| 1718 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve
nt(gestureDomEvent); | 1720 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve
nt(gestureDomEvent); |
| 1719 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { | 1721 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { |
| 1720 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE
ventHandler); | 1722 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE
ventHandler); |
| 1721 return toWebInputEventResult(gestureDomEventResult); | 1723 return toWebInputEventResult(gestureDomEventResult); |
| 1722 } | 1724 } |
| 1723 } | 1725 } |
| 1724 } | 1726 } |
| 1725 | 1727 |
| 1726 switch (gestureEvent.type()) { | 1728 switch (gestureEvent.type()) { |
| 1729 case PlatformEvent::GestureTapDown: |
| 1730 return handleGestureTapDown(targetedEvent); |
| 1727 case PlatformEvent::GestureTap: | 1731 case PlatformEvent::GestureTap: |
| 1728 return handleGestureTap(targetedEvent); | 1732 return handleGestureTap(targetedEvent); |
| 1729 case PlatformEvent::GestureShowPress: | 1733 case PlatformEvent::GestureShowPress: |
| 1730 return handleGestureShowPress(); | 1734 return handleGestureShowPress(); |
| 1731 case PlatformEvent::GestureLongPress: | 1735 case PlatformEvent::GestureLongPress: |
| 1732 return handleGestureLongPress(targetedEvent); | 1736 return handleGestureLongPress(targetedEvent); |
| 1733 case PlatformEvent::GestureLongTap: | 1737 case PlatformEvent::GestureLongTap: |
| 1734 return handleGestureLongTap(targetedEvent); | 1738 return handleGestureLongTap(targetedEvent); |
| 1735 case PlatformEvent::GestureTwoFingerTap: | 1739 case PlatformEvent::GestureTwoFingerTap: |
| 1736 return sendContextMenuEventForGesture(targetedEvent); | 1740 return sendContextMenuEventForGesture(targetedEvent); |
| 1737 case PlatformEvent::GestureTapDown: | |
| 1738 case PlatformEvent::GesturePinchBegin: | 1741 case PlatformEvent::GesturePinchBegin: |
| 1739 case PlatformEvent::GesturePinchEnd: | 1742 case PlatformEvent::GesturePinchEnd: |
| 1740 case PlatformEvent::GesturePinchUpdate: | 1743 case PlatformEvent::GesturePinchUpdate: |
| 1741 case PlatformEvent::GestureTapDownCancel: | 1744 case PlatformEvent::GestureTapDownCancel: |
| 1742 case PlatformEvent::GestureTapUnconfirmed: | 1745 case PlatformEvent::GestureTapUnconfirmed: |
| 1743 break; | 1746 break; |
| 1744 default: | 1747 default: |
| 1745 ASSERT_NOT_REACHED(); | 1748 ASSERT_NOT_REACHED(); |
| 1746 } | 1749 } |
| 1747 | 1750 |
| 1748 return WebInputEventResult::NotHandled; | 1751 return WebInputEventResult::NotHandled; |
| 1749 } | 1752 } |
| 1750 | 1753 |
| 1751 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture
Event& gestureEvent) | 1754 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture
Event& gestureEvent) |
| 1752 { | 1755 { |
| 1753 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); | 1756 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); |
| 1754 | 1757 |
| 1755 return m_scrollManager.handleGestureScrollEvent(gestureEvent); | 1758 return m_scrollManager.handleGestureScrollEvent(gestureEvent); |
| 1756 } | 1759 } |
| 1757 | 1760 |
| 1761 WebInputEventResult EventHandler::handleGestureTapDown(const GestureEventWithHit
TestResults& targetedEvent) |
| 1762 { |
| 1763 m_suppressMouseEventsFromGestures = |
| 1764 m_pointerEventManager.primaryPointerdownCanceled(targetedEvent.event().u
niqueTouchEventId()); |
| 1765 return WebInputEventResult::NotHandled; |
| 1766 } |
| 1767 |
| 1758 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest
Results& targetedEvent) | 1768 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest
Results& targetedEvent) |
| 1759 { | 1769 { |
| 1760 FrameView* frameView(m_frame->view()); | 1770 FrameView* frameView(m_frame->view()); |
| 1761 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 1771 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 1762 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur
eEvent.type()); | 1772 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur
eEvent.type()); |
| 1763 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); | 1773 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); |
| 1764 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); | 1774 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); |
| 1765 | 1775 |
| 1766 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 1776 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 1767 | 1777 |
| 1768 HitTestResult currentHitTest = targetedEvent.hitTestResult(); | 1778 HitTestResult currentHitTest = targetedEvent.hitTestResult(); |
| 1769 | 1779 |
| 1770 // We use the adjusted position so the application isn't surprised to see a
event with | 1780 // We use the adjusted position so the application isn't surprised to see a
event with |
| 1771 // co-ordinates outside the target's bounds. | 1781 // co-ordinates outside the target's bounds. |
| 1772 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio
n()); | 1782 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio
n()); |
| 1773 | 1783 |
| 1774 unsigned modifiers = gestureEvent.getModifiers(); | 1784 const unsigned modifiers = gestureEvent.getModifiers(); |
| 1775 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa
lPosition(), | 1785 |
| 1776 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | 1786 if (!m_suppressMouseEventsFromGestures) { |
| 1777 static_cast<PlatformEvent::Modifiers>(modifiers), | 1787 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g
lobalPosition(), |
| 1778 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); | 1788 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, |
| 1779 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0,
fakeMouseMove); | 1789 static_cast<PlatformEvent::Modifiers>(modifiers), |
| 1790 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP
roperties::PointerType::Mouse); |
| 1791 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode()
, 0, fakeMouseMove); |
| 1792 } |
| 1780 | 1793 |
| 1781 // Do a new hit-test in case the mousemove event changed the DOM. | 1794 // Do a new hit-test in case the mousemove event changed the DOM. |
| 1782 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we | 1795 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we |
| 1783 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page | 1796 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page |
| 1784 // could have seen the event anyway). | 1797 // could have seen the event anyway). |
| 1785 // Also note that the position of the frame may have changed, so we need to
recompute the content | 1798 // Also note that the position of the frame may have changed, so we need to
recompute the content |
| 1786 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul
d). | 1799 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul
d). |
| 1787 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 1800 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
| 1788 if (currentHitTest.innerNode()) { | 1801 if (currentHitTest.innerNode()) { |
| 1789 LocalFrame* mainFrame = m_frame->localFrameRoot(); | 1802 LocalFrame* mainFrame = m_frame->localFrameRoot(); |
| 1790 if (mainFrame && mainFrame->view()) | 1803 if (mainFrame && mainFrame->view()) |
| 1791 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); | 1804 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); |
| 1792 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); | 1805 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); |
| 1793 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); | 1806 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
| 1794 } | 1807 } |
| 1795 m_clickNode = currentHitTest.innerNode(); | 1808 m_clickNode = currentHitTest.innerNode(); |
| 1796 | 1809 |
| 1797 // Capture data for showUnhandledTapUIIfNeeded. | 1810 // Capture data for showUnhandledTapUIIfNeeded. |
| 1798 Node* tappedNode = m_clickNode; | 1811 Node* tappedNode = m_clickNode; |
| 1799 IntPoint tappedPosition = gestureEvent.position(); | 1812 IntPoint tappedPosition = gestureEvent.position(); |
| 1800 | 1813 |
| 1801 if (m_clickNode && m_clickNode->isTextNode()) | 1814 if (m_clickNode && m_clickNode->isTextNode()) |
| 1802 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); | 1815 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); |
| 1803 | 1816 |
| 1804 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), | 1817 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), |
| 1805 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), | 1818 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), |
| 1806 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), | 1819 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), |
| 1807 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp
erties::PointerType::Mouse); | 1820 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); |
| 1808 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames
::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown)
; | 1821 |
| 1809 selectionController().initializeSelectionState(); | 1822 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that |
| 1810 if (mouseDownEventResult == WebInputEventResult::NotHandled) | 1823 // mean for for TEs? What's the right balance here? crbug.com/617255 |
| 1811 mouseDownEventResult = handleMouseFocus(MouseEventWithHitTestResults(fak
eMouseDown, currentHitTest), InputDeviceCapabilities::firesTouchEventsSourceCapa
bilities()); | 1824 WebInputEventResult mouseDownEventResult = WebInputEventResult::HandledSuppr
essed; |
| 1812 if (mouseDownEventResult == WebInputEventResult::NotHandled) | 1825 if (!m_suppressMouseEventsFromGestures) { |
| 1813 mouseDownEventResult = handleMousePressEvent(MouseEventWithHitTestResult
s(fakeMouseDown, currentHitTest)); | 1826 mouseDownEventResult = dispatchMouseEvent(EventTypeNames::mousedown, cur
rentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown); |
| 1827 selectionController().initializeSelectionState(); |
| 1828 if (mouseDownEventResult == WebInputEventResult::NotHandled) |
| 1829 mouseDownEventResult = handleMouseFocus(MouseEventWithHitTestResults
(fakeMouseDown, currentHitTest), InputDeviceCapabilities::firesTouchEventsSource
Capabilities()); |
| 1830 if (mouseDownEventResult == WebInputEventResult::NotHandled) |
| 1831 mouseDownEventResult = handleMousePressEvent(MouseEventWithHitTestRe
sults(fakeMouseDown, currentHitTest)); |
| 1832 } |
| 1814 | 1833 |
| 1815 if (currentHitTest.innerNode()) { | 1834 if (currentHitTest.innerNode()) { |
| 1816 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap); | 1835 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap); |
| 1817 HitTestResult result = currentHitTest; | 1836 HitTestResult result = currentHitTest; |
| 1818 result.setToShadowHostIfInUserAgentShadowRoot(); | 1837 result.setToShadowHostIfInUserAgentShadowRoot(); |
| 1819 m_frame->chromeClient().onMouseDown(result.innerNode()); | 1838 m_frame->chromeClient().onMouseDown(result.innerNode()); |
| 1820 } | 1839 } |
| 1821 | 1840 |
| 1822 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 1841 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
| 1823 if (currentHitTest.innerNode()) { | 1842 if (currentHitTest.innerNode()) { |
| 1824 LocalFrame* mainFrame = m_frame->localFrameRoot(); | 1843 LocalFrame* mainFrame = m_frame->localFrameRoot(); |
| 1825 if (mainFrame && mainFrame->view()) | 1844 if (mainFrame && mainFrame->view()) |
| 1826 mainFrame->view()->updateAllLifecyclePhases(); | 1845 mainFrame->view()->updateAllLifecyclePhases(); |
| 1827 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); | 1846 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); |
| 1828 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); | 1847 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
| 1829 } | 1848 } |
| 1849 |
| 1830 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP
osition(), | 1850 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP
osition(), |
| 1831 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), | 1851 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), |
| 1832 static_cast<PlatformEvent::Modifiers>(modifiers), | 1852 static_cast<PlatformEvent::Modifiers>(modifiers), |
| 1833 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp
erties::PointerType::Mouse); | 1853 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); |
| 1834 WebInputEventResult mouseUpEventResult = dispatchMouseEvent(EventTypeNames::
mouseup, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp); | 1854 WebInputEventResult mouseUpEventResult = m_suppressMouseEventsFromGestures |
| 1855 ? WebInputEventResult::HandledSuppressed |
| 1856 : dispatchMouseEvent(EventTypeNames::mouseup, currentHitTest.innerNode()
, gestureEvent.tapCount(), fakeMouseUp); |
| 1835 | 1857 |
| 1836 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; | 1858 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; |
| 1837 if (m_clickNode) { | 1859 if (m_clickNode) { |
| 1838 if (currentHitTest.innerNode()) { | 1860 if (currentHitTest.innerNode()) { |
| 1839 // Updates distribution because a mouseup (or mousedown) event liste
ner can make the | 1861 // Updates distribution because a mouseup (or mousedown) event liste
ner can make the |
| 1840 // tree dirty at dispatchMouseEvent() invocation above. | 1862 // tree dirty at dispatchMouseEvent() invocation above. |
| 1841 // Unless distribution is updated, commonAncestor would hit ASSERT. | 1863 // Unless distribution is updated, commonAncestor would hit ASSERT. |
| 1842 // Both m_clickNode and currentHitTest.innerNode()) don't need to be
updated | 1864 // Both m_clickNode and currentHitTest.innerNode()) don't need to be
updated |
| 1843 // because commonAncestor() will exit early if their documents are d
ifferent. | 1865 // because commonAncestor() will exit early if their documents are d
ifferent. |
| 1844 m_clickNode->updateDistribution(); | 1866 m_clickNode->updateDistribution(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1868 IntPoint adjustedPoint = gestureEvent.position(); | 1890 IntPoint adjustedPoint = gestureEvent.position(); |
| 1869 | 1891 |
| 1870 unsigned modifiers = gestureEvent.getModifiers(); | 1892 unsigned modifiers = gestureEvent.getModifiers(); |
| 1871 | 1893 |
| 1872 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the | 1894 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the |
| 1873 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code | 1895 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code |
| 1874 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. | 1896 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. |
| 1875 | 1897 |
| 1876 m_longTapShouldInvokeContextMenu = false; | 1898 m_longTapShouldInvokeContextMenu = false; |
| 1877 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_
frame->view()) { | 1899 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_
frame->view()) { |
| 1900 // TODO(mustaq): Suppressing long-tap MouseEvents could break |
| 1901 // drag-drop. Will do separately because of the risk. crbug.com/606938. |
| 1878 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MousePressed, 1, | 1902 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MousePressed, 1, |
| 1879 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), | 1903 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), |
| 1880 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); | 1904 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); |
| 1881 m_mouseDown = mouseDownEvent; | 1905 m_mouseDown = mouseDownEvent; |
| 1882 | 1906 |
| 1883 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, | 1907 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, |
| 1884 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), | 1908 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), |
| 1885 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); | 1909 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); |
| 1886 HitTestRequest request(HitTestRequest::ReadOnly); | 1910 HitTestRequest request(HitTestRequest::ReadOnly); |
| 1887 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); | 1911 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 if (!rect.contains(roundedIntPoint(point))) | 2789 if (!rect.contains(roundedIntPoint(point))) |
| 2766 return result; | 2790 return result; |
| 2767 } | 2791 } |
| 2768 frame->contentLayoutItem().hitTest(result); | 2792 frame->contentLayoutItem().hitTest(result); |
| 2769 return result; | 2793 return result; |
| 2770 } | 2794 } |
| 2771 | 2795 |
| 2772 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve
nt) | 2796 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve
nt) |
| 2773 { | 2797 { |
| 2774 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); | 2798 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); |
| 2775 | |
| 2776 return m_pointerEventManager.handleTouchEvents(event); | 2799 return m_pointerEventManager.handleTouchEvents(event); |
| 2777 } | 2800 } |
| 2778 | 2801 |
| 2779 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) | 2802 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) |
| 2780 { | 2803 { |
| 2781 m_mousePositionIsUnknown = false; | 2804 m_mousePositionIsUnknown = false; |
| 2782 m_lastKnownMousePosition = event.position(); | 2805 m_lastKnownMousePosition = event.position(); |
| 2783 m_lastKnownMouseGlobalPosition = event.globalPosition(); | 2806 m_lastKnownMouseGlobalPosition = event.globalPosition(); |
| 2784 } | 2807 } |
| 2785 | 2808 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 | 2848 |
| 2826 FrameHost* EventHandler::frameHost() const | 2849 FrameHost* EventHandler::frameHost() const |
| 2827 { | 2850 { |
| 2828 if (!m_frame->page()) | 2851 if (!m_frame->page()) |
| 2829 return nullptr; | 2852 return nullptr; |
| 2830 | 2853 |
| 2831 return &m_frame->page()->frameHost(); | 2854 return &m_frame->page()->frameHost(); |
| 2832 } | 2855 } |
| 2833 | 2856 |
| 2834 } // namespace blink | 2857 } // namespace blink |
| OLD | NEW |