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

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

Issue 490783003: Reduce hit test on ShowPress by moving event targeting to WebViewImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unnecessary headers Created 6 years, 4 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
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"
73 #include "core/page/FocusController.h" 72 #include "core/page/FocusController.h"
74 #include "core/page/FrameTree.h" 73 #include "core/page/FrameTree.h"
75 #include "core/page/Page.h" 74 #include "core/page/Page.h"
76 #include "core/page/SpatialNavigation.h" 75 #include "core/page/SpatialNavigation.h"
77 #include "core/page/TouchAdjustment.h" 76 #include "core/page/TouchAdjustment.h"
78 #include "core/rendering/HitTestRequest.h" 77 #include "core/rendering/HitTestRequest.h"
79 #include "core/rendering/HitTestResult.h" 78 #include "core/rendering/HitTestResult.h"
80 #include "core/rendering/RenderFlowThread.h" 79 #include "core/rendering/RenderFlowThread.h"
81 #include "core/rendering/RenderLayer.h" 80 #include "core/rendering/RenderLayer.h"
82 #include "core/rendering/RenderTextControlSingleLine.h" 81 #include "core/rendering/RenderTextControlSingleLine.h"
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 ScrollableArea* sa = *it; 2055 ScrollableArea* sa = *it;
2057 ScrollAnimator* animator = sa->existingScrollAnimator(); 2056 ScrollAnimator* animator = sa->existingScrollAnimator();
2058 if (animator) 2057 if (animator)
2059 animator->cancelAnimations(); 2058 animator->cancelAnimations();
2060 } 2059 }
2061 return false; 2060 return false;
2062 } 2061 }
2063 2062
2064 bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) 2063 bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
2065 { 2064 {
2066 TRACE_EVENT0("input", "EventHandler::handleGestureEvent"); 2065 TRACE_EVENT0("input", "EventHandler::handleGestureEvent");
Rick Byers 2014/08/22 14:49:57 How about we remove this trace (since it's normall
Zeeshan Qureshi 2014/08/22 15:30:50 Agreed, I only added here because I was thinking a
2067 2066
2068 // Propagation to inner frames is handled below this function. 2067 // Propagation to inner frames is handled below this function.
2069 ASSERT(m_frame == m_frame->localFrameRoot()); 2068 ASSERT(m_frame == m_frame->localFrameRoot());
2070 2069
2071 // Scrolling-related gesture events invoke EventHandler recursively for each frame down 2070 // Scrolling-related gesture events invoke EventHandler recursively for each frame down
2072 // the chain, doing a single-frame hit-test per frame. This matches handleWh eelEvent. 2071 // the chain, doing a single-frame hit-test per frame. This matches handleWh eelEvent.
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()) 2072 if (gestureEvent.isScrollEvent())
2076 return handleGestureScrollEvent(gestureEvent); 2073 handleGestureScrollEvent(gestureEvent);
Rick Byers 2014/08/22 14:49:57 you still need the return here, right?
Zeeshan Qureshi 2014/08/22 15:30:50 Oh yes, and all the tests passed!
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 2074
2081 // Hit test across all frames and do touch adjustment as necessary for the e vent type. 2075 // Hit test across all frames and do touch adjustment as necessary for the e vent type.
2082 GestureEventWithHitTestResults targetedEvent = targetGestureEvent(gestureEve nt); 2076 GestureEventWithHitTestResults targetedEvent = targetGestureEvent(gestureEve nt);
2083 2077
2078 return handleGestureEvent(targetedEvent);
2079 }
2080
2081 bool EventHandler::handleGestureEvent(const GestureEventWithHitTestResults& targ etedEvent)
2082 {
2083 TRACE_EVENT0("input", "EventHandler::handleGestureEvent");
2084
2085 // Propagation to inner frames is handled below this function.
2086 ASSERT(m_frame == m_frame->localFrameRoot());
2087
2088 // Non-scrolling related gesture events do a single cross-frame hit-test and jump
2089 // directly to the inner most frame. This matches handleMousePressEvent etc.
2090 ASSERT(!targetedEvent.event().isScrollEvent());
2091
2084 // Route to the correct frame. 2092 // Route to the correct frame.
2085 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame()) 2093 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame())
2086 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); 2094 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t);
2087 2095
2088 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? 2096 // No hit test result, handle in root instance. Perhaps we should just retur n false instead?
2089 return handleGestureEventInFrame(targetedEvent); 2097 return handleGestureEventInFrame(targetedEvent);
2090 } 2098 }
2091 2099
2092 bool EventHandler::handleGestureEventInFrame(const GestureEventWithHitTestResult s& targetedEvent) 2100 bool EventHandler::handleGestureEventInFrame(const GestureEventWithHitTestResult s& targetedEvent)
2093 { 2101 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 break; 2141 break;
2134 default: 2142 default:
2135 ASSERT_NOT_REACHED(); 2143 ASSERT_NOT_REACHED();
2136 } 2144 }
2137 2145
2138 return false; 2146 return false;
2139 } 2147 }
2140 2148
2141 bool EventHandler::handleGestureScrollEvent(const PlatformGestureEvent& gestureE vent) 2149 bool EventHandler::handleGestureScrollEvent(const PlatformGestureEvent& gestureE vent)
2142 { 2150 {
2151 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent");
2152
2143 RefPtrWillBeRawPtr<Node> eventTarget = nullptr; 2153 RefPtrWillBeRawPtr<Node> eventTarget = nullptr;
2144 RefPtr<Scrollbar> scrollbar; 2154 RefPtr<Scrollbar> scrollbar;
2145 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { 2155 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) {
2146 scrollbar = m_scrollbarHandlingScrollGesture.get(); 2156 scrollbar = m_scrollbarHandlingScrollGesture.get();
2147 eventTarget = m_scrollGestureHandlingNode.get(); 2157 eventTarget = m_scrollGestureHandlingNode.get();
2148 } 2158 }
2149 2159
2150 if (!eventTarget) { 2160 if (!eventTarget) {
2151 Document* document = m_frame->document(); 2161 Document* document = m_frame->document();
2152 if (!document->renderView()) 2162 if (!document->renderView())
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 unsigned EventHandler::accessKeyModifiers() 3870 unsigned EventHandler::accessKeyModifiers()
3861 { 3871 {
3862 #if OS(MACOSX) 3872 #if OS(MACOSX)
3863 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3873 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3864 #else 3874 #else
3865 return PlatformEvent::AltKey; 3875 return PlatformEvent::AltKey;
3866 #endif 3876 #endif
3867 } 3877 }
3868 3878
3869 } // namespace blink 3879 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698