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

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

Issue 248083003: Mouse event handlers use user gesture tokens on top-level LocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments addressed Created 6 years, 8 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/frame/LocalFrame.cpp ('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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 return view ? view->windowToContents(windowPoint) : windowPoint; 1192 return view ? view->windowToContents(windowPoint) : windowPoint;
1193 } 1193 }
1194 1194
1195 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) 1195 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
1196 { 1196 {
1197 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEvent"); 1197 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEvent");
1198 1198
1199 RefPtr<FrameView> protector(m_frame->view()); 1199 RefPtr<FrameView> protector(m_frame->view());
1200 1200
1201 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 1201 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
1202 m_frame->tree().top()->eventHandler().m_lastMouseDownUserGestureToken = gest ureIndicator.currentToken(); 1202 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = gestureIndicator.currentToken();
1203 1203
1204 cancelFakeMouseMoveEvent(); 1204 cancelFakeMouseMoveEvent();
1205 if (m_eventHandlerWillResetCapturingMouseEventsNode) 1205 if (m_eventHandlerWillResetCapturingMouseEventsNode)
1206 m_capturingMouseEventsNode = nullptr; 1206 m_capturingMouseEventsNode = nullptr;
1207 m_mousePressed = true; 1207 m_mousePressed = true;
1208 m_capturesDragging = true; 1208 m_capturesDragging = true;
1209 setLastKnownMousePosition(mouseEvent); 1209 setLastKnownMousePosition(mouseEvent);
1210 m_mouseDownTimestamp = mouseEvent.timestamp(); 1210 m_mouseDownTimestamp = mouseEvent.timestamp();
1211 m_mouseDownMayStartDrag = false; 1211 m_mouseDownMayStartDrag = false;
1212 m_mouseDownMayStartSelect = false; 1212 m_mouseDownMayStartSelect = false;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) 1508 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
1509 { 1509 {
1510 TRACE_EVENT0("webkit", "EventHandler::handleMouseReleaseEvent"); 1510 TRACE_EVENT0("webkit", "EventHandler::handleMouseReleaseEvent");
1511 1511
1512 RefPtr<FrameView> protector(m_frame->view()); 1512 RefPtr<FrameView> protector(m_frame->view());
1513 1513
1514 m_frame->selection().setCaretBlinkingSuspended(false); 1514 m_frame->selection().setCaretBlinkingSuspended(false);
1515 1515
1516 OwnPtr<UserGestureIndicator> gestureIndicator; 1516 OwnPtr<UserGestureIndicator> gestureIndicator;
1517 1517
1518 if (m_frame->tree().top()->eventHandler().m_lastMouseDownUserGestureToken) 1518 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n)
1519 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->tree().top ()->eventHandler().m_lastMouseDownUserGestureToken.release())); 1519 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->tree().top ()->eventHandler().m_lastMouseDownUserGestureToken.release()));
1520 else 1520 else
1521 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gUserGesture)); 1521 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gUserGesture));
1522 1522
1523 #if OS(WIN) 1523 #if OS(WIN)
1524 if (Page* page = m_frame->page()) 1524 if (Page* page = m_frame->page())
1525 page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame, mouseEvent); 1525 page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame, mouseEvent);
1526 #endif 1526 #endif
1527 1527
1528 m_mousePressed = false; 1528 m_mousePressed = false;
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 unsigned EventHandler::accessKeyModifiers() 3787 unsigned EventHandler::accessKeyModifiers()
3788 { 3788 {
3789 #if OS(MACOSX) 3789 #if OS(MACOSX)
3790 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3790 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3791 #else 3791 #else
3792 return PlatformEvent::AltKey; 3792 return PlatformEvent::AltKey;
3793 #endif 3793 #endif
3794 } 3794 }
3795 3795
3796 } // namespace WebCore 3796 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698