| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "core/rendering/HitTestRequest.h" | 78 #include "core/rendering/HitTestRequest.h" |
| 79 #include "core/rendering/HitTestResult.h" | 79 #include "core/rendering/HitTestResult.h" |
| 80 #include "core/rendering/RenderFlowThread.h" | 80 #include "core/rendering/RenderFlowThread.h" |
| 81 #include "core/rendering/RenderLayer.h" | 81 #include "core/rendering/RenderLayer.h" |
| 82 #include "core/rendering/RenderTextControlSingleLine.h" | 82 #include "core/rendering/RenderTextControlSingleLine.h" |
| 83 #include "core/rendering/RenderView.h" | 83 #include "core/rendering/RenderView.h" |
| 84 #include "core/rendering/RenderWidget.h" | 84 #include "core/rendering/RenderWidget.h" |
| 85 #include "core/rendering/style/CursorList.h" | 85 #include "core/rendering/style/CursorList.h" |
| 86 #include "core/rendering/style/RenderStyle.h" | 86 #include "core/rendering/style/RenderStyle.h" |
| 87 #include "core/svg/SVGDocument.h" | 87 #include "core/svg/SVGDocument.h" |
| 88 #include "core/svg/SVGElementInstance.h" | |
| 89 #include "core/svg/SVGUseElement.h" | 88 #include "core/svg/SVGUseElement.h" |
| 90 #include "platform/PlatformGestureEvent.h" | 89 #include "platform/PlatformGestureEvent.h" |
| 91 #include "platform/PlatformKeyboardEvent.h" | 90 #include "platform/PlatformKeyboardEvent.h" |
| 92 #include "platform/PlatformTouchEvent.h" | 91 #include "platform/PlatformTouchEvent.h" |
| 93 #include "platform/PlatformWheelEvent.h" | 92 #include "platform/PlatformWheelEvent.h" |
| 94 #include "platform/WindowsKeyboardCodes.h" | 93 #include "platform/WindowsKeyboardCodes.h" |
| 95 #include "platform/geometry/FloatPoint.h" | 94 #include "platform/geometry/FloatPoint.h" |
| 96 #include "platform/graphics/Image.h" | 95 #include "platform/graphics/Image.h" |
| 97 #include "platform/heap/Handle.h" | 96 #include "platform/heap/Handle.h" |
| 98 #include "platform/scroll/ScrollAnimator.h" | 97 #include "platform/scroll/ScrollAnimator.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 251 |
| 253 void EventHandler::clear() | 252 void EventHandler::clear() |
| 254 { | 253 { |
| 255 m_hoverTimer.stop(); | 254 m_hoverTimer.stop(); |
| 256 m_cursorUpdateTimer.stop(); | 255 m_cursorUpdateTimer.stop(); |
| 257 m_fakeMouseMoveEventTimer.stop(); | 256 m_fakeMouseMoveEventTimer.stop(); |
| 258 m_activeIntervalTimer.stop(); | 257 m_activeIntervalTimer.stop(); |
| 259 m_resizeScrollableArea = 0; | 258 m_resizeScrollableArea = 0; |
| 260 m_nodeUnderMouse = nullptr; | 259 m_nodeUnderMouse = nullptr; |
| 261 m_lastNodeUnderMouse = nullptr; | 260 m_lastNodeUnderMouse = nullptr; |
| 262 m_lastInstanceUnderMouse = nullptr; | |
| 263 m_lastMouseMoveEventSubframe = nullptr; | 261 m_lastMouseMoveEventSubframe = nullptr; |
| 264 m_lastScrollbarUnderMouse = nullptr; | 262 m_lastScrollbarUnderMouse = nullptr; |
| 265 m_clickCount = 0; | 263 m_clickCount = 0; |
| 266 m_clickNode = nullptr; | 264 m_clickNode = nullptr; |
| 267 m_frameSetBeingResized = nullptr; | 265 m_frameSetBeingResized = nullptr; |
| 268 m_dragTarget = nullptr; | 266 m_dragTarget = nullptr; |
| 269 m_shouldOnlyFireDragOverEvent = false; | 267 m_shouldOnlyFireDragOverEvent = false; |
| 270 m_mousePositionIsUnknown = true; | 268 m_mousePositionIsUnknown = true; |
| 271 m_lastKnownMousePosition = IntPoint(); | 269 m_lastKnownMousePosition = IntPoint(); |
| 272 m_lastKnownMouseGlobalPosition = IntPoint(); | 270 m_lastKnownMouseGlobalPosition = IntPoint(); |
| (...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 } | 1793 } |
| 1796 | 1794 |
| 1797 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) | 1795 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) |
| 1798 { | 1796 { |
| 1799 ASSERT(m_frame); | 1797 ASSERT(m_frame); |
| 1800 ASSERT(m_frame->document()); | 1798 ASSERT(m_frame->document()); |
| 1801 | 1799 |
| 1802 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo
wPoint(m_frame, mev.position()), mev); | 1800 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo
wPoint(m_frame, mev.position()), mev); |
| 1803 } | 1801 } |
| 1804 | 1802 |
| 1805 static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
referenceNode) | |
| 1806 { | |
| 1807 if (!referenceNode || !referenceNode->isSVGElement()) | |
| 1808 return 0; | |
| 1809 | |
| 1810 ShadowRoot* shadowRoot = referenceNode->containingShadowRoot(); | |
| 1811 if (!shadowRoot) | |
| 1812 return 0; | |
| 1813 | |
| 1814 Element* shadowTreeParentElement = shadowRoot->host(); | |
| 1815 if (!isSVGUseElement(shadowTreeParentElement)) | |
| 1816 return 0; | |
| 1817 | |
| 1818 return toSVGUseElement(shadowTreeParentElement)->instanceForShadowTreeElemen
t(referenceNode); | |
| 1819 } | |
| 1820 | |
| 1821 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent, bool fireMouseOverOut) | 1803 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent, bool fireMouseOverOut) |
| 1822 { | 1804 { |
| 1823 Node* result = targetNode; | 1805 Node* result = targetNode; |
| 1824 | 1806 |
| 1825 // If we're capturing, we always go right to that node. | 1807 // If we're capturing, we always go right to that node. |
| 1826 if (m_capturingMouseEventsNode) | 1808 if (m_capturingMouseEventsNode) |
| 1827 result = m_capturingMouseEventsNode.get(); | 1809 result = m_capturingMouseEventsNode.get(); |
| 1828 else { | 1810 else { |
| 1829 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 | 1811 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 |
| 1830 if (result && result->isTextNode()) | 1812 if (result && result->isTextNode()) |
| 1831 result = NodeRenderingTraversal::parent(result); | 1813 result = NodeRenderingTraversal::parent(result); |
| 1832 } | 1814 } |
| 1833 m_nodeUnderMouse = result; | 1815 m_nodeUnderMouse = result; |
| 1834 | 1816 |
| 1835 // <use> shadow tree elements may have been recloned, update node under mous
e in any case | |
| 1836 if (m_lastInstanceUnderMouse) { | |
| 1837 SVGElement* lastCorrespondingElement = m_lastInstanceUnderMouse->corresp
ondingElement(); | |
| 1838 SVGElement* lastCorrespondingUseElement = m_lastInstanceUnderMouse->corr
espondingUseElement(); | |
| 1839 | |
| 1840 if (lastCorrespondingElement && lastCorrespondingUseElement) { | |
| 1841 HashSet<SVGElementInstance*> instances = lastCorrespondingElement->i
nstancesForElement(); | |
| 1842 | |
| 1843 // Locate the recloned shadow tree element for our corresponding ins
tance | |
| 1844 HashSet<SVGElementInstance*>::iterator end = instances.end(); | |
| 1845 for (HashSet<SVGElementInstance*>::iterator it = instances.begin();
it != end; ++it) { | |
| 1846 SVGElementInstance* instance = (*it); | |
| 1847 ASSERT(instance->correspondingElement() == lastCorrespondingElem
ent); | |
| 1848 | |
| 1849 if (instance == m_lastInstanceUnderMouse) | |
| 1850 continue; | |
| 1851 | |
| 1852 if (instance->correspondingUseElement() != lastCorrespondingUseE
lement) | |
| 1853 continue; | |
| 1854 | |
| 1855 SVGElement* shadowTreeElement = instance->shadowTreeElement(); | |
| 1856 if (!shadowTreeElement->inDocument() || m_lastNodeUnderMouse ==
shadowTreeElement) | |
| 1857 continue; | |
| 1858 | |
| 1859 m_lastNodeUnderMouse = shadowTreeElement; | |
| 1860 m_lastInstanceUnderMouse = instance; | |
| 1861 break; | |
| 1862 } | |
| 1863 } | |
| 1864 } | |
| 1865 | |
| 1866 // Fire mouseout/mouseover if the mouse has shifted to a different node. | 1817 // Fire mouseout/mouseover if the mouse has shifted to a different node. |
| 1867 if (fireMouseOverOut) { | 1818 if (fireMouseOverOut) { |
| 1868 RenderLayer* layerForLastNode = layerForNode(m_lastNodeUnderMouse.get())
; | 1819 RenderLayer* layerForLastNode = layerForNode(m_lastNodeUnderMouse.get())
; |
| 1869 RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get(
)); | 1820 RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get(
)); |
| 1870 Page* page = m_frame->page(); | 1821 Page* page = m_frame->page(); |
| 1871 | 1822 |
| 1872 if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->docu
ment() != m_frame->document())) { | 1823 if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->docu
ment() != m_frame->document())) { |
| 1873 // The mouse has moved between frames. | 1824 // The mouse has moved between frames. |
| 1874 if (LocalFrame* frame = m_lastNodeUnderMouse->document().frame()) { | 1825 if (LocalFrame* frame = m_lastNodeUnderMouse->document().frame()) { |
| 1875 if (FrameView* frameView = frame->view()) | 1826 if (FrameView* frameView = frame->view()) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1889 } | 1840 } |
| 1890 } else if (page && (layerForNodeUnderMouse && (!layerForLastNode || laye
rForNodeUnderMouse != layerForLastNode))) { | 1841 } else if (page && (layerForNodeUnderMouse && (!layerForLastNode || laye
rForNodeUnderMouse != layerForLastNode))) { |
| 1891 // The mouse has moved between layers. | 1842 // The mouse has moved between layers. |
| 1892 if (ScrollableArea* scrollableAreaForNodeUnderMouse = associatedScro
llableArea(layerForNodeUnderMouse)) | 1843 if (ScrollableArea* scrollableAreaForNodeUnderMouse = associatedScro
llableArea(layerForNodeUnderMouse)) |
| 1893 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea(); | 1844 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea(); |
| 1894 } | 1845 } |
| 1895 | 1846 |
| 1896 if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame-
>document()) { | 1847 if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame-
>document()) { |
| 1897 m_lastNodeUnderMouse = nullptr; | 1848 m_lastNodeUnderMouse = nullptr; |
| 1898 m_lastScrollbarUnderMouse = nullptr; | 1849 m_lastScrollbarUnderMouse = nullptr; |
| 1899 m_lastInstanceUnderMouse = nullptr; | |
| 1900 } | 1850 } |
| 1901 | 1851 |
| 1902 if (m_lastNodeUnderMouse != m_nodeUnderMouse) { | 1852 if (m_lastNodeUnderMouse != m_nodeUnderMouse) { |
| 1903 // send mouseout event to the old node | 1853 // send mouseout event to the old node |
| 1904 if (m_lastNodeUnderMouse) | 1854 if (m_lastNodeUnderMouse) |
| 1905 m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNa
mes::mouseout, 0, m_nodeUnderMouse.get()); | 1855 m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNa
mes::mouseout, 0, m_nodeUnderMouse.get()); |
| 1906 // send mouseover event to the new node | 1856 // send mouseover event to the new node |
| 1907 if (m_nodeUnderMouse) | 1857 if (m_nodeUnderMouse) |
| 1908 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames:
:mouseover, 0, m_lastNodeUnderMouse.get()); | 1858 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames:
:mouseover, 0, m_lastNodeUnderMouse.get()); |
| 1909 } | 1859 } |
| 1910 m_lastNodeUnderMouse = m_nodeUnderMouse; | 1860 m_lastNodeUnderMouse = m_nodeUnderMouse; |
| 1911 m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nod
eUnderMouse.get()); | |
| 1912 } | 1861 } |
| 1913 } | 1862 } |
| 1914 | 1863 |
| 1915 // The return value means 'continue default handling.' | 1864 // The return value means 'continue default handling.' |
| 1916 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) |
| 1917 { | 1866 { |
| 1918 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); | 1867 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); |
| 1919 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); | 1868 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); |
| 1920 } | 1869 } |
| 1921 | 1870 |
| (...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3785 unsigned EventHandler::accessKeyModifiers() | 3734 unsigned EventHandler::accessKeyModifiers() |
| 3786 { | 3735 { |
| 3787 #if OS(MACOSX) | 3736 #if OS(MACOSX) |
| 3788 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3737 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3789 #else | 3738 #else |
| 3790 return PlatformEvent::AltKey; | 3739 return PlatformEvent::AltKey; |
| 3791 #endif | 3740 #endif |
| 3792 } | 3741 } |
| 3793 | 3742 |
| 3794 } // namespace WebCore | 3743 } // namespace WebCore |
| OLD | NEW |