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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Better tests. Created 4 years, 1 month 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/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index f36b66cb19de939b00e1e070f36a93ac26ba091b..b25724f9f244fc8d2ad11d9507e016477d1926e7 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1043,57 +1043,6 @@ LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* layoutObject) {
: nullptr;
}
-static inline int adjustedScrollDelta(int beginningDelta) {
- // This implemention matches Firefox's.
- // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml#856.
- const int speedReducer = 12;
-
- int adjustedDelta = beginningDelta / speedReducer;
- if (adjustedDelta > 1)
- adjustedDelta = static_cast<int>(adjustedDelta *
- sqrt(static_cast<double>(adjustedDelta))) -
- 1;
- else if (adjustedDelta < -1)
- adjustedDelta =
- static_cast<int>(adjustedDelta *
- sqrt(static_cast<double>(-adjustedDelta))) +
- 1;
-
- return adjustedDelta;
-}
-
-static inline IntSize adjustedScrollDelta(const IntSize& delta) {
- return IntSize(adjustedScrollDelta(delta.width()),
- adjustedScrollDelta(delta.height()));
-}
-
-void LayoutBox::middleClickAutoscroll(const IntPoint& sourcePoint) {
- LocalFrame* frame = this->frame();
- if (!frame)
- return;
-
- IntPoint lastKnownMousePosition =
- frame->eventHandler().lastKnownMousePosition();
-
- // We need to check if the last known mouse position is out of the window.
- // When the mouse is out of the window, the position is incoherent
- static IntPoint previousMousePosition;
- if (lastKnownMousePosition.x() < 0 || lastKnownMousePosition.y() < 0)
- lastKnownMousePosition = previousMousePosition;
- else
- previousMousePosition = lastKnownMousePosition;
-
- IntSize delta = lastKnownMousePosition - sourcePoint;
-
- // at the center we let the space for the icon.
- if (abs(delta.width()) <= AutoscrollController::noMiddleClickAutoscrollRadius)
- delta.setWidth(0);
- if (abs(delta.height()) <=
- AutoscrollController::noMiddleClickAutoscrollRadius)
- delta.setHeight(0);
- scroll(ScrollByPixel, FloatSize(adjustedScrollDelta(delta)));
-}
-
void LayoutBox::scrollByRecursively(const ScrollOffset& delta) {
if (delta.isZero())
return;
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/page/AutoscrollController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698