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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2576963002: Scroll the position into view when the content is not visible. (Closed)
Patch Set: remove the if condition. Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-hidden-element.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index d5748a61a533ed93610300bda459836bfcd96972..10248a0a7e4094f1f79261c24cf88a3be58e5bd5 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -85,6 +85,12 @@
namespace blink {
+static LayoutRect localToAbsolute(LayoutBox& offset, LayoutRect rect) {
+ return LayoutRect(
+ offset.localToAbsoluteQuad(FloatQuad(FloatRect(rect)), UseTransforms)
+ .boundingBox());
+}
+
PaintLayerScrollableAreaRareData::PaintLayerScrollableAreaRareData() {}
const int ResizerControlExpandRatioForTouch = 2;
@@ -1622,25 +1628,17 @@ LayoutRect PaintLayerScrollableArea::scrollIntoView(
ScrollOffset oldScrollOffset = getScrollOffset();
ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize(
toScrollOffset(FloatPoint(r.location()) + oldScrollOffset))));
-
- if (newScrollOffset == oldScrollOffset) {
- return LayoutRect(
- box()
- .localToAbsoluteQuad(FloatQuad(FloatRect(intersection(
- layerBounds, localExposeRect))),
- UseTransforms)
- .boundingBox());
- }
-
setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant);
ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset;
localExposeRect.move(-LayoutSize(scrollOffsetDifference));
- return LayoutRect(
- box()
- .localToAbsoluteQuad(
- FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))),
- UseTransforms)
- .boundingBox());
+
+ LayoutRect intersect =
+ localToAbsolute(box(), intersection(layerBounds, localExposeRect));
+ if (intersect.isEmpty() && !layerBounds.isEmpty() &&
+ !localExposeRect.isEmpty()) {
+ return localToAbsolute(box(), localExposeRect);
+ }
+ return intersect;
}
void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) {
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-hidden-element.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698