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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2336013002: ScrollRectToVisible should bubble up through its layout container. (Closed)
Patch Set: maximum==minimum Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/absolute-position-overflow-clip.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@gmail.com> 9 * Christian Biesinger <cbiesinger@gmail.com>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::UnitType::Pixels); 1400 element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::UnitType::Pixels);
1401 } 1401 }
1402 1402
1403 document.updateStyleAndLayout(); 1403 document.updateStyleAndLayout();
1404 1404
1405 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view. 1405 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view.
1406 } 1406 }
1407 1407
1408 LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, cons t ScrollAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType) 1408 LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, cons t ScrollAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType)
1409 { 1409 {
1410 if (maximumScrollPosition() == minimumScrollPosition())
1411 return rect;
1412
1410 LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rec t)), UseTransforms).boundingBox()); 1413 LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rec t)), UseTransforms).boundingBox());
1411 localExposeRect.move(-box().borderLeft(), -box().borderTop()); 1414 localExposeRect.move(-box().borderLeft(), -box().borderTop());
1412 LayoutRect layerBounds(LayoutPoint(), LayoutSize(box().clientWidth(), box(). clientHeight())); 1415 LayoutRect layerBounds(LayoutPoint(), LayoutSize(box().clientWidth(), box(). clientHeight()));
1413 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect , alignX, alignY); 1416 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect , alignX, alignY);
1414 1417
1415 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble () + roundedIntSize(r.location())); 1418 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble () + roundedIntSize(r.location()));
1416 if (clampedScrollPosition == scrollPositionDouble()) 1419 if (clampedScrollPosition == scrollPositionDouble())
1417 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(intersec tion(layerBounds, localExposeRect))), UseTransforms).boundingBox()); 1420 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(intersec tion(layerBounds, localExposeRect))), UseTransforms).boundingBox());
bokan 2016/09/13 15:32:29 Sorry, probably should have asked this before but
sunyunjia 2016/09/13 16:00:44 As I investigated, for my test case and the websit
1418 1421
1419 DoubleSize oldScrollOffset = adjustedScrollOffset(); 1422 DoubleSize oldScrollOffset = adjustedScrollOffset();
1420 scrollToPosition(clampedScrollPosition, ScrollOffsetUnclamped, ScrollBehavio rInstant, scrollType); 1423 scrollToPosition(clampedScrollPosition, ScrollOffsetUnclamped, ScrollBehavio rInstant, scrollType);
1421 DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset ; 1424 DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset ;
1422 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); 1425 localExposeRect.move(-LayoutSize(scrollOffsetDifference));
1423 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(intersection (layerBounds, localExposeRect))), UseTransforms).boundingBox()); 1426 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(intersection (layerBounds, localExposeRect))), UseTransforms).boundingBox());
1424 } 1427 }
1425 1428
1426 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) 1429 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow)
1427 { 1430 {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 1771
1769 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1772 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1770 { 1773 {
1771 for (auto& scrollableArea : *s_needsClamp) 1774 for (auto& scrollableArea : *s_needsClamp)
1772 scrollableArea->clampScrollPositionsAfterLayout(); 1775 scrollableArea->clampScrollPositionsAfterLayout();
1773 delete s_needsClamp; 1776 delete s_needsClamp;
1774 s_needsClamp = nullptr; 1777 s_needsClamp = nullptr;
1775 } 1778 }
1776 1779
1777 } // namespace blink 1780 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/absolute-position-overflow-clip.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698