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

Side by Side 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 unified diff | 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 »
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 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@gmail.com> 10 * Christian Biesinger <cbiesinger@gmail.com>
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 LayoutRect layerBounds(LayoutPoint(), 1638 LayoutRect layerBounds(LayoutPoint(),
1639 LayoutSize(box().clientWidth(), box().clientHeight())); 1639 LayoutSize(box().clientWidth(), box().clientHeight()));
1640 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, 1640 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect,
1641 alignX, alignY); 1641 alignX, alignY);
1642 1642
1643 ScrollOffset oldScrollOffset = getScrollOffset(); 1643 ScrollOffset oldScrollOffset = getScrollOffset();
1644 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( 1644 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize(
1645 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); 1645 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset))));
1646 1646
1647 if (newScrollOffset == oldScrollOffset) { 1647 if (newScrollOffset == oldScrollOffset) {
1648 return LayoutRect( 1648 LayoutRect intersect =
1649 box() 1649 LayoutRect(box()
1650 .localToAbsoluteQuad(FloatQuad(FloatRect(intersection( 1650 .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.
1651 layerBounds, localExposeRect))), 1651 layerBounds, localExposeRect))),
1652 UseTransforms) 1652 UseTransforms)
1653 .boundingBox()); 1653 .boundingBox());
1654 if (intersect.isEmpty() && !layerBounds.isEmpty() &&
1655 !localExposeRect.isEmpty()) {
1656 return LayoutRect(
1657 box()
1658 .localToAbsoluteQuad(FloatQuad(FloatRect(layerBounds)),
1659 UseTransforms)
1660 .boundingBox());
1661 }
1662 return intersect;
1654 } 1663 }
1655 1664
1656 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); 1665 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant);
1657 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; 1666 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset;
1658 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); 1667 localExposeRect.move(-LayoutSize(scrollOffsetDifference));
1659 return LayoutRect( 1668 LayoutRect intersect = LayoutRect(
1660 box() 1669 box()
1661 .localToAbsoluteQuad( 1670 .localToAbsoluteQuad(
1662 FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))), 1671 FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))),
1663 UseTransforms) 1672 UseTransforms)
1664 .boundingBox()); 1673 .boundingBox());
1674 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.
1675 !localExposeRect.isEmpty()) {
1676 return LayoutRect(box()
1677 .localToAbsoluteQuad(
1678 FloatQuad(FloatRect(layerBounds)), UseTransforms)
1679 .boundingBox());
1680 }
1681 return intersect;
1665 } 1682 }
1666 1683
1667 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { 1684 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) {
1668 LocalFrame* frame = box().frame(); 1685 LocalFrame* frame = box().frame();
1669 if (!frame) 1686 if (!frame)
1670 return; 1687 return;
1671 1688
1672 FrameView* frameView = frame->view(); 1689 FrameView* frameView = frame->view();
1673 if (!frameView) 1690 if (!frameView)
1674 return; 1691 return;
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 2051
2035 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2052 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2036 clampScrollableAreas() { 2053 clampScrollableAreas() {
2037 for (auto& scrollableArea : *s_needsClamp) 2054 for (auto& scrollableArea : *s_needsClamp)
2038 scrollableArea->clampScrollOffsetAfterOverflowChange(); 2055 scrollableArea->clampScrollOffsetAfterOverflowChange();
2039 delete s_needsClamp; 2056 delete s_needsClamp;
2040 s_needsClamp = nullptr; 2057 s_needsClamp = nullptr;
2041 } 2058 }
2042 2059
2043 } // namespace blink 2060 } // namespace blink
OLDNEW
« 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