Commit f222ad13 authored by Xianzhu Wang's avatar Xianzhu Wang

[PE] ClipPath should clear tight flag of clip rect

ClipPath in a ClipPaintPropertyNode may clip off pixels within the clip
bounds, so the result clip rect should clear the tight flag.

During raster invalidation, we won't compare non-tight clip rects for
change of clip but will check the changed flag of the clip nodes to
ensure correct raster invalidation.

Bug: 845269
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I41e48e3eb15232d6cf88bd8986df5c3d8075d7db
Reviewed-on: https://chromium-review.googlesource.com/1069671
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarTien-Ren Chen <trchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560968}
parent f0cb06d2
......@@ -1412,6 +1412,7 @@ Bug(none) paint/invalidation/media-audio-no-spurious-repaints.html [ Failure ]
Bug(none) paint/invalidation/subpixel-shadow-included-in-invalidation.html [ Failure ]
Bug(none) paint/invalidation/background/body-background-image.html [ Failure ]
Bug(none) paint/invalidation/clip/clip-path-constant-repaint.html [ Failure ]
Bug(none) paint/invalidation/clip/clip-path-in-mask-layer.html [ Failure ]
Bug(none) paint/invalidation/reflection/scroll-fixed-layer-with-reflection.html [ Failure ]
Bug(none) paint/invalidation/reflection/scroll-fixed-reflected-layer.html [ Failure ]
Bug(none) svg/transforms/text-with-mask-with-svg-transform.svg [ Failure ]
......
......@@ -9,12 +9,12 @@
{
"object": "LayoutBlockFlow DIV id='target'",
"rect": [8, 8, 200, 100],
"reason": "geometry"
"reason": "paint property change"
},
{
"object": "LayoutBlockFlow DIV id='target'",
"rect": [108, 8, 100, 100],
"reason": "incremental"
"rect": [8, 8, 100, 100],
"reason": "paint property change"
}
]
}
......
......@@ -8,13 +8,13 @@
"paintInvalidations": [
{
"object": "LayoutSVGContainer g",
"rect": [0, 100, 200, 100],
"reason": "incremental"
"rect": [0, 0, 200, 200],
"reason": "paint property change"
},
{
"object": "LayoutSVGContainer g",
"rect": [100, 0, 100, 100],
"reason": "incremental"
"rect": [0, 0, 100, 100],
"reason": "paint property change"
}
]
}
......
......@@ -8,13 +8,13 @@
"paintInvalidations": [
{
"object": "LayoutSVGContainer g",
"rect": [0, 100, 200, 100],
"reason": "incremental"
"rect": [0, 0, 200, 200],
"reason": "paint property change"
},
{
"object": "LayoutSVGContainer g",
"rect": [100, 0, 100, 100],
"reason": "incremental"
"rect": [0, 0, 100, 100],
"reason": "paint property change"
}
]
}
......
......@@ -25,7 +25,14 @@
"maskLayer": [
{
"name": "Mask Layer",
"bounds": [800, 300]
"bounds": [800, 300],
"paintInvalidations": [
{
"object": "Mask Layer",
"rect": [0, 0, 800, 300],
"reason": "paint property change"
}
]
}
],
"transform": 2
......
<!DOCTYPE html>
<div style="width: 200px; height: 200px; background: blue"></div>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutBlockFlow DIV",
"position": [8, 8],
"bounds": [200, 200],
"backgroundColor": "#0000FF",
"paintInvalidations": [
{
"object": "LayoutBlockFlow DIV",
"rect": [0, 0, 200, 200],
"reason": "full"
}
],
"maskLayer": [
{
"name": "Mask Layer",
"bounds": [200, 200],
"paintInvalidations": [
{
"object": "Mask Layer",
"rect": [0, 0, 200, 200],
"reason": "paint property change"
}
]
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutBlockFlow DIV",
"reason": "full"
}
]
}
<!DOCTYPE html>
<script src="../resources/text-based-repaint.js"></script>
<svg viewBox="0 0 1 1" style="position: absolute; width: 0; height: 0">
<clipPath id="clip" clipPathUnits='objectBoundingBox'>
<path id="path" d="M0 0 L1 1 L0 1 Z"/>
</clipPath>
</svg>
<div style="width: 200px; height: 200px; background: blue; clip-path: url(#clip); will-change: transform"></div>
<script>
function repaintTest() {
path.setAttribute('d', 'M0 0 L1 0 L1 1 L0 1 Z');
}
onload = runRepaintAndPixelTest;
</script>
......@@ -20,12 +20,12 @@
{
"object": "LayoutBlockFlow DIV id='target'",
"rect": [8, 8, 200, 100],
"reason": "geometry"
"reason": "paint property change"
},
{
"object": "LayoutBlockFlow DIV id='target'",
"rect": [108, 8, 100, 100],
"reason": "incremental"
"rect": [8, 8, 100, 100],
"reason": "paint property change"
}
]
}
......
......@@ -19,13 +19,13 @@
"paintInvalidations": [
{
"object": "LayoutSVGContainer g",
"rect": [0, 100, 200, 100],
"reason": "incremental"
"rect": [0, 0, 200, 200],
"reason": "paint property change"
},
{
"object": "LayoutSVGContainer g",
"rect": [100, 0, 100, 100],
"reason": "incremental"
"rect": [0, 0, 100, 100],
"reason": "paint property change"
}
]
}
......
......@@ -19,13 +19,13 @@
"paintInvalidations": [
{
"object": "LayoutSVGContainer g",
"rect": [0, 100, 200, 100],
"reason": "incremental"
"rect": [0, 0, 200, 200],
"reason": "paint property change"
},
{
"object": "LayoutSVGContainer g",
"rect": [100, 0, 100, 100],
"reason": "incremental"
"rect": [0, 0, 100, 100],
"reason": "paint property change"
}
]
}
......
......@@ -23,8 +23,8 @@
"reason": "full"
},
{
"object": "LayoutSVGRect rect id='rect1'",
"rect": [10, 10, 200, 100],
"object": "LayoutSVGRect rect id='rect2'",
"rect": [10, 130, 200, 100],
"reason": "paint property change"
},
{
......@@ -33,14 +33,14 @@
"reason": "paint property change"
},
{
"object": "LayoutSVGRect rect id='rect2'",
"rect": [110, 130, 100, 100],
"reason": "incremental"
"object": "LayoutSVGRect rect id='rect1'",
"rect": [10, 10, 200, 100],
"reason": "paint property change"
},
{
"object": "LayoutSVGRect rect id='rect2'",
"rect": [10, 130, 100, 100],
"reason": "full"
"reason": "paint property change"
},
{
"object": "LayoutSVGRect rect id='rect1'",
......
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutBlockFlow DIV",
"position": [8, 8],
"bounds": [200, 200],
"backgroundColor": "#0000FF",
"paintInvalidations": [
{
"object": "LayoutBlockFlow DIV",
"rect": [0, 0, 200, 200],
"reason": "full"
}
],
"maskLayer": [
{
"name": "Mask Layer",
"bounds": [200, 200],
"paintInvalidations": [
{
"object": "LayoutBlockFlow DIV",
"rect": [0, 0, 200, 200],
"reason": "full"
}
]
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutBlockFlow DIV",
"reason": "full"
}
]
}
......@@ -287,12 +287,15 @@ FloatClipRect GeometryMapper::LocalToAncestorClipRect(
return result;
}
static const FloatRoundedRect& GetClipRect(
const ClipPaintPropertyNode* clip_node,
OverlayScrollbarClipBehavior clip_behavior) {
return UNLIKELY(clip_behavior == kExcludeOverlayScrollbarSizeForHitTesting)
? clip_node->ClipRectExcludingOverlayScrollbars()
: clip_node->ClipRect();
static FloatClipRect GetClipRect(const ClipPaintPropertyNode* clip_node,
OverlayScrollbarClipBehavior clip_behavior) {
FloatClipRect clip_rect(
UNLIKELY(clip_behavior == kExcludeOverlayScrollbarSizeForHitTesting)
? clip_node->ClipRectExcludingOverlayScrollbars()
: clip_node->ClipRect());
if (clip_node->ClipPath())
clip_rect.ClearIsTight();
return clip_rect;
}
FloatClipRect GeometryMapper::LocalToAncestorClipRectInternal(
......@@ -310,7 +313,7 @@ FloatClipRect GeometryMapper::LocalToAncestorClipRectInternal(
if (descendant->Parent() == ancestor_clip &&
descendant->LocalTransformSpace() == ancestor_transform) {
success = true;
return FloatClipRect(GetClipRect(descendant, clip_behavior));
return GetClipRect(descendant, clip_behavior);
}
FloatClipRect clip;
......
......@@ -384,6 +384,23 @@ TEST_P(GeometryMapperTest, RoundedClip) {
CHECK_MAPPINGS();
}
TEST_P(GeometryMapperTest, ClipPath) {
FloatRoundedRect rect(FloatRect(10, 10, 50, 50),
FloatRoundedRect::Radii(FloatSize(1, 1), FloatSize(),
FloatSize(), FloatSize()));
auto clip = CreateClipPathClip(ClipPaintPropertyNode::Root(),
TransformPaintPropertyNode::Root(),
FloatRoundedRect(10, 10, 50, 50));
local_state.SetClip(clip.get());
input_rect = FloatRect(0, 0, 100, 100);
expected_transformed_rect = input_rect;
expected_clip = FloatClipRect(FloatRect(10, 10, 50, 50));
expected_clip.ClearIsTight();
expected_visual_rect = expected_clip;
CHECK_MAPPINGS();
}
TEST_P(GeometryMapperTest, TwoClips) {
FloatRoundedRect clip_rect1(
FloatRect(10, 10, 30, 40),
......
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