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

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

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)
Patch Set: Callback cleanup, comments Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 const PlatformMouseEvent& mouseEvent) { 565 const PlatformMouseEvent& mouseEvent) {
566 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); 566 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent");
567 567
568 // For 4th/5th button in the mouse since Chrome does not yet send 568 // For 4th/5th button in the mouse since Chrome does not yet send
569 // button value to Blink but in some cases it does send the event. 569 // button value to Blink but in some cases it does send the event.
570 // This check is needed to suppress such an event (crbug.com/574959) 570 // This check is needed to suppress such an event (crbug.com/574959)
571 if (mouseEvent.pointerProperties().button == 571 if (mouseEvent.pointerProperties().button ==
572 WebPointerProperties::Button::NoButton) 572 WebPointerProperties::Button::NoButton)
573 return WebInputEventResult::HandledSuppressed; 573 return WebInputEventResult::HandledSuppressed;
574 574
575 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 575 UserGestureIndicator gestureIndicator(UserGestureToken::create());
576 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = 576 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken =
577 UserGestureIndicator::currentToken(); 577 UserGestureIndicator::currentToken();
578 578
579 if (m_eventHandlerWillResetCapturingMouseEventsNode) 579 if (m_eventHandlerWillResetCapturingMouseEventsNode)
580 m_capturingMouseEventsNode = nullptr; 580 m_capturingMouseEventsNode = nullptr;
581 m_mouseEventManager->handleMousePressEventUpdateStates(mouseEvent); 581 m_mouseEventManager->handleMousePressEventUpdateStates(mouseEvent);
582 selectionController().setMouseDownMayStartSelect(false); 582 selectionController().setMouseDownMayStartSelect(false);
583 if (!m_frame->view()) 583 if (!m_frame->view())
584 return WebInputEventResult::NotHandled; 584 return WebInputEventResult::NotHandled;
585 585
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 // This check is needed to suppress such an event (crbug.com/574959) 892 // This check is needed to suppress such an event (crbug.com/574959)
893 if (mouseEvent.pointerProperties().button == 893 if (mouseEvent.pointerProperties().button ==
894 WebPointerProperties::Button::NoButton) 894 WebPointerProperties::Button::NoButton)
895 return WebInputEventResult::HandledSuppressed; 895 return WebInputEventResult::HandledSuppressed;
896 896
897 if (!mouseEvent.fromTouch()) 897 if (!mouseEvent.fromTouch())
898 m_frame->selection().setCaretBlinkingSuspended(false); 898 m_frame->selection().setCaretBlinkingSuspended(false);
899 899
900 std::unique_ptr<UserGestureIndicator> gestureIndicator; 900 std::unique_ptr<UserGestureIndicator> gestureIndicator;
901 901
902 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken) 902 if (m_frame->localFrameRoot()
903 ->eventHandler()
904 .m_lastMouseDownUserGestureToken) {
903 gestureIndicator = wrapUnique(new UserGestureIndicator( 905 gestureIndicator = wrapUnique(new UserGestureIndicator(
904 m_frame->localFrameRoot() 906 m_frame->localFrameRoot()
905 ->eventHandler() 907 ->eventHandler()
906 .m_lastMouseDownUserGestureToken.release())); 908 .m_lastMouseDownUserGestureToken.release()));
907 else 909 } else {
908 gestureIndicator = 910 gestureIndicator =
909 wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture)); 911 wrapUnique(new UserGestureIndicator(UserGestureToken::create()));
912 }
910 913
911 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { 914 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) {
912 if (Page* page = m_frame->page()) 915 if (Page* page = m_frame->page())
913 page->autoscrollController().handleMouseReleaseForMiddleClickAutoscroll( 916 page->autoscrollController().handleMouseReleaseForMiddleClickAutoscroll(
914 m_frame, mouseEvent); 917 m_frame, mouseEvent);
915 } 918 }
916 919
917 m_mouseEventManager->setMousePressed(false); 920 m_mouseEventManager->setMousePressed(false);
918 m_mouseEventManager->setLastKnownMousePosition(mouseEvent); 921 m_mouseEventManager->setLastKnownMousePosition(mouseEvent);
919 m_mouseEventManager->handleSvgPanIfNeeded(true); 922 m_mouseEventManager->handleSvgPanIfNeeded(true);
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 } 2050 }
2048 2051
2049 FrameHost* EventHandler::frameHost() const { 2052 FrameHost* EventHandler::frameHost() const {
2050 if (!m_frame->page()) 2053 if (!m_frame->page())
2051 return nullptr; 2054 return nullptr;
2052 2055
2053 return &m_frame->page()->frameHost(); 2056 return &m_frame->page()->frameHost();
2054 } 2057 }
2055 2058
2056 } // namespace blink 2059 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp ('k') | third_party/WebKit/Source/core/input/GestureManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698