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

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

Issue 641063003: Pass correct client coordinates for mouse events synthesized from a GestureTap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 2 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 | « LayoutTests/fast/events/touch/gesture/resources/event-delegator.html ('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 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 if (gestureEvent.shiftKey()) 2232 if (gestureEvent.shiftKey())
2233 modifierFlags |= PlatformEvent::ShiftKey; 2233 modifierFlags |= PlatformEvent::ShiftKey;
2234 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m odifierFlags); 2234 PlatformEvent::Modifiers modifiers = static_cast<PlatformEvent::Modifiers>(m odifierFlags);
2235 2235
2236 HitTestResult currentHitTest = targetedEvent.hitTestResult(); 2236 HitTestResult currentHitTest = targetedEvent.hitTestResult();
2237 2237
2238 // We use the adjusted position so the application isn't surprised to see a event with 2238 // We use the adjusted position so the application isn't surprised to see a event with
2239 // co-ordinates outside the target's bounds. 2239 // co-ordinates outside the target's bounds.
2240 IntPoint adjustedPoint = m_frame->view()->windowToContents(gestureEvent.posi tion()); 2240 IntPoint adjustedPoint = m_frame->view()->windowToContents(gestureEvent.posi tion());
2241 2241
2242 PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition( ), 2242 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa lPosition(),
2243 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, 2243 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,
2244 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2244 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2245 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0, fakeMouseMove, true); 2245 dispatchMouseEvent(EventTypeNames::mousemove, currentHitTest.innerNode(), 0, fakeMouseMove, true);
2246 2246
2247 // Do a new hit-test in case the mousemove event changed the DOM. 2247 // Do a new hit-test in case the mousemove event changed the DOM.
2248 // Note that if the original hit test wasn't over an element (eg. was over a scrollbar) we 2248 // Note that if the original hit test wasn't over an element (eg. was over a scrollbar) we
2249 // don't want to re-hit-test because it may be in the wrong frame (and there 's no way the page 2249 // don't want to re-hit-test because it may be in the wrong frame (and there 's no way the page
2250 // could have seen the event anyway). 2250 // could have seen the event anyway).
2251 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 2251 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
2252 if (currentHitTest.innerNode()) 2252 if (currentHitTest.innerNode())
2253 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2253 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2254 m_clickNode = currentHitTest.innerNode(); 2254 m_clickNode = currentHitTest.innerNode();
2255 if (m_clickNode && m_clickNode->isTextNode()) 2255 if (m_clickNode && m_clickNode->isTextNode())
2256 m_clickNode = NodeRenderingTraversal::parent(m_clickNode.get()); 2256 m_clickNode = NodeRenderingTraversal::parent(m_clickNode.get());
2257 2257
2258 PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition( ), 2258 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(),
2259 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), 2259 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
2260 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2260 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2261 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); 2261 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true);
2262 if (!swallowMouseDownEvent) 2262 if (!swallowMouseDownEvent)
2263 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown); 2263 swallowMouseDownEvent = handleMouseFocus(fakeMouseDown);
2264 if (!swallowMouseDownEvent) 2264 if (!swallowMouseDownEvent)
2265 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul ts(fakeMouseDown, currentHitTest)); 2265 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul ts(fakeMouseDown, currentHitTest));
2266 2266
2267 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 2267 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
2268 if (currentHitTest.innerNode()) 2268 if (currentHitTest.innerNode())
2269 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2269 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2270 PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), 2270 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(),
2271 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), 2271 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(),
2272 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2272 modifiers, PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2273 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false); 2273 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, curr entHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp, false);
2274 2274
2275 bool swallowClickEvent = false; 2275 bool swallowClickEvent = false;
2276 if (m_clickNode) { 2276 if (m_clickNode) {
2277 if (currentHitTest.innerNode()) { 2277 if (currentHitTest.innerNode()) {
2278 // Updates distribution because a mouseup (or mousedown) event liste ner can make the 2278 // Updates distribution because a mouseup (or mousedown) event liste ner can make the
2279 // tree dirty at dispatchMouseEvent() invocation above. 2279 // tree dirty at dispatchMouseEvent() invocation above.
2280 // Unless distribution is updated, commonAncestor would hit ASSERT. 2280 // Unless distribution is updated, commonAncestor would hit ASSERT.
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
3888 unsigned EventHandler::accessKeyModifiers() 3888 unsigned EventHandler::accessKeyModifiers()
3889 { 3889 {
3890 #if OS(MACOSX) 3890 #if OS(MACOSX)
3891 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3891 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3892 #else 3892 #else
3893 return PlatformEvent::AltKey; 3893 return PlatformEvent::AltKey;
3894 #endif 3894 #endif
3895 } 3895 }
3896 3896
3897 } // namespace blink 3897 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/touch/gesture/resources/event-delegator.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698