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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1989623002: Suppressed MEs for gestures from cancelled PEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed browser-side plumbing, added tests. Created 4 years, 6 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
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 , m_shouldOnlyFireDragOverEvent(false) 254 , m_shouldOnlyFireDragOverEvent(false)
255 , m_mousePositionIsUnknown(true) 255 , m_mousePositionIsUnknown(true)
256 , m_mouseDownTimestamp(0) 256 , m_mouseDownTimestamp(0)
257 , m_pointerEventManager(frame) 257 , m_pointerEventManager(frame)
258 , m_scrollGestureHandlingNode(nullptr) 258 , m_scrollGestureHandlingNode(nullptr)
259 , m_lastGestureScrollOverWidget(false) 259 , m_lastGestureScrollOverWidget(false)
260 , m_longTapShouldInvokeContextMenu(false) 260 , m_longTapShouldInvokeContextMenu(false)
261 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) 261 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired)
262 , m_lastShowPressTimestamp(0) 262 , m_lastShowPressTimestamp(0)
263 , m_deltaConsumedForScrollSequence(false) 263 , m_deltaConsumedForScrollSequence(false)
264 , m_suppressMouseEventsFromGestures(false)
264 { 265 {
265 } 266 }
266 267
267 EventHandler::~EventHandler() 268 EventHandler::~EventHandler()
268 { 269 {
269 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); 270 ASSERT(!m_fakeMouseMoveEventTimer.isActive());
270 } 271 }
271 272
272 DEFINE_TRACE(EventHandler) 273 DEFINE_TRACE(EventHandler)
273 { 274 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 m_lastDeferredTapElement = nullptr; 328 m_lastDeferredTapElement = nullptr;
328 m_eventHandlerWillResetCapturingMouseEventsNode = false; 329 m_eventHandlerWillResetCapturingMouseEventsNode = false;
329 m_mouseDownMayStartAutoscroll = false; 330 m_mouseDownMayStartAutoscroll = false;
330 m_svgPan = false; 331 m_svgPan = false;
331 m_mouseDownPos = IntPoint(); 332 m_mouseDownPos = IntPoint();
332 m_mouseDownTimestamp = 0; 333 m_mouseDownTimestamp = 0;
333 m_longTapShouldInvokeContextMenu = false; 334 m_longTapShouldInvokeContextMenu = false;
334 m_dragStartPos = LayoutPoint(); 335 m_dragStartPos = LayoutPoint();
335 m_offsetFromResizeCorner = LayoutSize(); 336 m_offsetFromResizeCorner = LayoutSize();
336 m_mouseDown = PlatformMouseEvent(); 337 m_mouseDown = PlatformMouseEvent();
338 m_suppressMouseEventsFromGestures = false;
337 } 339 }
338 340
339 WebInputEventResult EventHandler::mergeEventResult( 341 WebInputEventResult EventHandler::mergeEventResult(
340 WebInputEventResult resultA, WebInputEventResult resultB) 342 WebInputEventResult resultA, WebInputEventResult resultB)
341 { 343 {
342 // The ordering of the enumeration is specific. There are times that 344 // The ordering of the enumeration is specific. There are times that
343 // multiple events fire and we need to combine them into a single 345 // multiple events fire and we need to combine them into a single
344 // result code. The enumeration is based on the level of consumption that 346 // result code. The enumeration is based on the level of consumption that
345 // is most significant. The enumeration is ordered with smaller specified 347 // is most significant. The enumeration is ordered with smaller specified
346 // numbers first. Examples of merged results are: 348 // numbers first. Examples of merged results are:
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 if (gestureDomEvent) { 2058 if (gestureDomEvent) {
2057 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent); 2059 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent);
2058 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { 2060 if (gestureDomEventResult != DispatchEventResult::NotCanceled) {
2059 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler); 2061 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler);
2060 return toWebInputEventResult(gestureDomEventResult); 2062 return toWebInputEventResult(gestureDomEventResult);
2061 } 2063 }
2062 } 2064 }
2063 } 2065 }
2064 2066
2065 switch (gestureEvent.type()) { 2067 switch (gestureEvent.type()) {
2068 case PlatformEvent::GestureTapDown:
2069 return handleGestureTapDown(targetedEvent);
2066 case PlatformEvent::GestureTap: 2070 case PlatformEvent::GestureTap:
2067 return handleGestureTap(targetedEvent); 2071 return handleGestureTap(targetedEvent);
2068 case PlatformEvent::GestureShowPress: 2072 case PlatformEvent::GestureShowPress:
2069 return handleGestureShowPress(); 2073 return handleGestureShowPress();
2070 case PlatformEvent::GestureLongPress: 2074 case PlatformEvent::GestureLongPress:
2071 return handleGestureLongPress(targetedEvent); 2075 return handleGestureLongPress(targetedEvent);
2072 case PlatformEvent::GestureLongTap: 2076 case PlatformEvent::GestureLongTap:
2073 return handleGestureLongTap(targetedEvent); 2077 return handleGestureLongTap(targetedEvent);
2074 case PlatformEvent::GestureTwoFingerTap: 2078 case PlatformEvent::GestureTwoFingerTap:
2075 return sendContextMenuEventForGesture(targetedEvent); 2079 return sendContextMenuEventForGesture(targetedEvent);
2076 case PlatformEvent::GestureTapDown:
2077 case PlatformEvent::GesturePinchBegin: 2080 case PlatformEvent::GesturePinchBegin:
2078 case PlatformEvent::GesturePinchEnd: 2081 case PlatformEvent::GesturePinchEnd:
2079 case PlatformEvent::GesturePinchUpdate: 2082 case PlatformEvent::GesturePinchUpdate:
2080 case PlatformEvent::GestureTapDownCancel: 2083 case PlatformEvent::GestureTapDownCancel:
2081 case PlatformEvent::GestureTapUnconfirmed: 2084 case PlatformEvent::GestureTapUnconfirmed:
2082 break; 2085 break;
2083 default: 2086 default:
2084 ASSERT_NOT_REACHED(); 2087 ASSERT_NOT_REACHED();
2085 } 2088 }
2086 2089
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 case PlatformEvent::GesturePinchBegin: 2157 case PlatformEvent::GesturePinchBegin:
2155 case PlatformEvent::GesturePinchEnd: 2158 case PlatformEvent::GesturePinchEnd:
2156 case PlatformEvent::GesturePinchUpdate: 2159 case PlatformEvent::GesturePinchUpdate:
2157 return WebInputEventResult::NotHandled; 2160 return WebInputEventResult::NotHandled;
2158 default: 2161 default:
2159 ASSERT_NOT_REACHED(); 2162 ASSERT_NOT_REACHED();
2160 return WebInputEventResult::NotHandled; 2163 return WebInputEventResult::NotHandled;
2161 } 2164 }
2162 } 2165 }
2163 2166
2167 WebInputEventResult EventHandler::handleGestureTapDown(const GestureEventWithHit TestResults& targetedEvent)
2168 {
2169 m_suppressMouseEventsFromGestures =
dtapuska 2016/05/27 20:54:07 I see there is an ASSERT in debug mode for the Deq
2170 m_pointerEventManager.firstPrimaryPointerdownResult() != WebInputEventRe sult::NotHandled;
2171 return WebInputEventResult::NotHandled;
2172 }
2173
2164 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest Results& targetedEvent) 2174 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest Results& targetedEvent)
2165 { 2175 {
2166 FrameView* frameView(m_frame->view()); 2176 FrameView* frameView(m_frame->view());
2167 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 2177 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
2168 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type()); 2178 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type());
2169 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); 2179 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion();
2170 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); 2180 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion();
2171 2181
2172 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 2182 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
2173 2183
2174 HitTestResult currentHitTest = targetedEvent.hitTestResult(); 2184 HitTestResult currentHitTest = targetedEvent.hitTestResult();
2175 2185
2176 // We use the adjusted position so the application isn't surprised to see a event with 2186 // We use the adjusted position so the application isn't surprised to see a event with
2177 // co-ordinates outside the target's bounds. 2187 // co-ordinates outside the target's bounds.
2178 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio n()); 2188 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio n());
2189 const unsigned modifiers = gestureEvent.getModifiers();
2179 2190
2180 unsigned modifiers = gestureEvent.getModifiers(); 2191 if (!m_suppressMouseEventsFromGestures) {
2181 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa lPosition(), 2192 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g lobalPosition(),
2182 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, 2193 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,
2183 static_cast<PlatformEvent::Modifiers>(modifiers), 2194 static_cast<PlatformEvent::Modifiers>(modifiers),
2184 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse); 2195 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP roperties::PointerType::Mouse);
2185 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0, fakeMouseMove); 2196 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode() , 0, fakeMouseMove);
2197 }
2186 2198
2187 // Do a new hit-test in case the mousemove event changed the DOM. 2199 // Do a new hit-test in case the mousemove event changed the DOM.
2188 // Note that if the original hit test wasn't over an element (eg. was over a scrollbar) we 2200 // Note that if the original hit test wasn't over an element (eg. was over a scrollbar) we
2189 // don't want to re-hit-test because it may be in the wrong frame (and there 's no way the page 2201 // don't want to re-hit-test because it may be in the wrong frame (and there 's no way the page
2190 // could have seen the event anyway). 2202 // could have seen the event anyway).
2191 // Also note that the position of the frame may have changed, so we need to recompute the content 2203 // Also note that the position of the frame may have changed, so we need to recompute the content
2192 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul d). 2204 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul d).
2193 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 2205 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
2194 if (currentHitTest.innerNode()) { 2206 if (currentHitTest.innerNode()) {
2195 LocalFrame* mainFrame = m_frame->localFrameRoot(); 2207 LocalFrame* mainFrame = m_frame->localFrameRoot();
2196 if (mainFrame && mainFrame->view()) 2208 if (mainFrame && mainFrame->view())
2197 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); 2209 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling();
2198 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 2210 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
2199 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2211 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2200 } 2212 }
2201 m_clickNode = currentHitTest.innerNode(); 2213 m_clickNode = currentHitTest.innerNode();
2202 2214
2203 // Capture data for showUnhandledTapUIIfNeeded. 2215 // Capture data for showUnhandledTapUIIfNeeded.
2204 Node* tappedNode = m_clickNode; 2216 Node* tappedNode = m_clickNode;
2205 IntPoint tappedPosition = gestureEvent.position(); 2217 IntPoint tappedPosition = gestureEvent.position();
2206 2218
2207 if (m_clickNode && m_clickNode->isTextNode()) 2219 if (m_clickNode && m_clickNode->isTextNode())
2208 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); 2220 m_clickNode = FlatTreeTraversal::parent(*m_clickNode);
2209 2221
2210 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(), 2222 WebInputEventResult mouseDownEventResult = WebInputEventResult::NotHandled;
2211 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), 2223 if (!m_suppressMouseEventsFromGestures) {
2212 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown), 2224 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.g lobalPosition(),
2213 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp erties::PointerType::Mouse); 2225 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
2214 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames ::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown) ; 2226 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2215 selectionController().initializeSelectionState(); 2227 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP roperties::PointerType::Mouse);
2216 if (mouseDownEventResult == WebInputEventResult::NotHandled) 2228 mouseDownEventResult = dispatchMouseEvent(EventTypeNames::mousedown, cur rentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown);
2217 mouseDownEventResult = handleMouseFocus(MouseEventWithHitTestResults(fak eMouseDown, currentHitTest), InputDeviceCapabilities::firesTouchEventsSourceCapa bilities()); 2229 selectionController().initializeSelectionState();
2218 if (mouseDownEventResult == WebInputEventResult::NotHandled) 2230 if (mouseDownEventResult == WebInputEventResult::NotHandled)
2219 mouseDownEventResult = handleMousePressEvent(MouseEventWithHitTestResult s(fakeMouseDown, currentHitTest)); 2231 mouseDownEventResult = handleMouseFocus(MouseEventWithHitTestResults (fakeMouseDown, currentHitTest), InputDeviceCapabilities::firesTouchEventsSource Capabilities());
2232 if (mouseDownEventResult == WebInputEventResult::NotHandled)
2233 mouseDownEventResult = handleMousePressEvent(MouseEventWithHitTestRe sults(fakeMouseDown, currentHitTest));
Rick Byers 2016/05/27 20:39:27 In addition to suppressing the generation of mouse
mustaq 2016/06/02 19:26:26 A milder approach seems to make more sense to me n
Rick Byers 2016/06/03 15:31:39 I think it's important that cancelling pointerdown
2234 }
2220 2235
2221 if (currentHitTest.innerNode()) { 2236 if (currentHitTest.innerNode()) {
2222 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap); 2237 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap);
2223 HitTestResult result = currentHitTest; 2238 HitTestResult result = currentHitTest;
2224 result.setToShadowHostIfInUserAgentShadowRoot(); 2239 result.setToShadowHostIfInUserAgentShadowRoot();
2225 m_frame->chromeClient().onMouseDown(result.innerNode()); 2240 m_frame->chromeClient().onMouseDown(result.innerNode());
2226 } 2241 }
2227 2242
2228 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 2243 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
2229 if (currentHitTest.innerNode()) { 2244 if (currentHitTest.innerNode()) {
2230 LocalFrame* mainFrame = m_frame->localFrameRoot(); 2245 LocalFrame* mainFrame = m_frame->localFrameRoot();
2231 if (mainFrame && mainFrame->view()) 2246 if (mainFrame && mainFrame->view())
2232 mainFrame->view()->updateAllLifecyclePhases(); 2247 mainFrame->view()->updateAllLifecyclePhases();
2233 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 2248 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
2234 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2249 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2235 } 2250 }
2251
2252 WebInputEventResult mouseUpEventResult = WebInputEventResult::NotHandled;
2236 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(), 2253 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(),
2237 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), 2254 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(),
2238 static_cast<PlatformEvent::Modifiers>(modifiers), 2255 static_cast<PlatformEvent::Modifiers>(modifiers),
2239 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp erties::PointerType::Mouse); 2256 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse);
2240 WebInputEventResult mouseUpEventResult = dispatchMouseEvent(EventTypeNames:: mouseup, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp); 2257 if (!m_suppressMouseEventsFromGestures) {
2258 mouseUpEventResult = dispatchMouseEvent(EventTypeNames::mouseup, current HitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp);
2259 }
2241 2260
2242 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; 2261 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
2243 if (m_clickNode) { 2262 if (m_clickNode) {
2244 if (currentHitTest.innerNode()) { 2263 if (currentHitTest.innerNode()) {
2245 // Updates distribution because a mouseup (or mousedown) event liste ner can make the 2264 // Updates distribution because a mouseup (or mousedown) event liste ner can make the
2246 // tree dirty at dispatchMouseEvent() invocation above. 2265 // tree dirty at dispatchMouseEvent() invocation above.
2247 // Unless distribution is updated, commonAncestor would hit ASSERT. 2266 // Unless distribution is updated, commonAncestor would hit ASSERT.
2248 // Both m_clickNode and currentHitTest.innerNode()) don't need to be updated 2267 // Both m_clickNode and currentHitTest.innerNode()) don't need to be updated
2249 // because commonAncestor() will exit early if their documents are d ifferent. 2268 // because commonAncestor() will exit early if their documents are d ifferent.
2250 m_clickNode->updateDistribution(); 2269 m_clickNode->updateDistribution();
2251 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(* m_clickNode, parentForClickEvent); 2270 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(* m_clickNode, parentForClickEvent);
2252 clickEventResult = dispatchMouseEvent(EventTypeNames::click, clickTa rgetNode, gestureEvent.tapCount(), fakeMouseUp); 2271 clickEventResult = dispatchMouseEvent(EventTypeNames::click, clickTa rgetNode, gestureEvent.tapCount(), fakeMouseUp);
2253 } 2272 }
2254 m_clickNode = nullptr; 2273 m_clickNode = nullptr;
2255 } 2274 }
2256 2275
2257 if (mouseUpEventResult == WebInputEventResult::NotHandled) 2276 if (!m_suppressMouseEventsFromGestures && mouseUpEventResult == WebInputEven tResult::NotHandled)
2258 mouseUpEventResult = handleMouseReleaseEvent(MouseEventWithHitTestResult s(fakeMouseUp, currentHitTest)); 2277 mouseUpEventResult = handleMouseReleaseEvent(MouseEventWithHitTestResult s(fakeMouseUp, currentHitTest));
2259 2278
2260 WebInputEventResult eventResult = mergeEventResult(mergeEventResult(mouseDow nEventResult, mouseUpEventResult), clickEventResult); 2279 WebInputEventResult eventResult = mergeEventResult(mergeEventResult(mouseDow nEventResult, mouseUpEventResult), clickEventResult);
2261 if (eventResult == WebInputEventResult::NotHandled && tappedNode && m_frame- >page()) { 2280 if (eventResult == WebInputEventResult::NotHandled && tappedNode && m_frame- >page()) {
2262 bool domTreeChanged = preDispatchDomTreeVersion != m_frame->document()-> domTreeVersion(); 2281 bool domTreeChanged = preDispatchDomTreeVersion != m_frame->document()-> domTreeVersion();
2263 bool styleChanged = preDispatchStyleVersion != m_frame->document()->styl eVersion(); 2282 bool styleChanged = preDispatchStyleVersion != m_frame->document()->styl eVersion();
2264 2283
2265 IntPoint tappedPositionInViewport = frameHost()->visualViewport().rootFr ameToViewport(tappedPosition); 2284 IntPoint tappedPositionInViewport = frameHost()->visualViewport().rootFr ameToViewport(tappedPosition);
2266 m_frame->chromeClient().showUnhandledTapUIIfNeeded(tappedPositionInViewp ort, tappedNode, domTreeChanged || styleChanged); 2285 m_frame->chromeClient().showUnhandledTapUIIfNeeded(tappedPositionInViewp ort, tappedNode, domTreeChanged || styleChanged);
2267 } 2286 }
2268 return eventResult; 2287 return eventResult;
2269 } 2288 }
2270 2289
2271 WebInputEventResult EventHandler::handleGestureLongPress(const GestureEventWithH itTestResults& targetedEvent) 2290 WebInputEventResult EventHandler::handleGestureLongPress(const GestureEventWithH itTestResults& targetedEvent)
2272 { 2291 {
2273 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 2292 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
2274 IntPoint adjustedPoint = gestureEvent.position(); 2293 IntPoint adjustedPoint = gestureEvent.position();
2275 2294
2276 unsigned modifiers = gestureEvent.getModifiers(); 2295 unsigned modifiers = gestureEvent.getModifiers();
2277 2296
2278 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the 2297 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the
2279 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code 2298 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code
2280 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice. 2299 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice.
2281 2300
2282 m_longTapShouldInvokeContextMenu = false; 2301 m_longTapShouldInvokeContextMenu = false;
2283 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) { 2302 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) {
2303 // TODO(mustaq): Suppressing long-tap MouseEvents could break
2304 // drag-drop. Will do separately because of the risk. crbug.com/606938.
2284 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1, 2305 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1,
2285 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown), 2306 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2286 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse); 2307 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse);
2287 m_mouseDown = mouseDownEvent; 2308 m_mouseDown = mouseDownEvent;
2288 2309
2289 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1, 2310 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1,
2290 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown), 2311 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2291 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse); 2312 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse);
2292 HitTestRequest request(HitTestRequest::ReadOnly); 2313 HitTestRequest request(HitTestRequest::ReadOnly);
2293 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); 2314 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent);
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 if (!rect.contains(roundedIntPoint(point))) 3652 if (!rect.contains(roundedIntPoint(point)))
3632 return result; 3653 return result;
3633 } 3654 }
3634 frame->contentLayoutItem().hitTest(result); 3655 frame->contentLayoutItem().hitTest(result);
3635 return result; 3656 return result;
3636 } 3657 }
3637 3658
3638 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt) 3659 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt)
3639 { 3660 {
3640 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); 3661 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent");
3641
3642 return m_pointerEventManager.handleTouchEvents(event); 3662 return m_pointerEventManager.handleTouchEvents(event);
3643 } 3663 }
3644 3664
3645 void EventHandler::userGestureUtilized() 3665 void EventHandler::userGestureUtilized()
3646 { 3666 {
3647 // This is invoked for UserGestureIndicators created in TouchEventManger::ha ndleTouchEvent which perhaps 3667 // This is invoked for UserGestureIndicators created in TouchEventManger::ha ndleTouchEvent which perhaps
3648 // represent touch actions which shouldn't be considered a user-gesture. 3668 // represent touch actions which shouldn't be considered a user-gesture.
3649 UseCounter::count(m_frame, UseCounter::TouchDragUserGestureUsed); 3669 UseCounter::count(m_frame, UseCounter::TouchDragUserGestureUsed);
3650 } 3670 }
3651 3671
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3707 3727
3708 FrameHost* EventHandler::frameHost() const 3728 FrameHost* EventHandler::frameHost() const
3709 { 3729 {
3710 if (!m_frame->page()) 3730 if (!m_frame->page())
3711 return nullptr; 3731 return nullptr;
3712 3732
3713 return &m_frame->page()->frameHost(); 3733 return &m_frame->page()->frameHost();
3714 } 3734 }
3715 3735
3716 } // namespace blink 3736 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698