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

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

Issue 2262373003: Clip PaintLayerScrollableArea::scrollIntoView return to layer bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Solve the intrinsic problem and pass the test 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 | « no previous file | 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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 1409
1410 LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, cons t ScrollAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType) 1410 LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, cons t ScrollAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType)
1411 { 1411 {
1412 LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rec t)), UseTransforms).boundingBox()); 1412 LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rec t)), UseTransforms).boundingBox());
1413 localExposeRect.move(-box().borderLeft(), -box().borderTop()); 1413 localExposeRect.move(-box().borderLeft(), -box().borderTop());
1414 LayoutRect layerBounds(LayoutPoint(), LayoutSize(box().clientWidth(), box(). clientHeight())); 1414 LayoutRect layerBounds(LayoutPoint(), LayoutSize(box().clientWidth(), box(). clientHeight()));
1415 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect , alignX, alignY); 1415 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect , alignX, alignY);
1416 1416
1417 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble () + roundedIntSize(r.location())); 1417 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble () + roundedIntSize(r.location()));
1418 if (clampedScrollPosition == scrollPositionDouble()) 1418 if (clampedScrollPosition == scrollPositionDouble())
1419 return rect; 1419 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(intersec tion(layerBounds, localExposeRect))), UseTransforms).boundingBox());
bokan 2016/08/24 18:02:18 Taking the intersection now means we might end up
1420 1420
1421 DoubleSize oldScrollOffset = adjustedScrollOffset(); 1421 DoubleSize oldScrollOffset = adjustedScrollOffset();
1422 scrollToPosition(clampedScrollPosition, ScrollOffsetUnclamped, ScrollBehavio rInstant, scrollType); 1422 scrollToPosition(clampedScrollPosition, ScrollOffsetUnclamped, ScrollBehavio rInstant, scrollType);
1423 DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset ; 1423 DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset ;
1424 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); 1424 localExposeRect.move(-LayoutSize(scrollOffsetDifference));
1425 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(localExposeR ect)), UseTransforms).boundingBox()); 1425 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(intersection (layerBounds, localExposeRect))), UseTransforms).boundingBox());
1426 } 1426 }
1427 1427
1428 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) 1428 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow)
1429 { 1429 {
1430 LocalFrame* frame = box().frame(); 1430 LocalFrame* frame = box().frame();
1431 if (!frame) 1431 if (!frame)
1432 return; 1432 return;
1433 1433
1434 FrameView* frameView = frame->view(); 1434 FrameView* frameView = frame->view();
1435 if (!frameView) 1435 if (!frameView)
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 1773
1774 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1774 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1775 { 1775 {
1776 for (auto& scrollableArea : *s_needsClamp) 1776 for (auto& scrollableArea : *s_needsClamp)
1777 scrollableArea->clampScrollPositionsAfterLayout(); 1777 scrollableArea->clampScrollPositionsAfterLayout();
1778 delete s_needsClamp; 1778 delete s_needsClamp;
1779 s_needsClamp = nullptr; 1779 s_needsClamp = nullptr;
1780 } 1780 }
1781 1781
1782 } // namespace blink 1782 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698