Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 210753002: Remove EventPath::parent() in favor of NodeRenderingTraversal::parent(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/events/EventPath.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 if (handleDrag(event, ShouldCheckDragHysteresis)) 693 if (handleDrag(event, ShouldCheckDragHysteresis))
694 return true; 694 return true;
695 695
696 Node* targetNode = event.targetNode(); 696 Node* targetNode = event.targetNode();
697 if (event.event().button() != LeftButton || !targetNode) 697 if (event.event().button() != LeftButton || !targetNode)
698 return false; 698 return false;
699 699
700 RenderObject* renderer = targetNode->renderer(); 700 RenderObject* renderer = targetNode->renderer();
701 if (!renderer) { 701 if (!renderer) {
702 Node* parent = EventPath::parent(targetNode); 702 Node* parent = NodeRenderingTraversal::parent(targetNode);
703 if (!parent) 703 if (!parent)
704 return false; 704 return false;
705 705
706 renderer = parent->renderer(); 706 renderer = parent->renderer();
707 if (!renderer || !renderer->isListBox()) 707 if (!renderer || !renderer->isListBox())
708 return false; 708 return false;
709 } 709 }
710 710
711 m_mouseDownMayStartDrag = false; 711 m_mouseDownMayStartDrag = false;
712 712
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 1794
1795 if (!m_frame->view()) 1795 if (!m_frame->view())
1796 return false; 1796 return false;
1797 1797
1798 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::ConfusingA ndOftenMisusedDisallowShadowContent); 1798 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::ConfusingA ndOftenMisusedDisallowShadowContent);
1799 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); 1799 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
1800 1800
1801 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch) 1801 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch)
1802 RefPtr<Node> newTarget = mev.targetNode(); 1802 RefPtr<Node> newTarget = mev.targetNode();
1803 if (newTarget && newTarget->isTextNode()) 1803 if (newTarget && newTarget->isTextNode())
1804 newTarget = EventPath::parent(newTarget.get()); 1804 newTarget = NodeRenderingTraversal::parent(newTarget.get());
1805 1805
1806 if (AutoscrollController* controller = autoscrollController()) 1806 if (AutoscrollController* controller = autoscrollController())
1807 controller->updateDragAndDrop(newTarget.get(), event.position(), event.t imestamp()); 1807 controller->updateDragAndDrop(newTarget.get(), event.position(), event.t imestamp());
1808 1808
1809 if (m_dragTarget != newTarget) { 1809 if (m_dragTarget != newTarget) {
1810 // FIXME: this ordering was explicitly chosen to match WinIE. However, 1810 // FIXME: this ordering was explicitly chosen to match WinIE. However,
1811 // it is sometimes incorrect when dragging within subframes, as seen wit h 1811 // it is sometimes incorrect when dragging within subframes, as seen wit h
1812 // LayoutTests/fast/events/drag-in-frames.html. 1812 // LayoutTests/fast/events/drag-in-frames.html.
1813 // 1813 //
1814 // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. <http://dev.w3.org/html5/spec/Overview.html#drag-and-drop-processing-model>. 1814 // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. <http://dev.w3.org/html5/spec/Overview.html#drag-and-drop-processing-model>.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo useEvent& mouseEvent, bool fireMouseOverOut) 1928 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo useEvent& mouseEvent, bool fireMouseOverOut)
1929 { 1929 {
1930 Node* result = targetNode; 1930 Node* result = targetNode;
1931 1931
1932 // If we're capturing, we always go right to that node. 1932 // If we're capturing, we always go right to that node.
1933 if (m_capturingMouseEventsNode) 1933 if (m_capturingMouseEventsNode)
1934 result = m_capturingMouseEventsNode.get(); 1934 result = m_capturingMouseEventsNode.get();
1935 else { 1935 else {
1936 // If the target node is a text node, dispatch on the parent node - rdar ://4196646 1936 // If the target node is a text node, dispatch on the parent node - rdar ://4196646
1937 if (result && result->isTextNode()) 1937 if (result && result->isTextNode())
1938 result = EventPath::parent(result); 1938 result = NodeRenderingTraversal::parent(result);
1939 } 1939 }
1940 m_nodeUnderMouse = result; 1940 m_nodeUnderMouse = result;
1941 m_instanceUnderMouse = instanceAssociatedWithShadowTreeElement(result); 1941 m_instanceUnderMouse = instanceAssociatedWithShadowTreeElement(result);
1942 1942
1943 // <use> shadow tree elements may have been recloned, update node under mous e in any case 1943 // <use> shadow tree elements may have been recloned, update node under mous e in any case
1944 if (m_lastInstanceUnderMouse) { 1944 if (m_lastInstanceUnderMouse) {
1945 SVGElement* lastCorrespondingElement = m_lastInstanceUnderMouse->corresp ondingElement(); 1945 SVGElement* lastCorrespondingElement = m_lastInstanceUnderMouse->corresp ondingElement();
1946 SVGElement* lastCorrespondingUseElement = m_lastInstanceUnderMouse->corr espondingUseElement(); 1946 SVGElement* lastCorrespondingUseElement = m_lastInstanceUnderMouse->corr espondingUseElement();
1947 1947
1948 if (lastCorrespondingElement && lastCorrespondingUseElement) { 1948 if (lastCorrespondingElement && lastCorrespondingUseElement) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 2136
2137 LayoutPoint vPoint = view->windowToContents(e.position()); 2137 LayoutPoint vPoint = view->windowToContents(e.position());
2138 2138
2139 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::ConfusingA ndOftenMisusedDisallowShadowContent); 2139 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::ConfusingA ndOftenMisusedDisallowShadowContent);
2140 HitTestResult result(vPoint); 2140 HitTestResult result(vPoint);
2141 doc->renderView()->hitTest(request, result); 2141 doc->renderView()->hitTest(request, result);
2142 2142
2143 Node* node = result.innerNode(); 2143 Node* node = result.innerNode();
2144 // Wheel events should not dispatch to text nodes. 2144 // Wheel events should not dispatch to text nodes.
2145 if (node && node->isTextNode()) 2145 if (node && node->isTextNode())
2146 node = EventPath::parent(node); 2146 node = NodeRenderingTraversal::parent(node);
2147 2147
2148 bool isOverWidget; 2148 bool isOverWidget;
2149 if (e.useLatchedEventNode()) { 2149 if (e.useLatchedEventNode()) {
2150 if (!m_latchedWheelEventNode) { 2150 if (!m_latchedWheelEventNode) {
2151 m_latchedWheelEventNode = node; 2151 m_latchedWheelEventNode = node;
2152 m_widgetIsLatched = result.isOverWidget(); 2152 m_widgetIsLatched = result.isOverWidget();
2153 } else 2153 } else
2154 node = m_latchedWheelEventNode.get(); 2154 node = m_latchedWheelEventNode.get();
2155 2155
2156 isOverWidget = m_widgetIsLatched; 2156 isOverWidget = m_widgetIsLatched;
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 result = hitTestResultInFrame(m_originatingTouchPointDocument->f rame(), pagePointInOriginatingDocument, hitType); 3657 result = hitTestResultInFrame(m_originatingTouchPointDocument->f rame(), pagePointInOriginatingDocument, hitType);
3658 } else 3658 } else
3659 continue; 3659 continue;
3660 3660
3661 Node* node = result.innerNode(); 3661 Node* node = result.innerNode();
3662 if (!node) 3662 if (!node)
3663 continue; 3663 continue;
3664 3664
3665 // Touch events should not go to text nodes 3665 // Touch events should not go to text nodes
3666 if (node->isTextNode()) 3666 if (node->isTextNode())
3667 node = EventPath::parent(node); 3667 node = NodeRenderingTraversal::parent(node);
3668 3668
3669 Document& doc = node->document(); 3669 Document& doc = node->document();
3670 // Record the originating touch document even if it does not have a touch listener. 3670 // Record the originating touch document even if it does not have a touch listener.
3671 if (freshTouchEvents) { 3671 if (freshTouchEvents) {
3672 m_originatingTouchPointDocument = &doc; 3672 m_originatingTouchPointDocument = &doc;
3673 freshTouchEvents = false; 3673 freshTouchEvents = false;
3674 } 3674 }
3675 if (!doc.hasTouchEventHandlers()) 3675 if (!doc.hasTouchEventHandlers())
3676 continue; 3676 continue;
3677 m_originatingTouchPointTargets.set(touchPointTargetKey, node); 3677 m_originatingTouchPointTargets.set(touchPointTargetKey, node);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
4024 unsigned EventHandler::accessKeyModifiers() 4024 unsigned EventHandler::accessKeyModifiers()
4025 { 4025 {
4026 #if OS(MACOSX) 4026 #if OS(MACOSX)
4027 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4027 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4028 #else 4028 #else
4029 return PlatformEvent::AltKey; 4029 return PlatformEvent::AltKey;
4030 #endif 4030 #endif
4031 } 4031 }
4032 4032
4033 } // namespace WebCore 4033 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/events/EventPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698