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

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: Scroll the content rather than the viewport. 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..78d933821253a531db8af12f76e71b5089ae3247 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;
@@ -1645,23 +1651,25 @@ LayoutRect PaintLayerScrollableArea::scrollIntoView(
toScrollOffset(FloatPoint(r.location()) + oldScrollOffset))));
if (newScrollOffset == oldScrollOffset) {
- return LayoutRect(
- box()
- .localToAbsoluteQuad(FloatQuad(FloatRect(intersection(
- layerBounds, localExposeRect))),
- UseTransforms)
- .boundingBox());
+ LayoutRect intersect =
bokan 2016/12/20 15:43:56 This part is duplicated below. I think the three l
sunyunjia 2017/01/04 19:32:37 Done.
+ localToAbsolute(box(), intersection(layerBounds, localExposeRect));
+ if (intersect.isEmpty() && !layerBounds.isEmpty() &&
+ !localExposeRect.isEmpty()) {
+ return localToAbsolute(box(), localExposeRect);
+ }
+ return intersect;
}
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