Index: third_party/WebKit/Source/core/page/AutoscrollController.cpp |
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.cpp b/third_party/WebKit/Source/core/page/AutoscrollController.cpp |
index 34620a291a0f193b9ce7d0e5e8744a84ed516de0..78b4379ddd2a2e4bbc16aa2025f79d8bcb43a224 100644 |
--- a/third_party/WebKit/Source/core/page/AutoscrollController.cpp |
+++ b/third_party/WebKit/Source/core/page/AutoscrollController.cpp |
@@ -74,7 +74,7 @@ bool AutoscrollController::autoscrollInProgress(const LayoutBox* layoutObject) c |
void AutoscrollController::startAutoscrollForSelection(LayoutObject* layoutObject) |
{ |
- // We don't want to trigger the autoscroll or the panScroll if it's already active |
+ // We don't want to trigger the autoscroll or the middleClickAutoscroll if it's already active |
if (m_autoscrollType != NoAutoscroll) |
return; |
LayoutBox* scrollable = LayoutBox::findAutoscrollable(layoutObject); |
@@ -101,14 +101,11 @@ void AutoscrollController::stopAutoscroll() |
if (!scrollable) |
return; |
-#if OS(WIN) |
- if (panScrollInProgress()) { |
+ if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled() && middleClickAutoscrollInProgress()) { |
if (FrameView* view = scrollable->frame()->view()) { |
view->setCursor(pointerCursor()); |
} |
} |
-#endif |
- |
m_autoscrollType = NoAutoscroll; |
} |
@@ -130,12 +127,12 @@ void AutoscrollController::updateAutoscrollLayoutObject() |
LayoutObject* layoutObject = m_autoscrollLayoutObject; |
-#if OS(WIN) |
- HitTestResult hitTest = layoutObject->frame()->eventHandler().hitTestResultAtPoint(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active); |
+ if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
+ HitTestResult hitTest = layoutObject->frame()->eventHandler().hitTestResultAtPoint(m_middleClickAutoscrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active); |
- if (Node* nodeAtPoint = hitTest.innerNode()) |
- layoutObject = nodeAtPoint->layoutObject(); |
-#endif |
+ if (Node* nodeAtPoint = hitTest.innerNode()) |
+ layoutObject = nodeAtPoint->layoutObject(); |
+ } |
while (layoutObject && !(layoutObject->isBox() && toLayoutBox(layoutObject)->canAutoscroll())) |
layoutObject = layoutObject->parent(); |
@@ -187,7 +184,6 @@ void AutoscrollController::updateDragAndDrop(Node* dropTargetNode, const IntPoin |
} |
} |
-#if OS(WIN) |
void AutoscrollController::handleMouseReleaseForPanScrolling(LocalFrame* frame, const PlatformMouseEvent& mouseEvent) |
{ |
if (!frame->isMainFrame()) |
@@ -208,29 +204,23 @@ void AutoscrollController::handleMouseReleaseForPanScrolling(LocalFrame* frame, |
} |
} |
-bool AutoscrollController::panScrollInProgress() const |
+bool AutoscrollController::middleClickAutoscrollInProgress() const |
{ |
return m_autoscrollType == AutoscrollForPanCanStop || m_autoscrollType == AutoscrollForPan; |
} |
void AutoscrollController::startPanScrolling(LayoutBox* scrollable, const IntPoint& lastKnownMousePosition) |
{ |
- // We don't want to trigger the autoscroll or the panScroll if it's already active |
+ // We don't want to trigger the autoscroll or the middleClickAutoscroll if it's already active |
if (m_autoscrollType != NoAutoscroll) |
return; |
m_autoscrollType = AutoscrollForPan; |
m_autoscrollLayoutObject = scrollable; |
- m_panScrollStartPos = lastKnownMousePosition; |
+ m_middleClickAutoscrollStartPos = lastKnownMousePosition; |
startAutoscroll(); |
} |
-#else |
-bool AutoscrollController::panScrollInProgress() const |
-{ |
- return false; |
-} |
-#endif |
// FIXME: This would get get better animation fidelity if it used the monotonicFrameBeginTime instead |
// of WTF::currentTime(). |
@@ -257,18 +247,16 @@ void AutoscrollController::animate(double) |
break; |
case NoAutoscroll: |
break; |
-#if OS(WIN) |
case AutoscrollForPanCanStop: |
case AutoscrollForPan: |
bokan
2016/09/07 16:33:46
Please add a DCHECK here that the middleClickAutoS
|
- if (!panScrollInProgress()) { |
+ if (!middleClickAutoscrollInProgress()) { |
stopAutoscroll(); |
return; |
} |
if (FrameView* view = m_autoscrollLayoutObject->frame()->view()) |
updatePanScrollState(view, eventHandler.lastKnownMousePosition()); |
- m_autoscrollLayoutObject->panScroll(m_panScrollStartPos); |
+ m_autoscrollLayoutObject->middleClickAutoscroll(m_middleClickAutoscrollStartPos); |
break; |
-#endif |
} |
if (m_autoscrollType != NoAutoscroll && m_autoscrollLayoutObject) |
m_page->chromeClient().scheduleAnimation(m_autoscrollLayoutObject->frame()->view()); |
@@ -279,15 +267,14 @@ void AutoscrollController::startAutoscroll() |
m_page->chromeClient().scheduleAnimation(m_autoscrollLayoutObject->frame()->view()); |
} |
-#if OS(WIN) |
void AutoscrollController::updatePanScrollState(FrameView* view, const IntPoint& lastKnownMousePosition) |
{ |
// At the original click location we draw a 4 arrowed icon. Over this icon there won't be any scroll |
// So we don't want to change the cursor over this area |
- bool east = m_panScrollStartPos.x() < (lastKnownMousePosition.x() - noPanScrollRadius); |
- bool west = m_panScrollStartPos.x() > (lastKnownMousePosition.x() + noPanScrollRadius); |
- bool north = m_panScrollStartPos.y() > (lastKnownMousePosition.y() + noPanScrollRadius); |
- bool south = m_panScrollStartPos.y() < (lastKnownMousePosition.y() - noPanScrollRadius); |
+ bool east = m_middleClickAutoscrollStartPos.x() < (lastKnownMousePosition.x() - noPanScrollRadius); |
+ bool west = m_middleClickAutoscrollStartPos.x() > (lastKnownMousePosition.x() + noPanScrollRadius); |
+ bool north = m_middleClickAutoscrollStartPos.y() > (lastKnownMousePosition.y() + noPanScrollRadius); |
+ bool south = m_middleClickAutoscrollStartPos.y() < (lastKnownMousePosition.y() - noPanScrollRadius); |
if (m_autoscrollType == AutoscrollForPan && (east || west || north || south)) |
m_autoscrollType = AutoscrollForPanCanStop; |
@@ -314,6 +301,5 @@ void AutoscrollController::updatePanScrollState(FrameView* view, const IntPoint& |
view->setCursor(middlePanningCursor()); |
} |
} |
-#endif |
} // namespace blink |