Commit 7ac572d1 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[SPv175] Support incremental invalidation on scrolling contents layer

When the scrolling contents layer is resized and it paints the
background, we should invalidate the expanded/shrunk part of the
background. For SPv1 this is done by calling IncrementallyInvalidatePaint.
For SPv175 we need to pass kIncremental reason to PaintController.

Bug: 732611
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I501ed3e899282b31f4f9d461e23637ab1ca4460d
Reviewed-on: https://chromium-review.googlesource.com/749283Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513221}
parent 9bea4830
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutBlockFlow DIV id='container'",
"position": [8, 8],
"bounds": [400, 400],
"backgroundColor": "#0000FF"
},
{
"name": "Scrolling Layer",
"position": [8, 8],
"bounds": [400, 400],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"position": [8, 8],
"bounds": [400, 2000],
"contentsOpaque": true,
"backgroundColor": "#0000FF",
"paintInvalidations": [
{
"object": "Scrolling Contents Layer",
"rect": [0, 500, 400, 1500],
"reason": "incremental"
}
],
"transform": 1
},
{
"name": "Overflow Controls Host Layer",
"position": [8, 8],
"bounds": [400, 400],
"drawsContent": false
},
{
"name": "Horizontal Scrollbar Layer",
"position": [8, 408],
"bounds": [400, 0]
},
{
"name": "Vertical Scrollbar Layer",
"position": [408, 8],
"bounds": [0, 400]
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, -1600, 0, 1]
],
"flattenInheritedTransform": false
}
],
"objectPaintInvalidations": [
{
"object": "Scrolling Contents Layer",
"reason": "incremental"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutBlockFlow DIV id='container'",
"position": [8, 8],
"bounds": [400, 400],
"backgroundColor": "#0000FF"
},
{
"name": "Scrolling Layer",
"position": [8, 8],
"bounds": [400, 400],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"position": [8, 8],
"bounds": [400, 2000],
"contentsOpaque": true,
"backgroundColor": "#0000FF",
"paintInvalidations": [
{
"object": "Scrolling Contents Layer",
"rect": [0, 500, 400, 1500],
"reason": "incremental"
}
],
"transform": 1
},
{
"name": "Overflow Controls Host Layer",
"position": [8, 8],
"bounds": [400, 400],
"drawsContent": false
},
{
"name": "Horizontal Scrollbar Layer",
"position": [8, 408],
"bounds": [400, 0]
},
{
"name": "Vertical Scrollbar Layer",
"position": [408, 8],
"bounds": [0, 400]
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, -1600, 0, 1]
],
"flattenInheritedTransform": false
}
],
"objectPaintInvalidations": [
{
"object": "Scrolling Contents Layer",
"reason": "incremental"
}
]
}
...@@ -227,35 +227,38 @@ BoxPaintInvalidator::ComputeBackgroundInvalidation() { ...@@ -227,35 +227,38 @@ BoxPaintInvalidator::ComputeBackgroundInvalidation() {
} }
void BoxPaintInvalidator::InvalidateScrollingContentsBackground( void BoxPaintInvalidator::InvalidateScrollingContentsBackground(
BackgroundInvalidationType backgroundInvalidationType) { BackgroundInvalidationType background_invalidation_type) {
if (!BackgroundPaintsOntoScrollingContentsLayer()) if (!BackgroundPaintsOntoScrollingContentsLayer())
return; return;
if (backgroundInvalidationType == BackgroundInvalidationType::kNone) if (background_invalidation_type == BackgroundInvalidationType::kNone)
return; return;
// TODO(crbug.com/732611): Implement raster invalidation of background on PaintInvalidationReason reason;
// scrolling contents layer for SPv175. if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
if (!RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) { reason = background_invalidation_type == BackgroundInvalidationType::kFull
? PaintInvalidationReason::kBackgroundOnScrollingContentsLayer
: PaintInvalidationReason::kIncremental;
} else {
// For SPv1 we need this reason for both full and incremental invalidation
// to let ObjectPaintInvalidator::SetBackingNeedsPaintInvalidationInRect()
// know we are invalidating on the scrolling contents backing.
reason = PaintInvalidationReason::kBackgroundOnScrollingContentsLayer;
const LayoutRect& old_layout_overflow = box_.PreviousLayoutOverflowRect(); const LayoutRect& old_layout_overflow = box_.PreviousLayoutOverflowRect();
LayoutRect new_layout_overflow = box_.LayoutOverflowRect(); LayoutRect new_layout_overflow = box_.LayoutOverflowRect();
if (backgroundInvalidationType == BackgroundInvalidationType::kFull) { if (background_invalidation_type == BackgroundInvalidationType::kFull) {
ObjectPaintInvalidatorWithContext(box_, context_) ObjectPaintInvalidatorWithContext(box_, context_)
.FullyInvalidatePaint( .FullyInvalidatePaint(reason, old_layout_overflow,
PaintInvalidationReason::kBackgroundOnScrollingContentsLayer, new_layout_overflow);
old_layout_overflow, new_layout_overflow);
} else { } else {
IncrementallyInvalidatePaint( IncrementallyInvalidatePaint(reason, old_layout_overflow,
PaintInvalidationReason::kBackgroundOnScrollingContentsLayer, new_layout_overflow);
old_layout_overflow, new_layout_overflow);
} }
} }
context_.painting_layer->SetNeedsRepaint(); context_.painting_layer->SetNeedsRepaint();
// Currently we use CompositedLayerMapping as the DisplayItemClient to paint
// background on the scrolling contents layer.
ObjectPaintInvalidator(box_).InvalidateDisplayItemClient( ObjectPaintInvalidator(box_).InvalidateDisplayItemClient(
*box_.Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer(), *box_.Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer(),
PaintInvalidationReason::kBackgroundOnScrollingContentsLayer); reason);
} }
PaintInvalidationReason BoxPaintInvalidator::InvalidatePaint() { PaintInvalidationReason BoxPaintInvalidator::InvalidatePaint() {
......
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