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

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

Issue 2730343003: Fix overflow:overlay scrollbar width for paint. (Closed)
Patch Set: Created 3 years, 9 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
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 IntSize PaintLayerScrollableArea::minimumScrollOffsetInt() const { 497 IntSize PaintLayerScrollableArea::minimumScrollOffsetInt() const {
498 return toIntSize(-scrollOrigin()); 498 return toIntSize(-scrollOrigin());
499 } 499 }
500 500
501 IntSize PaintLayerScrollableArea::maximumScrollOffsetInt() const { 501 IntSize PaintLayerScrollableArea::maximumScrollOffsetInt() const {
502 if (!box().hasOverflowClip()) 502 if (!box().hasOverflowClip())
503 return toIntSize(-scrollOrigin()); 503 return toIntSize(-scrollOrigin());
504 504
505 IntSize contentSize = contentsSize(); 505 IntSize contentSize = contentsSize();
506 IntSize visibleSize = 506 IntSize visibleSize =
507 pixelSnappedIntRect(box().overflowClipRect(box().location())).size(); 507 pixelSnappedIntRect(box().overflowClipRect(box().location())).size();
skobes 2017/03/07 16:42:47 Could we add a value to the OverlayScrollbarClipBe
szager1 2017/03/07 19:01:31 Yeah, that was my first attempt. It works, but it
skobes 2017/03/07 19:09:12 I probably do, though I'll have to see the patch.
508 508
509 // When computing scroll limits, overflow:overlay scrollbars should not be
510 // subtracted from the visible content size.
511 if (hasVerticalScrollbar() &&
512 box().style()->overflowY() == EOverflow::kOverlay)
513 visibleSize.expand(verticalScrollbar()->scrollbarThickness(), 0);
514 if (hasHorizontalScrollbar() &&
515 box().style()->overflowX() == EOverflow::kOverlay)
516 visibleSize.expand(0, horizontalScrollbar()->scrollbarThickness());
517
509 FrameHost* host = layoutBox()->document().frameHost(); 518 FrameHost* host = layoutBox()->document().frameHost();
510 DCHECK(host); 519 DCHECK(host);
511 TopDocumentRootScrollerController& controller = 520 TopDocumentRootScrollerController& controller =
512 host->globalRootScrollerController(); 521 host->globalRootScrollerController();
513 522
514 // The global root scroller should be clipped by the top FrameView rather 523 // The global root scroller should be clipped by the top FrameView rather
515 // than it's overflow clipping box. This is to ensure that content exposed by 524 // than it's overflow clipping box. This is to ensure that content exposed by
516 // hiding the URL bar at the bottom of the screen is visible. 525 // hiding the URL bar at the bottom of the screen is visible.
517 if (this == controller.rootScrollerArea()) 526 if (this == controller.rootScrollerArea())
518 visibleSize = controller.rootScrollerVisibleArea(); 527 visibleSize = controller.rootScrollerVisibleArea();
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 // Force an update since we know the scrollbars have changed things. 1298 // Force an update since we know the scrollbars have changed things.
1290 if (box().document().hasAnnotatedRegions()) 1299 if (box().document().hasAnnotatedRegions())
1291 box().document().setAnnotatedRegionsDirty(true); 1300 box().document().setAnnotatedRegionsDirty(true);
1292 return true; 1301 return true;
1293 } 1302 }
1294 1303
1295 int PaintLayerScrollableArea::verticalScrollbarWidth( 1304 int PaintLayerScrollableArea::verticalScrollbarWidth(
1296 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { 1305 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
1297 if (!hasVerticalScrollbar()) 1306 if (!hasVerticalScrollbar())
1298 return 0; 1307 return 0;
1299 if ((verticalScrollbar()->isOverlayScrollbar() || 1308 if (verticalScrollbar()->isOverlayScrollbar() &&
1300 box().style()->overflowY() == EOverflow::kOverlay) &&
1301 (overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize || 1309 (overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize ||
1302 !verticalScrollbar()->shouldParticipateInHitTesting())) { 1310 !verticalScrollbar()->shouldParticipateInHitTesting()))
1303 return 0; 1311 return 0;
1304 }
1305 return verticalScrollbar()->scrollbarThickness(); 1312 return verticalScrollbar()->scrollbarThickness();
1306 } 1313 }
1307 1314
1308 int PaintLayerScrollableArea::horizontalScrollbarHeight( 1315 int PaintLayerScrollableArea::horizontalScrollbarHeight(
1309 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { 1316 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
1310 if (!hasHorizontalScrollbar()) 1317 if (!hasHorizontalScrollbar())
1311 return 0; 1318 return 0;
1312 if ((horizontalScrollbar()->isOverlayScrollbar() || 1319 if (horizontalScrollbar()->isOverlayScrollbar() &&
1313 box().style()->overflowX() == EOverflow::kOverlay) &&
1314 (overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize || 1320 (overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize ||
1315 !horizontalScrollbar()->shouldParticipateInHitTesting())) { 1321 !horizontalScrollbar()->shouldParticipateInHitTesting()))
1316 return 0; 1322 return 0;
1317 }
1318 return horizontalScrollbar()->scrollbarThickness(); 1323 return horizontalScrollbar()->scrollbarThickness();
1319 } 1324 }
1320 1325
1321 void PaintLayerScrollableArea::positionOverflowControls() { 1326 void PaintLayerScrollableArea::positionOverflowControls() {
1322 if (!hasScrollbar() && !box().canResize()) 1327 if (!hasScrollbar() && !box().canResize())
1323 return; 1328 return;
1324 1329
1325 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); 1330 const IntRect borderBox = box().pixelSnappedBorderBoxRect();
1326 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) 1331 if (Scrollbar* verticalScrollbar = this->verticalScrollbar())
1327 verticalScrollbar->setFrameRect(rectForVerticalScrollbar(borderBox)); 1332 verticalScrollbar->setFrameRect(rectForVerticalScrollbar(borderBox));
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 2135
2131 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2136 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2132 clampScrollableAreas() { 2137 clampScrollableAreas() {
2133 for (auto& scrollableArea : *s_needsClamp) 2138 for (auto& scrollableArea : *s_needsClamp)
2134 scrollableArea->clampScrollOffsetAfterOverflowChange(); 2139 scrollableArea->clampScrollOffsetAfterOverflowChange();
2135 delete s_needsClamp; 2140 delete s_needsClamp;
2136 s_needsClamp = nullptr; 2141 s_needsClamp = nullptr;
2137 } 2142 }
2138 2143
2139 } // namespace blink 2144 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698