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

Unified 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: Rename the files. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index c4b8be9bd2429711db21cfc9df3e5f292108c97f..889dd642f6ce00c3d2c160835388ce21979332f3 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -411,7 +411,7 @@ WebInputEventResult EventHandler::handleMouseDraggedEvent(const MouseEventWithHi
m_mouseDownMayStartDrag = false;
- if (m_mouseDownMayStartAutoscroll && !m_scrollManager.panScrollInProgress()) {
+ if (m_mouseDownMayStartAutoscroll && !m_scrollManager.middleClickAutoscrollInProgress()) {
if (AutoscrollController* controller = m_scrollManager.autoscrollController()) {
controller->startAutoscrollForSelection(layoutObject);
m_mouseDownMayStartAutoscroll = false;
@@ -436,8 +436,6 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi
return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled;
}
-#if OS(WIN)
-
void EventHandler::startPanScrolling(LayoutObject* layoutObject)
{
bokan 2016/09/07 16:33:46 Add a DCHECK for the new RuntimeEnabledFeature her
if (!layoutObject->isBox())
@@ -449,8 +447,6 @@ void EventHandler::startPanScrolling(LayoutObject* layoutObject)
invalidateClick();
}
-#endif // OS(WIN)
-
HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
{
TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint");
@@ -601,7 +597,7 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result)
Page* page = m_frame->page();
if (!page)
return NoCursorChange;
- if (m_scrollManager.panScrollInProgress())
+ if (m_scrollManager.middleClickAutoscrollInProgress())
return NoCursorChange;
Node* node = result.innerPossiblyPseudoNode();
@@ -831,18 +827,18 @@ WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
return result;
}
-#if OS(WIN)
- // We store whether pan scrolling is in progress before calling stopAutoscroll()
- // because it will set m_autoscrollType to NoAutoscroll on return.
- bool isPanScrollInProgress = m_scrollManager.panScrollInProgress();
- m_scrollManager.stopAutoscroll();
- if (isPanScrollInProgress) {
- // We invalidate the click when exiting pan scrolling so that we don't inadvertently navigate
- // away from the current page (e.g. the click was on a hyperlink). See <rdar://problem/6095023>.
- invalidateClick();
- return WebInputEventResult::HandledSuppressed;
+ if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) {
+ // We store whether pan scrolling is in progress before calling stopAutoscroll()
+ // because it will set m_autoscrollType to NoAutoscroll on return.
+ bool isPanScrollInProgress = m_scrollManager.middleClickAutoscrollInProgress();
+ m_scrollManager.stopAutoscroll();
+ if (isPanScrollInProgress) {
+ // We invalidate the click when exiting pan scrolling so that we don't inadvertently navigate
+ // away from the current page (e.g. the click was on a hyperlink). See <rdar://problem/6095023>.
+ invalidateClick();
+ return WebInputEventResult::HandledSuppressed;
+ }
}
-#endif
m_clickCount = mouseEvent.clickCount();
m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*mev.innerNode()) : mev.innerNode();
@@ -1113,10 +1109,10 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
else
gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture));
-#if OS(WIN)
- if (Page* page = m_frame->page())
- page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame, mouseEvent);
-#endif
+ if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) {
+ if (Page* page = m_frame->page())
+ page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame, mouseEvent);
+ }
m_mousePressed = false;
setLastKnownMousePosition(mouseEvent);

Powered by Google App Engine
This is Rietveld 408576698