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

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

Issue 2289213002: Implement Middle Click Autoscroll on all platforms not just Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update a test Created 4 years, 3 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 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 429
430 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event) 430 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event)
431 { 431 {
432 AutoscrollController* controller = m_scrollManager.autoscrollController(); 432 AutoscrollController* controller = m_scrollManager.autoscrollController();
433 if (controller && controller->autoscrollInProgress()) 433 if (controller && controller->autoscrollInProgress())
434 m_scrollManager.stopAutoscroll(); 434 m_scrollManager.stopAutoscroll();
435 435
436 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled; 436 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled;
437 } 437 }
438 438
439 #if OS(WIN)
440
441 void EventHandler::startPanScrolling(LayoutObject* layoutObject) 439 void EventHandler::startPanScrolling(LayoutObject* layoutObject)
442 { 440 {
443 if (!layoutObject->isBox()) 441 if (!layoutObject->isBox())
444 return; 442 return;
445 AutoscrollController* controller = m_scrollManager.autoscrollController(); 443 AutoscrollController* controller = m_scrollManager.autoscrollController();
446 if (!controller) 444 if (!controller)
447 return; 445 return;
448 controller->startPanScrolling(toLayoutBox(layoutObject), lastKnownMousePosit ion()); 446 controller->startPanScrolling(toLayoutBox(layoutObject), lastKnownMousePosit ion());
449 invalidateClick(); 447 invalidateClick();
450 } 448 }
451 449
452 #endif // OS(WIN)
453
454 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe stRequest::HitTestRequestType hitType, const LayoutSize& padding) 450 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe stRequest::HitTestRequestType hitType, const LayoutSize& padding)
455 { 451 {
456 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint"); 452 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint");
457 453
458 ASSERT((hitType & HitTestRequest::ListBased) || padding.isEmpty()); 454 ASSERT((hitType & HitTestRequest::ListBased) || padding.isEmpty());
459 455
460 // We always send hitTestResultAtPoint to the main frame if we have one, 456 // We always send hitTestResultAtPoint to the main frame if we have one,
461 // otherwise we might hit areas that are obscured by higher frames. 457 // otherwise we might hit areas that are obscured by higher frames.
462 if (m_frame->page()) { 458 if (m_frame->page()) {
463 LocalFrame* mainFrame = m_frame->localFrameRoot(); 459 LocalFrame* mainFrame = m_frame->localFrameRoot();
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // has been handled. See crbug.com/269917 820 // has been handled. See crbug.com/269917
825 m_capturesDragging = subframe->eventHandler().capturesDragging(); 821 m_capturesDragging = subframe->eventHandler().capturesDragging();
826 if (m_mousePressed && m_capturesDragging) { 822 if (m_mousePressed && m_capturesDragging) {
827 m_capturingMouseEventsNode = mev.innerNode(); 823 m_capturingMouseEventsNode = mev.innerNode();
828 m_eventHandlerWillResetCapturingMouseEventsNode = true; 824 m_eventHandlerWillResetCapturingMouseEventsNode = true;
829 } 825 }
830 invalidateClick(); 826 invalidateClick();
831 return result; 827 return result;
832 } 828 }
833 829
834 #if OS(WIN) 830 if (RuntimeEnabledFeatures::panScrollingEnabled()) {
835 // We store whether pan scrolling is in progress before calling stopAutoscro ll() 831 // We store whether pan scrolling is in progress before calling stopAuto scroll()
836 // because it will set m_autoscrollType to NoAutoscroll on return. 832 // because it will set m_autoscrollType to NoAutoscroll on return.
837 bool isPanScrollInProgress = m_scrollManager.panScrollInProgress(); 833 bool isPanScrollInProgress = m_scrollManager.panScrollInProgress();
838 m_scrollManager.stopAutoscroll(); 834 m_scrollManager.stopAutoscroll();
839 if (isPanScrollInProgress) { 835 if (isPanScrollInProgress) {
840 // We invalidate the click when exiting pan scrolling so that we don't i nadvertently navigate 836 // We invalidate the click when exiting pan scrolling so that we don 't inadvertently navigate
841 // away from the current page (e.g. the click was on a hyperlink). See < rdar://problem/6095023>. 837 // away from the current page (e.g. the click was on a hyperlink). S ee <rdar://problem/6095023>.
842 invalidateClick(); 838 invalidateClick();
843 return WebInputEventResult::HandledSuppressed; 839 updatePointerTargetAndDispatchEvents(EventTypeNames::mousedown, mev. innerNode(), m_clickCount, mev.event());
sunyunjia 2016/09/01 01:50:31 I'm not sure the side effects of adding this line
Navid Zolghadr 2016/09/02 17:36:57 When pan is enabled and that pan circle is shown,
840 return WebInputEventResult::HandledSuppressed;
841 }
844 } 842 }
845 #endif
846 843
847 m_clickCount = mouseEvent.clickCount(); 844 m_clickCount = mouseEvent.clickCount();
848 m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*me v.innerNode()) : mev.innerNode(); 845 m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*me v.innerNode()) : mev.innerNode();
849 846
850 if (!mouseEvent.fromTouch()) 847 if (!mouseEvent.fromTouch())
851 m_frame->selection().setCaretBlinkingSuspended(true); 848 m_frame->selection().setCaretBlinkingSuspended(true);
852 849
853 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event()); 850 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event());
854 851
855 if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) { 852 if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 if (!mouseEvent.fromTouch()) 1103 if (!mouseEvent.fromTouch())
1107 m_frame->selection().setCaretBlinkingSuspended(false); 1104 m_frame->selection().setCaretBlinkingSuspended(false);
1108 1105
1109 std::unique_ptr<UserGestureIndicator> gestureIndicator; 1106 std::unique_ptr<UserGestureIndicator> gestureIndicator;
1110 1107
1111 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n) 1108 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n)
1112 gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFra meRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); 1109 gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFra meRoot()->eventHandler().m_lastMouseDownUserGestureToken.release()));
1113 else 1110 else
1114 gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcess ingUserGesture)); 1111 gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcess ingUserGesture));
1115 1112
1116 #if OS(WIN) 1113 if (RuntimeEnabledFeatures::panScrollingEnabled()) {
1117 if (Page* page = m_frame->page()) 1114 if (Page* page = m_frame->page())
1118 page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame, mouseEvent); 1115 page->autoscrollController().handleMouseReleaseForPanScrolling(m_fra me, mouseEvent);
1119 #endif 1116 }
1120 1117
1121 m_mousePressed = false; 1118 m_mousePressed = false;
1122 setLastKnownMousePosition(mouseEvent); 1119 setLastKnownMousePosition(mouseEvent);
1123 1120
1124 if (m_svgPan) { 1121 if (m_svgPan) {
1125 m_svgPan = false; 1122 m_svgPan = false;
1126 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->ro otFrameToContents(m_lastKnownMousePosition)); 1123 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->ro otFrameToContents(m_lastKnownMousePosition));
1127 return WebInputEventResult::HandledSuppressed; 1124 return WebInputEventResult::HandledSuppressed;
1128 } 1125 }
1129 1126
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 2603
2607 FrameHost* EventHandler::frameHost() const 2604 FrameHost* EventHandler::frameHost() const
2608 { 2605 {
2609 if (!m_frame->page()) 2606 if (!m_frame->page())
2610 return nullptr; 2607 return nullptr;
2611 2608
2612 return &m_frame->page()->frameHost(); 2609 return &m_frame->page()->frameHost();
2613 } 2610 }
2614 2611
2615 } // namespace blink 2612 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698