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

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

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)
Patch Set: Fix tests 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // This check is needed to suppress such an event (crbug.com/574959) 895 // This check is needed to suppress such an event (crbug.com/574959)
896 if (mouseEvent.pointerProperties().button == 896 if (mouseEvent.pointerProperties().button ==
897 WebPointerProperties::Button::NoButton) 897 WebPointerProperties::Button::NoButton)
898 return WebInputEventResult::HandledSuppressed; 898 return WebInputEventResult::HandledSuppressed;
899 899
900 if (!mouseEvent.fromTouch()) 900 if (!mouseEvent.fromTouch())
901 m_frame->selection().setCaretBlinkingSuspended(false); 901 m_frame->selection().setCaretBlinkingSuspended(false);
902 902
903 std::unique_ptr<UserGestureIndicator> gestureIndicator; 903 std::unique_ptr<UserGestureIndicator> gestureIndicator;
904 904
905 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken) 905 if (m_frame->localFrameRoot()
906 ->eventHandler()
907 .m_lastMouseDownUserGestureToken) {
906 gestureIndicator = wrapUnique(new UserGestureIndicator( 908 gestureIndicator = wrapUnique(new UserGestureIndicator(
907 m_frame->localFrameRoot() 909 m_frame->localFrameRoot()
908 ->eventHandler() 910 ->eventHandler()
909 .m_lastMouseDownUserGestureToken.release())); 911 .m_lastMouseDownUserGestureToken.release()));
910 else 912 } else {
911 gestureIndicator = 913 gestureIndicator =
912 wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture)); 914 wrapUnique(new UserGestureIndicator(UserGestureToken::create()));
915 }
913 916
914 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { 917 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) {
915 if (Page* page = m_frame->page()) 918 if (Page* page = m_frame->page())
916 page->autoscrollController().handleMouseReleaseForMiddleClickAutoscroll( 919 page->autoscrollController().handleMouseReleaseForMiddleClickAutoscroll(
917 m_frame, mouseEvent); 920 m_frame, mouseEvent);
918 } 921 }
919 922
920 m_mouseEventManager->setMousePressed(false); 923 m_mouseEventManager->setMousePressed(false);
921 m_mouseEventManager->setLastKnownMousePosition(mouseEvent); 924 m_mouseEventManager->setLastKnownMousePosition(mouseEvent);
922 m_mouseEventManager->handleSvgPanIfNeeded(true); 925 m_mouseEventManager->handleSvgPanIfNeeded(true);
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 } 2054 }
2052 2055
2053 FrameHost* EventHandler::frameHost() const { 2056 FrameHost* EventHandler::frameHost() const {
2054 if (!m_frame->page()) 2057 if (!m_frame->page())
2055 return nullptr; 2058 return nullptr;
2056 2059
2057 return &m_frame->page()->frameHost(); 2060 return &m_frame->page()->frameHost();
2058 } 2061 }
2059 2062
2060 } // namespace blink 2063 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698