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

Unified Diff: third_party/WebKit/Source/core/page/SpatialNavigation.cpp

Issue 2387393003: Revert of Refactor ScrollableArea::setScrollPosition. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/SpatialNavigation.cpp
diff --git a/third_party/WebKit/Source/core/page/SpatialNavigation.cpp b/third_party/WebKit/Source/core/page/SpatialNavigation.cpp
index fae5f8e406daf2473e5a23f09f86e10a36d09981..d329451a9c3e691c055bd49ed5a02226e34c07df 100644
--- a/third_party/WebKit/Source/core/page/SpatialNavigation.cpp
+++ b/third_party/WebKit/Source/core/page/SpatialNavigation.cpp
@@ -244,22 +244,32 @@
frameView ? frameView->getHostWindow() : nullptr);
switch (type) {
case WebFocusTypeLeft:
- dx = -pixelsPerLineStep;
+ dx = -std::min(pixelsPerLineStep,
+ container->layoutBox()->scrollLeft().toInt());
break;
case WebFocusTypeRight:
ASSERT(container->layoutBox()->scrollWidth() >
(container->layoutBox()->scrollLeft() +
container->layoutBox()->clientWidth()));
- dx = pixelsPerLineStep;
+ dx = std::min(pixelsPerLineStep,
+ (container->layoutBox()->scrollWidth() -
+ (container->layoutBox()->scrollLeft() +
+ container->layoutBox()->clientWidth()))
+ .toInt());
break;
case WebFocusTypeUp:
- dy = -pixelsPerLineStep;
+ dy = -std::min(pixelsPerLineStep,
+ container->layoutBox()->scrollTop().toInt());
break;
case WebFocusTypeDown:
ASSERT(container->layoutBox()->scrollHeight() -
(container->layoutBox()->scrollTop() +
container->layoutBox()->clientHeight()));
- dy = pixelsPerLineStep;
+ dy = std::min(pixelsPerLineStep,
+ (container->layoutBox()->scrollHeight() -
+ (container->layoutBox()->scrollTop() +
+ container->layoutBox()->clientHeight()))
+ .toInt());
break;
default:
ASSERT_NOT_REACHED();
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollEnums.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698