| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 252 |
| 254 void EventHandler::clear() | 253 void EventHandler::clear() |
| 255 { | 254 { |
| 256 m_hoverTimer.stop(); | 255 m_hoverTimer.stop(); |
| 257 m_cursorUpdateTimer.stop(); | 256 m_cursorUpdateTimer.stop(); |
| 258 m_fakeMouseMoveEventTimer.stop(); | 257 m_fakeMouseMoveEventTimer.stop(); |
| 259 m_activeIntervalTimer.stop(); | 258 m_activeIntervalTimer.stop(); |
| 260 m_resizeScrollableArea = 0; | 259 m_resizeScrollableArea = 0; |
| 261 m_nodeUnderMouse = nullptr; | 260 m_nodeUnderMouse = nullptr; |
| 262 m_lastNodeUnderMouse = nullptr; | 261 m_lastNodeUnderMouse = nullptr; |
| 263 m_lastInstanceUnderMouse = nullptr; | |
| 264 m_lastMouseMoveEventSubframe = nullptr; | 262 m_lastMouseMoveEventSubframe = nullptr; |
| 265 m_lastScrollbarUnderMouse = nullptr; | 263 m_lastScrollbarUnderMouse = nullptr; |
| 266 m_clickCount = 0; | 264 m_clickCount = 0; |
| 267 m_clickNode = nullptr; | 265 m_clickNode = nullptr; |
| 268 m_frameSetBeingResized = nullptr; | 266 m_frameSetBeingResized = nullptr; |
| 269 m_dragTarget = nullptr; | 267 m_dragTarget = nullptr; |
| 270 m_shouldOnlyFireDragOverEvent = false; | 268 m_shouldOnlyFireDragOverEvent = false; |
| 271 m_mousePositionIsUnknown = true; | 269 m_mousePositionIsUnknown = true; |
| 272 m_lastKnownMousePosition = IntPoint(); | 270 m_lastKnownMousePosition = IntPoint(); |
| 273 m_lastKnownMouseGlobalPosition = IntPoint(); | 271 m_lastKnownMouseGlobalPosition = IntPoint(); |
| (...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 } | 1795 } |
| 1798 | 1796 |
| 1799 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) | 1797 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) |
| 1800 { | 1798 { |
| 1801 ASSERT(m_frame); | 1799 ASSERT(m_frame); |
| 1802 ASSERT(m_frame->document()); | 1800 ASSERT(m_frame->document()); |
| 1803 | 1801 |
| 1804 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo
wPoint(m_frame, mev.position()), mev); | 1802 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo
wPoint(m_frame, mev.position()), mev); |
| 1805 } | 1803 } |
| 1806 | 1804 |
| 1807 static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
referenceNode) | |
| 1808 { | |
| 1809 if (!referenceNode || !referenceNode->isSVGElement()) | |
| 1810 return 0; | |
| 1811 | |
| 1812 ShadowRoot* shadowRoot = referenceNode->containingShadowRoot(); | |
| 1813 if (!shadowRoot) | |
| 1814 return 0; | |
| 1815 | |
| 1816 Element* shadowTreeParentElement = shadowRoot->host(); | |
| 1817 if (!isSVGUseElement(shadowTreeParentElement)) | |
| 1818 return 0; | |
| 1819 | |
| 1820 return toSVGUseElement(shadowTreeParentElement)->instanceForShadowTreeElemen
t(referenceNode); | |
| 1821 } | |
| 1822 | |
| 1823 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent, bool fireMouseOverOut) | 1805 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent, bool fireMouseOverOut) |
| 1824 { | 1806 { |
| 1825 Node* result = targetNode; | 1807 Node* result = targetNode; |
| 1826 | 1808 |
| 1827 // If we're capturing, we always go right to that node. | 1809 // If we're capturing, we always go right to that node. |
| 1828 if (m_capturingMouseEventsNode) | 1810 if (m_capturingMouseEventsNode) |
| 1829 result = m_capturingMouseEventsNode.get(); | 1811 result = m_capturingMouseEventsNode.get(); |
| 1830 else { | 1812 else { |
| 1831 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 | 1813 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 |
| 1832 if (result && result->isTextNode()) | 1814 if (result && result->isTextNode()) |
| 1833 result = NodeRenderingTraversal::parent(result); | 1815 result = NodeRenderingTraversal::parent(result); |
| 1834 } | 1816 } |
| 1835 m_nodeUnderMouse = result; | 1817 m_nodeUnderMouse = result; |
| 1836 | 1818 |
| 1837 // <use> shadow tree elements may have been recloned, update node under mous
e in any case | |
| 1838 if (m_lastInstanceUnderMouse) { | |
| 1839 SVGElement* lastCorrespondingElement = m_lastInstanceUnderMouse->corresp
ondingElement(); | |
| 1840 SVGElement* lastCorrespondingUseElement = m_lastInstanceUnderMouse->corr
espondingUseElement(); | |
| 1841 | |
| 1842 if (lastCorrespondingElement && lastCorrespondingUseElement) { | |
| 1843 HashSet<SVGElementInstance*> instances = lastCorrespondingElement->i
nstancesForElement(); | |
| 1844 | |
| 1845 // Locate the recloned shadow tree element for our corresponding ins
tance | |
| 1846 HashSet<SVGElementInstance*>::iterator end = instances.end(); | |
| 1847 for (HashSet<SVGElementInstance*>::iterator it = instances.begin();
it != end; ++it) { | |
| 1848 SVGElementInstance* instance = (*it); | |
| 1849 ASSERT(instance->correspondingElement() == lastCorrespondingElem
ent); | |
| 1850 | |
| 1851 if (instance == m_lastInstanceUnderMouse) | |
| 1852 continue; | |
| 1853 | |
| 1854 if (instance->correspondingUseElement() != lastCorrespondingUseE
lement) | |
| 1855 continue; | |
| 1856 | |
| 1857 SVGElement* shadowTreeElement = instance->shadowTreeElement(); | |
| 1858 if (!shadowTreeElement->inDocument() || m_lastNodeUnderMouse ==
shadowTreeElement) | |
| 1859 continue; | |
| 1860 | |
| 1861 m_lastNodeUnderMouse = shadowTreeElement; | |
| 1862 m_lastInstanceUnderMouse = instance; | |
| 1863 break; | |
| 1864 } | |
| 1865 } | |
| 1866 } | |
| 1867 | |
| 1868 // Fire mouseout/mouseover if the mouse has shifted to a different node. | 1819 // Fire mouseout/mouseover if the mouse has shifted to a different node. |
| 1869 if (fireMouseOverOut) { | 1820 if (fireMouseOverOut) { |
| 1870 RenderLayer* layerForLastNode = layerForNode(m_lastNodeUnderMouse.get())
; | 1821 RenderLayer* layerForLastNode = layerForNode(m_lastNodeUnderMouse.get())
; |
| 1871 RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get(
)); | 1822 RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get(
)); |
| 1872 Page* page = m_frame->page(); | 1823 Page* page = m_frame->page(); |
| 1873 | 1824 |
| 1874 if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->docu
ment() != m_frame->document())) { | 1825 if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->docu
ment() != m_frame->document())) { |
| 1875 // The mouse has moved between frames. | 1826 // The mouse has moved between frames. |
| 1876 if (LocalFrame* frame = m_lastNodeUnderMouse->document().frame()) { | 1827 if (LocalFrame* frame = m_lastNodeUnderMouse->document().frame()) { |
| 1877 if (FrameView* frameView = frame->view()) | 1828 if (FrameView* frameView = frame->view()) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1891 } | 1842 } |
| 1892 } else if (page && (layerForNodeUnderMouse && (!layerForLastNode || laye
rForNodeUnderMouse != layerForLastNode))) { | 1843 } else if (page && (layerForNodeUnderMouse && (!layerForLastNode || laye
rForNodeUnderMouse != layerForLastNode))) { |
| 1893 // The mouse has moved between layers. | 1844 // The mouse has moved between layers. |
| 1894 if (ScrollableArea* scrollableAreaForNodeUnderMouse = associatedScro
llableArea(layerForNodeUnderMouse)) | 1845 if (ScrollableArea* scrollableAreaForNodeUnderMouse = associatedScro
llableArea(layerForNodeUnderMouse)) |
| 1895 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea(); | 1846 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea(); |
| 1896 } | 1847 } |
| 1897 | 1848 |
| 1898 if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame-
>document()) { | 1849 if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame-
>document()) { |
| 1899 m_lastNodeUnderMouse = nullptr; | 1850 m_lastNodeUnderMouse = nullptr; |
| 1900 m_lastScrollbarUnderMouse = nullptr; | 1851 m_lastScrollbarUnderMouse = nullptr; |
| 1901 m_lastInstanceUnderMouse = nullptr; | |
| 1902 } | 1852 } |
| 1903 | 1853 |
| 1904 if (m_lastNodeUnderMouse != m_nodeUnderMouse) { | 1854 if (m_lastNodeUnderMouse != m_nodeUnderMouse) { |
| 1905 // send mouseout event to the old node | 1855 // send mouseout event to the old node |
| 1906 if (m_lastNodeUnderMouse) | 1856 if (m_lastNodeUnderMouse) |
| 1907 m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNa
mes::mouseout, 0, m_nodeUnderMouse.get()); | 1857 m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNa
mes::mouseout, 0, m_nodeUnderMouse.get()); |
| 1908 // send mouseover event to the new node | 1858 // send mouseover event to the new node |
| 1909 if (m_nodeUnderMouse) | 1859 if (m_nodeUnderMouse) |
| 1910 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames:
:mouseover, 0, m_lastNodeUnderMouse.get()); | 1860 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames:
:mouseover, 0, m_lastNodeUnderMouse.get()); |
| 1911 } | 1861 } |
| 1912 m_lastNodeUnderMouse = m_nodeUnderMouse; | 1862 m_lastNodeUnderMouse = m_nodeUnderMouse; |
| 1913 m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nod
eUnderMouse.get()); | |
| 1914 } | 1863 } |
| 1915 } | 1864 } |
| 1916 | 1865 |
| 1917 // The return value means 'continue default handling.' | 1866 // The return value means 'continue default handling.' |
| 1918 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
tNode, int clickCount, const PlatformMouseEvent& mouseEvent, bool setUnder) | 1867 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
tNode, int clickCount, const PlatformMouseEvent& mouseEvent, bool setUnder) |
| 1919 { | 1868 { |
| 1920 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); | 1869 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); |
| 1921 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); | 1870 return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent,
eventType, clickCount); |
| 1922 } | 1871 } |
| 1923 | 1872 |
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3763 unsigned EventHandler::accessKeyModifiers() | 3712 unsigned EventHandler::accessKeyModifiers() |
| 3764 { | 3713 { |
| 3765 #if OS(MACOSX) | 3714 #if OS(MACOSX) |
| 3766 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3715 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3767 #else | 3716 #else |
| 3768 return PlatformEvent::AltKey; | 3717 return PlatformEvent::AltKey; |
| 3769 #endif | 3718 #endif |
| 3770 } | 3719 } |
| 3771 | 3720 |
| 3772 } // namespace WebCore | 3721 } // namespace WebCore |
| OLD | NEW |