Commit 2b9f74d8 authored by szager's avatar szager Committed by Commit bot

Fix overflow:overlay scrollbar width for paint.

Re-landing this change:

https://codereview.chromium.org/2730343003/

... along with the missing test expectations.

TBR=tzik@chromium.org
BUG=697751
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2757533002
Cr-Commit-Position: refs/heads/master@{#457353}
parent 0ea824c6
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 284.00 scrollHeight 842
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 284.00 scrollHeight 842
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-242) size 559x842 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-242) size 559x842 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 558.97x842
LayoutBlockFlow (anonymous) at (0,0) size 558.97x20
LayoutText {#text} at (0,0) size 559x19
......
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 278.00 scrollHeight 836
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 278.00 scrollHeight 836
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 570.41x836
LayoutBlockFlow (anonymous) at (0,0) size 570.41x18
LayoutText {#text} at (0,0) size 571x18
......
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 278.00 scrollHeight 836
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 278.00 scrollHeight 836
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 570.41x836
LayoutBlockFlow (anonymous) at (0,0) size 570.41x18
LayoutText {#text} at (0,0) size 571x18
......
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 278.00 scrollHeight 836
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 278.00 scrollHeight 836
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 570.41x836
LayoutBlockFlow (anonymous) at (0,0) size 570.41x18
LayoutText {#text} at (0,0) size 571x18
......
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 278.00 scrollHeight 836
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 278.00 scrollHeight 836
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 570.41x836
LayoutBlockFlow (anonymous) at (0,0) size 570.41x18
LayoutText {#text} at (0,0) size 571x18
......
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 278.00 scrollHeight 836
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 278.00 scrollHeight 836
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-236) size 570x836 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 570.41x836
LayoutBlockFlow (anonymous) at (0,0) size 570.41x18
LayoutText {#text} at (0,0) size 571x18
......
......@@ -3,9 +3,9 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
layer at (0,42) size 800x558 scrollY 282.00 scrollHeight 840
layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 282.00 scrollHeight 840
LayoutBlockFlow (positioned) {DIV} at (0,42) size 800x558
layer at (0,-240) size 571x840 backgroundClip at (0,42) size 800x558 clip at (0,42) size 800x558
layer at (0,-240) size 571x840 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558
LayoutBlockFlow (positioned) {DIV} at (0,0) size 571.28x840
LayoutBlockFlow (anonymous) at (0,0) size 571.28x18
LayoutText {#text} at (0,0) size 572x17
......
......@@ -15,7 +15,7 @@
},
{
"name": "Scrolling Layer",
"bounds": [300, 300],
"bounds": [285, 285],
"shouldFlattenTransform": false
},
{
......
......@@ -86,9 +86,11 @@ class CORE_EXPORT RootFrameViewport final
GraphicsLayer* layerForVerticalScrollbar() const override;
GraphicsLayer* layerForScrollCorner() const override;
int horizontalScrollbarHeight(
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
int verticalScrollbarWidth(
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
ScrollResult userScroll(ScrollGranularity, const FloatSize&) override;
bool scrollAnimatorEnabled() const override;
HostWindow* getHostWindow() const override;
......
......@@ -1088,7 +1088,7 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
// Returns the intersection of all overflow clips which apply.
virtual LayoutRect overflowClipRect(
const LayoutPoint& location,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
OverlayScrollbarClipBehavior = IgnorePlatformOverlayScrollbarSize) const;
LayoutRect clipRect(const LayoutPoint& location) const;
// Returns the combination of overflow clip, contain: paint clip and CSS clip
......@@ -1445,7 +1445,7 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
void excludeScrollbars(
LayoutRect&,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
OverlayScrollbarClipBehavior = IgnorePlatformOverlayScrollbarSize) const;
LayoutUnit containingBlockLogicalWidthForPositioned(
const LayoutBoxModelObject* containingBlock,
......
......@@ -508,7 +508,8 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
LayoutRect overflowClipRect(
const LayoutPoint& location,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
void addOverflowFromChildren() override;
......
......@@ -173,7 +173,8 @@ class CORE_EXPORT LayoutView final : public LayoutBlockFlow {
LayoutRect viewRect() const override;
LayoutRect overflowClipRect(
const LayoutPoint& location,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
LayoutState* layoutState() const { return m_layoutState; }
......
......@@ -49,7 +49,7 @@ class LayoutBoxItem : public LayoutBoxModel {
LayoutRect overflowClipRect(const LayoutPoint& location,
OverlayScrollbarClipBehavior behavior =
IgnoreOverlayScrollbarSize) const {
IgnorePlatformOverlayScrollbarSize) const {
return toBox()->overflowClipRect(location, behavior);
}
......
......@@ -550,7 +550,7 @@ void CompositedLayerMapping::
// FIXME: this should use cached clip rects, but this sometimes give
// inaccurate results (and trips the ASSERTS in PaintLayerClipper).
ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects,
IgnoreOverlayScrollbarSize);
IgnorePlatformOverlayScrollbarSize);
clipRectsContext.setIgnoreOverflowClip();
ClipRect clipRect;
......@@ -1162,7 +1162,7 @@ void CompositedLayerMapping::updateAncestorClippingLayerGeometry(
ClipRectsContext clipRectsContext(compositingContainer,
PaintingClipRectsIgnoringOverflowClip,
IgnoreOverlayScrollbarSize);
IgnorePlatformOverlayScrollbarSize);
ClipRect parentClipRect;
m_owningLayer.clipper(PaintLayer::DoNotUseGeometryMapper)
......
......@@ -230,8 +230,8 @@ LayoutRect LayoutSVGRoot::visualOverflowRect() const {
LayoutRect LayoutSVGRoot::overflowClipRect(const LayoutPoint& location,
OverlayScrollbarClipBehavior) const {
return LayoutRect(pixelSnappedIntRect(
LayoutReplaced::overflowClipRect(location, IgnoreOverlayScrollbarSize)));
return LayoutRect(pixelSnappedIntRect(LayoutReplaced::overflowClipRect(
location, IgnorePlatformOverlayScrollbarSize)));
}
void LayoutSVGRoot::paintReplaced(const PaintInfo& paintInfo,
......
......@@ -90,7 +90,8 @@ class CORE_EXPORT LayoutSVGRoot final : public LayoutReplaced {
LayoutRect visualOverflowRect() const override;
LayoutRect overflowClipRect(
const LayoutPoint& location,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
bool hasNonIsolatedBlendingDescendants() const final;
......
......@@ -41,7 +41,7 @@ class ClipRectsCache {
: root(nullptr)
#if DCHECK_IS_ON()
,
overlayScrollbarClipBehavior(IgnoreOverlayScrollbarSize)
overlayScrollbarClipBehavior(IgnorePlatformOverlayScrollbarSize)
#endif
{
}
......
......@@ -845,7 +845,7 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
const LayoutRect& dirtyRect,
ClipRectsCacheSlot,
GeometryMapperOption,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize,
OverlayScrollbarClipBehavior = IgnorePlatformOverlayScrollbarSize,
ShouldRespectOverflowClipType = RespectOverflowClip,
const LayoutPoint* offsetFromRoot = 0,
const LayoutSize& subPixelAccumulation = LayoutSize());
......@@ -855,7 +855,7 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
const LayoutRect& dirtyRect,
ClipRectsCacheSlot,
GeometryMapperOption,
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize,
OverlayScrollbarClipBehavior = IgnorePlatformOverlayScrollbarSize,
ShouldRespectOverflowClipType = RespectOverflowClip,
const LayoutPoint* offsetFromRoot = 0,
const LayoutSize& subPixelAccumulation = LayoutSize(),
......
......@@ -588,7 +588,8 @@ ClipRects& PaintLayerClipper::paintingClipRects(
const LayoutSize& subpixelAccumulation) const {
DCHECK(!m_geometryMapper);
ClipRectsContext context(rootLayer, PaintingClipRects,
IgnoreOverlayScrollbarSize, subpixelAccumulation);
IgnorePlatformOverlayScrollbarSize,
subpixelAccumulation);
if (respectOverflowClip == IgnoreOverflowClip)
context.setIgnoreOverflowClip();
return getClipRects(context);
......
......@@ -66,7 +66,7 @@ class ClipRectsContext {
ClipRectsContext(const PaintLayer* root,
ClipRectsCacheSlot slot,
OverlayScrollbarClipBehavior overlayScrollbarClipBehavior =
IgnoreOverlayScrollbarSize,
IgnorePlatformOverlayScrollbarSize,
const LayoutSize& accumulation = LayoutSize())
: rootLayer(root),
overlayScrollbarClipBehavior(overlayScrollbarClipBehavior),
......
......@@ -48,7 +48,7 @@ TEST_P(PaintLayerClipperTest, LayoutSVGRoot) {
PaintLayer* targetPaintLayer =
toLayoutBoxModelObject(target->layoutObject())->layer();
ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects,
IgnoreOverlayScrollbarSize,
IgnorePlatformOverlayScrollbarSize,
LayoutSize(FloatSize(0.25, 0.35)));
// When RLS is enabled, the LayoutView will have a composited scrolling layer,
// so don't apply an overflow clip.
......
......@@ -450,23 +450,23 @@ PaintResult PaintLayerPainter::paintLayerContents(
paintLayerForFragments->appendSingleFragmentIgnoringPagination(
layerFragments, localPaintingInfo.rootLayer,
localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption,
IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot,
localPaintingInfo.subPixelAccumulation);
IgnorePlatformOverlayScrollbarSize, respectOverflowClip,
&offsetFromRoot, localPaintingInfo.subPixelAccumulation);
} else if (isFixedPositionObjectInPagedMedia()) {
PaintLayerFragments singleFragment;
paintLayerForFragments->appendSingleFragmentIgnoringPagination(
singleFragment, localPaintingInfo.rootLayer,
localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption,
IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot,
localPaintingInfo.subPixelAccumulation);
IgnorePlatformOverlayScrollbarSize, respectOverflowClip,
&offsetFromRoot, localPaintingInfo.subPixelAccumulation);
repeatFixedPositionObjectInPages(singleFragment[0], paintingInfo,
layerFragments);
} else {
paintLayerForFragments->collectFragments(
layerFragments, localPaintingInfo.rootLayer,
localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption,
IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot,
localPaintingInfo.subPixelAccumulation);
IgnorePlatformOverlayScrollbarSize, respectOverflowClip,
&offsetFromRoot, localPaintingInfo.subPixelAccumulation);
}
if (paintFlags & PaintLayerPaintingAncestorClippingMaskPhase) {
......@@ -729,7 +729,7 @@ PaintResult PaintLayerPainter::paintLayerWithTransform(
// here.
paginationLayer->collectFragments(
layerFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect,
cacheSlot, geometryMapperOption, IgnoreOverlayScrollbarSize,
cacheSlot, geometryMapperOption, IgnorePlatformOverlayScrollbarSize,
respectOverflowClip, nullptr, paintingInfo.subPixelAccumulation,
&transformedExtent);
}
......@@ -746,7 +746,7 @@ PaintResult PaintLayerPainter::paintLayerWithTransform(
paintingInfo.rootLayer,
(paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects
: PaintingClipRects,
IgnoreOverlayScrollbarSize);
IgnorePlatformOverlayScrollbarSize);
if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) ==
IgnoreOverflowClip)
clipRectsContext.setIgnoreOverflowClip();
......
......@@ -506,7 +506,10 @@ IntSize PaintLayerScrollableArea::maximumScrollOffsetInt() const {
IntSize contentSize = contentsSize();
IntSize visibleSize =
pixelSnappedIntRect(box().overflowClipRect(box().location())).size();
pixelSnappedIntRect(
box().overflowClipRect(box().location(),
IgnorePlatformAndCSSOverlayScrollbarSize))
.size();
Page* page = layoutBox()->document().page();
DCHECK(page);
......@@ -1300,10 +1303,16 @@ int PaintLayerScrollableArea::verticalScrollbarWidth(
OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
if (!hasVerticalScrollbar())
return 0;
if ((verticalScrollbar()->isOverlayScrollbar() ||
box().style()->overflowY() == EOverflow::kOverlay) &&
(overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize ||
!verticalScrollbar()->shouldParticipateInHitTesting())) {
if (overlayScrollbarClipBehavior ==
IgnorePlatformAndCSSOverlayScrollbarSize &&
box().style()->overflowY() == EOverflow::kOverlay) {
return 0;
}
if ((overlayScrollbarClipBehavior == IgnorePlatformOverlayScrollbarSize ||
overlayScrollbarClipBehavior ==
IgnorePlatformAndCSSOverlayScrollbarSize ||
!verticalScrollbar()->shouldParticipateInHitTesting()) &&
verticalScrollbar()->isOverlayScrollbar()) {
return 0;
}
return verticalScrollbar()->scrollbarThickness();
......@@ -1313,10 +1322,16 @@ int PaintLayerScrollableArea::horizontalScrollbarHeight(
OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
if (!hasHorizontalScrollbar())
return 0;
if ((horizontalScrollbar()->isOverlayScrollbar() ||
box().style()->overflowX() == EOverflow::kOverlay) &&
(overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize ||
!horizontalScrollbar()->shouldParticipateInHitTesting())) {
if (overlayScrollbarClipBehavior ==
IgnorePlatformAndCSSOverlayScrollbarSize &&
box().style()->overflowX() == EOverflow::kOverlay) {
return 0;
}
if ((overlayScrollbarClipBehavior == IgnorePlatformOverlayScrollbarSize ||
overlayScrollbarClipBehavior ==
IgnorePlatformAndCSSOverlayScrollbarSize ||
!horizontalScrollbar()->shouldParticipateInHitTesting()) &&
horizontalScrollbar()->isOverlayScrollbar()) {
return 0;
}
return horizontalScrollbar()->scrollbarThickness();
......
......@@ -356,9 +356,11 @@ class CORE_EXPORT PaintLayerScrollableArea final
int pixelSnappedScrollHeight() const;
int verticalScrollbarWidth(
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
int horizontalScrollbarHeight(
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const override;
OverlayScrollbarClipBehavior =
IgnorePlatformOverlayScrollbarSize) const override;
DoubleSize adjustedScrollOffset() const {
return toDoubleSize(DoublePoint(scrollOrigin()) + m_scrollOffset);
......
......@@ -43,8 +43,12 @@ inline ScrollOffset toScrollOffset(const FloatPoint& p) {
return ScrollOffset(p.x(), p.y());
}
// Platform overlay scrollbars are controlled and painted by the operating
// system (e.g., OSX and Android). CSS overlay scrollbars are created by
// setting overflow:overlay, and they are painted by chromium.
enum OverlayScrollbarClipBehavior {
IgnoreOverlayScrollbarSize,
IgnorePlatformOverlayScrollbarSize,
IgnorePlatformAndCSSOverlayScrollbarSize,
ExcludeOverlayScrollbarSizeForHitTesting
};
......
......@@ -635,7 +635,7 @@ float ScrollableArea::pixelStep(ScrollbarOrientation) const {
int ScrollableArea::verticalScrollbarWidth(
OverlayScrollbarClipBehavior behavior) const {
DCHECK_EQ(behavior, IgnoreOverlayScrollbarSize);
DCHECK_EQ(behavior, IgnorePlatformOverlayScrollbarSize);
if (Scrollbar* verticalBar = verticalScrollbar())
return !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
return 0;
......@@ -643,7 +643,7 @@ int ScrollableArea::verticalScrollbarWidth(
int ScrollableArea::horizontalScrollbarHeight(
OverlayScrollbarClipBehavior behavior) const {
DCHECK_EQ(behavior, IgnoreOverlayScrollbarSize);
DCHECK_EQ(behavior, IgnorePlatformOverlayScrollbarSize);
if (Scrollbar* horizontalBar = horizontalScrollbar())
return !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
return 0;
......
......@@ -335,9 +335,9 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin,
IntSize excludeScrollbars(const IntSize&) const;
virtual int verticalScrollbarWidth(
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
OverlayScrollbarClipBehavior = IgnorePlatformOverlayScrollbarSize) const;
virtual int horizontalScrollbarHeight(
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
OverlayScrollbarClipBehavior = IgnorePlatformOverlayScrollbarSize) const;
// Returns the widget associated with this ScrollableArea.
virtual FrameViewBase* getFrameViewBase() { return nullptr; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment