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

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

Issue 1176423008: Forward mouse down node information to WebWidgetClient (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: call onMouseDown for GestureTap righter after MousePress is dispatched Created 5 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
« no previous file with comments | « no previous file | Source/core/page/ChromeClient.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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Ac tive); 991 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Ac tive);
992 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); 992 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
993 } 993 }
994 994
995 if (passMousePressEventToScrollbar(mev)) 995 if (passMousePressEventToScrollbar(mev))
996 swallowEvent = true; 996 swallowEvent = true;
997 else 997 else
998 swallowEvent = handleMousePressEvent(mev); 998 swallowEvent = handleMousePressEvent(mev);
999 } 999 }
1000 1000
1001 if (mev.hitTestResult().innerNode() && mouseEvent.button() == LeftButton) {
1002 ASSERT(mouseEvent.type() == PlatformEvent::MousePressed);
1003 HitTestResult result = mev.hitTestResult();
1004 result.setToShadowHostIfInUserAgentShadowRoot();
1005 m_frame->chromeClient().onMouseDown(result.innerNode());
1006 }
1007
1001 return swallowEvent; 1008 return swallowEvent;
1002 } 1009 }
1003 1010
1004 static DeprecatedPaintLayer* layerForNode(Node* node) 1011 static DeprecatedPaintLayer* layerForNode(Node* node)
1005 { 1012 {
1006 if (!node) 1013 if (!node)
1007 return nullptr; 1014 return nullptr;
1008 1015
1009 LayoutObject* layoutObject = node->layoutObject(); 1016 LayoutObject* layoutObject = node->layoutObject();
1010 if (!layoutObject) 1017 if (!layoutObject)
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(), 2034 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(),
2028 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), 2035 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
2029 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown), 2036 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown),
2030 PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); 2037 PlatformMouseEvent::FromTouch, gestureEvent.timestamp());
2031 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); 2038 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true);
2032 if (!swallowMouseDownEvent) 2039 if (!swallowMouseDownEvent)
2033 swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fa keMouseDown, currentHitTest)); 2040 swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fa keMouseDown, currentHitTest));
2034 if (!swallowMouseDownEvent) 2041 if (!swallowMouseDownEvent)
2035 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul ts(fakeMouseDown, currentHitTest)); 2042 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul ts(fakeMouseDown, currentHitTest));
2036 2043
2044 if (currentHitTest.innerNode()) {
2045 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap);
2046 HitTestResult result = currentHitTest;
2047 result.setToShadowHostIfInUserAgentShadowRoot();
2048 m_frame->chromeClient().onMouseDown(result.innerNode());
2049 }
2050
2037 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 2051 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
2038 if (currentHitTest.innerNode()) { 2052 if (currentHitTest.innerNode()) {
2039 LocalFrame* mainFrame = m_frame->localFrameRoot(); 2053 LocalFrame* mainFrame = m_frame->localFrameRoot();
2040 if (mainFrame && mainFrame->view()) 2054 if (mainFrame && mainFrame->view())
2041 mainFrame->view()->updateLayoutAndStyleForPainting(); 2055 mainFrame->view()->updateLayoutAndStyleForPainting();
2042 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 2056 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
2043 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2057 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2044 } 2058 }
2045 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(), 2059 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(),
2046 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(), 2060 LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(),
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after
3761 unsigned EventHandler::accessKeyModifiers() 3775 unsigned EventHandler::accessKeyModifiers()
3762 { 3776 {
3763 #if OS(MACOSX) 3777 #if OS(MACOSX)
3764 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3778 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3765 #else 3779 #else
3766 return PlatformEvent::AltKey; 3780 return PlatformEvent::AltKey;
3767 #endif 3781 #endif
3768 } 3782 }
3769 3783
3770 } // namespace blink 3784 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698