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

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

Issue 2623943002: Scroll the position into view when the content is not visible. (Closed)
Patch Set: 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 443b303bad88770b3c764c988a469f89b4e338aa..d5e49faf3a364b5d69725a3c99c628dbf846ff64 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -86,6 +86,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;
@@ -1606,25 +1612,17 @@ LayoutRect PaintLayerScrollableArea::scrollIntoView(
ScrollOffset oldScrollOffset = scrollOffset();
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 = scrollOffset() - 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