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

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: typo Created 4 years 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 42bae0b72a85e2141f46a13709ba8223a6526927..7cefa495627e330d073856e8bf2e16d62d0f14cb 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -1645,23 +1645,40 @@ LayoutRect PaintLayerScrollableArea::scrollIntoView(
toScrollOffset(FloatPoint(r.location()) + oldScrollOffset))));
if (newScrollOffset == oldScrollOffset) {
- return LayoutRect(
- box()
- .localToAbsoluteQuad(FloatQuad(FloatRect(intersection(
- layerBounds, localExposeRect))),
- UseTransforms)
- .boundingBox());
+ LayoutRect intersect =
+ LayoutRect(box()
+ .localToAbsoluteQuad(FloatQuad(FloatRect(intersection(
bokan 2016/12/15 21:31:19 this long call chain is really obscuring the inten
sunyunjia 2016/12/19 18:05:44 Done.
+ layerBounds, localExposeRect))),
+ UseTransforms)
+ .boundingBox());
+ if (intersect.isEmpty() && !layerBounds.isEmpty() &&
+ !localExposeRect.isEmpty()) {
+ return LayoutRect(
+ box()
+ .localToAbsoluteQuad(FloatQuad(FloatRect(layerBounds)),
+ UseTransforms)
+ .boundingBox());
+ }
+ return intersect;
}
setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant);
ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset;
localExposeRect.move(-LayoutSize(scrollOffsetDifference));
- return LayoutRect(
+ LayoutRect intersect = LayoutRect(
box()
.localToAbsoluteQuad(
FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))),
UseTransforms)
.boundingBox());
+ if (intersect.isEmpty() && !layerBounds.isEmpty() &&
bokan 2016/12/15 21:31:19 Hmm, doesn't this break the case that we introduce
sunyunjia 2016/12/19 18:05:44 I have to say that the bug itself is an edge case.
+ !localExposeRect.isEmpty()) {
+ return LayoutRect(box()
+ .localToAbsoluteQuad(
+ FloatQuad(FloatRect(layerBounds)), UseTransforms)
+ .boundingBox());
+ }
+ 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