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

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

Issue 267313008: First-cut at fixing unhandled Tap event returns in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « Source/core/page/EventHandler.h ('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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 , m_widgetIsLatched(false) 223 , m_widgetIsLatched(false)
224 , m_touchPressed(false) 224 , m_touchPressed(false)
225 , m_scrollGestureHandlingNode(nullptr) 225 , m_scrollGestureHandlingNode(nullptr)
226 , m_lastHitTestResultOverWidget(false) 226 , m_lastHitTestResultOverWidget(false)
227 , m_maxMouseMovedDuration(0) 227 , m_maxMouseMovedDuration(0)
228 , m_baseEventType(PlatformEvent::NoType) 228 , m_baseEventType(PlatformEvent::NoType)
229 , m_didStartDrag(false) 229 , m_didStartDrag(false)
230 , m_longTapShouldInvokeContextMenu(false) 230 , m_longTapShouldInvokeContextMenu(false)
231 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) 231 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired)
232 , m_lastShowPressTimestamp(0) 232 , m_lastShowPressTimestamp(0)
233 , m_fixTapGestureReturnValue(false)
233 { 234 {
234 } 235 }
235 236
236 EventHandler::~EventHandler() 237 EventHandler::~EventHandler()
237 { 238 {
238 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); 239 ASSERT(!m_fakeMouseMoveEventTimer.isActive());
239 } 240 }
240 241
241 DragState& EventHandler::dragState() 242 DragState& EventHandler::dragState()
242 { 243 {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 bool swallowEvent = false; 608 bool swallowEvent = false;
608 m_mousePressed = true; 609 m_mousePressed = true;
609 m_selectionInitiationState = HaveNotStartedSelection; 610 m_selectionInitiationState = HaveNotStartedSelection;
610 611
611 if (event.event().clickCount() == 2) 612 if (event.event().clickCount() == 2)
612 swallowEvent = handleMousePressEventDoubleClick(event); 613 swallowEvent = handleMousePressEventDoubleClick(event);
613 else if (event.event().clickCount() >= 3) 614 else if (event.event().clickCount() >= 3)
614 swallowEvent = handleMousePressEventTripleClick(event); 615 swallowEvent = handleMousePressEventTripleClick(event);
615 else 616 else
616 swallowEvent = handleMousePressEventSingleClick(event); 617 swallowEvent = handleMousePressEventSingleClick(event);
618 if (m_fixTapGestureReturnValue)
619 swallowEvent = false;
Rick Byers 2014/05/16 11:10:43 This seems wrong. A click from touch is as legiti
Donn Denman 2014/05/27 05:58:14 Done.
617 620
618 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect 621 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect
619 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled()); 622 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled());
620 623
621 return swallowEvent; 624 return swallowEvent;
622 } 625 }
623 626
624 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e vent) 627 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e vent)
625 { 628 {
626 TRACE_EVENT0("webkit", "EventHandler::handleMouseDraggedEvent"); 629 TRACE_EVENT0("webkit", "EventHandler::handleMouseDraggedEvent");
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 if (gestureEvent.shiftKey()) 2225 if (gestureEvent.shiftKey())
2223 modifierFlags |= PlatformEvent::ShiftKey; 2226 modifierFlags |= PlatformEvent::ShiftKey;
2224 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m odifierFlags); 2227 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m odifierFlags);
2225 2228
2226 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition( ), 2229 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition( ),
2227 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, 2230 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,
2228 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2231 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2229 handleMouseMoveEvent(fakeMouseMove); 2232 handleMouseMoveEvent(fakeMouseMove);
2230 2233
2231 bool defaultPrevented = false; 2234 bool defaultPrevented = false;
2235 m_fixTapGestureReturnValue = true;
2232 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition( ), 2236 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition( ),
2233 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), 2237 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
2234 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2238 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2235 defaultPrevented |= handleMousePressEvent(fakeMouseDown); 2239 defaultPrevented |= handleMousePressEvent(fakeMouseDown);
2236 2240
2237 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), 2241 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(),
2238 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), 2242 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(),
2239 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2243 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2240 defaultPrevented |= handleMouseReleaseEvent(fakeMouseUp); 2244 defaultPrevented |= handleMouseReleaseEvent(fakeMouseUp);
2245 // TODO(donnd): do we need to worry about exceptions being thrown above?
2246 m_fixTapGestureReturnValue = false;
2241 2247
2242 return defaultPrevented; 2248 return defaultPrevented;
2243 } 2249 }
2244 2250
2245 bool EventHandler::handleGestureLongPress(const PlatformGestureEvent& gestureEve nt, const IntPoint& adjustedPoint) 2251 bool EventHandler::handleGestureLongPress(const PlatformGestureEvent& gestureEve nt, const IntPoint& adjustedPoint)
2246 { 2252 {
2247 m_longTapShouldInvokeContextMenu = false; 2253 m_longTapShouldInvokeContextMenu = false;
2248 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) { 2254 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) {
2249 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1, 2255 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1,
2250 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), WTF::currentTime()); 2256 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), WTF::currentTime());
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
3733 unsigned EventHandler::accessKeyModifiers() 3739 unsigned EventHandler::accessKeyModifiers()
3734 { 3740 {
3735 #if OS(MACOSX) 3741 #if OS(MACOSX)
3736 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3742 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3737 #else 3743 #else
3738 return PlatformEvent::AltKey; 3744 return PlatformEvent::AltKey;
3739 #endif 3745 #endif
3740 } 3746 }
3741 3747
3742 } // namespace WebCore 3748 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698