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

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

Issue 509173004: Revert of Reduce hit test on ShowPress by moving event targeting to WebViewImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/page/EventHandler.h ('k') | Source/web/WebViewImpl.h » ('j') | 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "core/inspector/InspectorController.h" 62 #include "core/inspector/InspectorController.h"
63 #include "core/loader/FrameLoader.h" 63 #include "core/loader/FrameLoader.h"
64 #include "core/loader/FrameLoaderClient.h" 64 #include "core/loader/FrameLoaderClient.h"
65 #include "core/page/AutoscrollController.h" 65 #include "core/page/AutoscrollController.h"
66 #include "core/page/BackForwardClient.h" 66 #include "core/page/BackForwardClient.h"
67 #include "core/page/Chrome.h" 67 #include "core/page/Chrome.h"
68 #include "core/page/ChromeClient.h" 68 #include "core/page/ChromeClient.h"
69 #include "core/page/DragController.h" 69 #include "core/page/DragController.h"
70 #include "core/page/DragState.h" 70 #include "core/page/DragState.h"
71 #include "core/page/EditorClient.h" 71 #include "core/page/EditorClient.h"
72 #include "core/page/EventWithHitTestResults.h"
72 #include "core/page/FocusController.h" 73 #include "core/page/FocusController.h"
73 #include "core/page/FrameTree.h" 74 #include "core/page/FrameTree.h"
74 #include "core/page/Page.h" 75 #include "core/page/Page.h"
75 #include "core/page/SpatialNavigation.h" 76 #include "core/page/SpatialNavigation.h"
76 #include "core/page/TouchAdjustment.h" 77 #include "core/page/TouchAdjustment.h"
77 #include "core/rendering/HitTestRequest.h" 78 #include "core/rendering/HitTestRequest.h"
78 #include "core/rendering/HitTestResult.h" 79 #include "core/rendering/HitTestResult.h"
79 #include "core/rendering/RenderFlowThread.h" 80 #include "core/rendering/RenderFlowThread.h"
80 #include "core/rendering/RenderLayer.h" 81 #include "core/rendering/RenderLayer.h"
81 #include "core/rendering/RenderTextControlSingleLine.h" 82 #include "core/rendering/RenderTextControlSingleLine.h"
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 ScrollableArea* sa = *it; 2056 ScrollableArea* sa = *it;
2056 ScrollAnimator* animator = sa->existingScrollAnimator(); 2057 ScrollAnimator* animator = sa->existingScrollAnimator();
2057 if (animator) 2058 if (animator)
2058 animator->cancelAnimations(); 2059 animator->cancelAnimations();
2059 } 2060 }
2060 return false; 2061 return false;
2061 } 2062 }
2062 2063
2063 bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) 2064 bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
2064 { 2065 {
2065 // Propagation to inner frames is handled below this function.
2066 ASSERT(m_frame == m_frame->localFrameRoot());
2067
2068 // Scrolling-related gesture events invoke EventHandler recursively for each frame down
2069 // the chain, doing a single-frame hit-test per frame. This matches handleWh eelEvent.
2070 // FIXME: Add a test that traverses this path, e.g. for devtools overlay.
2071 if (gestureEvent.isScrollEvent())
2072 return handleGestureScrollEvent(gestureEvent);
2073
2074 // Hit test across all frames and do touch adjustment as necessary for the e vent type.
2075 GestureEventWithHitTestResults targetedEvent = targetGestureEvent(gestureEve nt);
2076
2077 return handleGestureEvent(targetedEvent);
2078 }
2079
2080 bool EventHandler::handleGestureEvent(const GestureEventWithHitTestResults& targ etedEvent)
2081 {
2082 TRACE_EVENT0("input", "EventHandler::handleGestureEvent"); 2066 TRACE_EVENT0("input", "EventHandler::handleGestureEvent");
2083 2067
2084 // Propagation to inner frames is handled below this function. 2068 // Propagation to inner frames is handled below this function.
2085 ASSERT(m_frame == m_frame->localFrameRoot()); 2069 ASSERT(m_frame == m_frame->localFrameRoot());
2086 2070
2087 // Non-scrolling related gesture events do a single cross-frame hit-test and jump 2071 // Scrolling-related gesture events invoke EventHandler recursively for each frame down
2088 // directly to the inner most frame. This matches handleMousePressEvent etc. 2072 // the chain, doing a single-frame hit-test per frame. This matches handleWh eelEvent.
2089 ASSERT(!targetedEvent.event().isScrollEvent()); 2073 // Perhaps we could simplify things by rewriting scroll handling to work inn er frame
2074 // out, and then unify with other gesture events.
2075 if (gestureEvent.isScrollEvent())
2076 return handleGestureScrollEvent(gestureEvent);
2077
2078 // Non-scrolling related gesture events instead do a single cross-frame hit- test and
2079 // jump directly to the inner most frame. This matches handleMousePressEvent etc.
2080
2081 // Hit test across all frames and do touch adjustment as necessary for the e vent type.
2082 GestureEventWithHitTestResults targetedEvent = targetGestureEvent(gestureEve nt);
2090 2083
2091 // Route to the correct frame. 2084 // Route to the correct frame.
2092 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame()) 2085 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame())
2093 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); 2086 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t);
2094 2087
2095 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? 2088 // No hit test result, handle in root instance. Perhaps we should just retur n false instead?
2096 return handleGestureEventInFrame(targetedEvent); 2089 return handleGestureEventInFrame(targetedEvent);
2097 } 2090 }
2098 2091
2099 bool EventHandler::handleGestureEventInFrame(const GestureEventWithHitTestResult s& targetedEvent) 2092 bool EventHandler::handleGestureEventInFrame(const GestureEventWithHitTestResult s& targetedEvent)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 break; 2128 break;
2136 default: 2129 default:
2137 ASSERT_NOT_REACHED(); 2130 ASSERT_NOT_REACHED();
2138 } 2131 }
2139 2132
2140 return false; 2133 return false;
2141 } 2134 }
2142 2135
2143 bool EventHandler::handleGestureScrollEvent(const PlatformGestureEvent& gestureE vent) 2136 bool EventHandler::handleGestureScrollEvent(const PlatformGestureEvent& gestureE vent)
2144 { 2137 {
2145 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent");
2146
2147 RefPtrWillBeRawPtr<Node> eventTarget = nullptr; 2138 RefPtrWillBeRawPtr<Node> eventTarget = nullptr;
2148 RefPtr<Scrollbar> scrollbar; 2139 RefPtr<Scrollbar> scrollbar;
2149 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { 2140 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) {
2150 scrollbar = m_scrollbarHandlingScrollGesture.get(); 2141 scrollbar = m_scrollbarHandlingScrollGesture.get();
2151 eventTarget = m_scrollGestureHandlingNode.get(); 2142 eventTarget = m_scrollGestureHandlingNode.get();
2152 } 2143 }
2153 2144
2154 if (!eventTarget) { 2145 if (!eventTarget) {
2155 Document* document = m_frame->document(); 2146 Document* document = m_frame->document();
2156 if (!document->renderView()) 2147 if (!document->renderView())
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius); 2549 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
2559 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2550 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes;
2560 copyToVector(result.rectBasedTestResult(), nodes); 2551 copyToVector(result.rectBasedTestResult(), nodes);
2561 2552
2562 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2553 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2563 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node> >(nodes)); 2554 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node> >(nodes));
2564 } 2555 }
2565 2556
2566 GestureEventWithHitTestResults EventHandler::targetGestureEvent(const PlatformGe stureEvent& gestureEvent, bool readOnly) 2557 GestureEventWithHitTestResults EventHandler::targetGestureEvent(const PlatformGe stureEvent& gestureEvent, bool readOnly)
2567 { 2558 {
2568 TRACE_EVENT0("input", "EventHandler::targetGestureEvent");
2569
2570 ASSERT(m_frame == m_frame->localFrameRoot()); 2559 ASSERT(m_frame == m_frame->localFrameRoot());
2571 // Scrolling events get hit tested per frame (like wheel events do). 2560 // Scrolling events get hit tested per frame (like wheel events do).
2572 ASSERT(!gestureEvent.isScrollEvent()); 2561 ASSERT(!gestureEvent.isScrollEvent());
2573 2562
2574 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type()); 2563 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type());
2575 double activeInterval = 0; 2564 double activeInterval = 0;
2576 bool shouldKeepActiveForMinInterval = false; 2565 bool shouldKeepActiveForMinInterval = false;
2577 if (readOnly) { 2566 if (readOnly) {
2578 hitType |= HitTestRequest::ReadOnly; 2567 hitType |= HitTestRequest::ReadOnly;
2579 } else if (gestureEvent.type() == PlatformEvent::GestureTap) { 2568 } else if (gestureEvent.type() == PlatformEvent::GestureTap) {
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3892 unsigned EventHandler::accessKeyModifiers() 3881 unsigned EventHandler::accessKeyModifiers()
3893 { 3882 {
3894 #if OS(MACOSX) 3883 #if OS(MACOSX)
3895 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3884 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3896 #else 3885 #else
3897 return PlatformEvent::AltKey; 3886 return PlatformEvent::AltKey;
3898 #endif 3887 #endif
3899 } 3888 }
3900 3889
3901 } // namespace blink 3890 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698