Bug 1650504 [wpt PR 24440] - Unify most clip-path code paths of pre-CAP and CAP, a=testonly

Automatic update from web-platform-tests
Unify most clip-path code paths of pre-CAP and CAP

Previously in pre-CAP, because we always created a composited mask
layer for any mask and/or clip-path (either path-based or mask-based)
if the object needed to be composited, we needed to handle clip-path
differently in pre-CAP and CAP,

Now always apply path-based clip-path after paint. No longer create
a mask layer for path-based clip-path in pre-CAP.

Rename ClipPath to ClipPathMask to make it clear that this effect node
is for the mask created for a mask-based clip-path.

If there are both mask and mask-based clip-path, always let ClipPathMask
effect node be the child of the Mask effect node. This is required by
pre-CAP (unchanged) to apply the clip-path in the mask layer, but also
works in CAP (previously both Mask ClipPathMask were directly under
Effect) because:
     DstIn(DstIn(A, Mask), ClipPathMask)
  == DstIn(A, DstIn(Mask, ClipPathMask)
where ClipPathMask is black-and-white.

If there is only a mask-based clip-path, we'll only create ClipPathMask
for both pre-CAP (now no Mask and MaskClip nodes) and CAP (unchanged).
The pre-CAP mask layer will use ClipPathMask as the effect state, which
avoids the need of filling a black mask before applying the clip path
mask.

Now the only difference between pre-CAP and CAP about clip-path is that
that when a LayerObject with mask-based clip-path is composited, pre-CAP
creates a GraphicsLayer for the clip-path mask before paint, while CAP
creates a cc::Layer for the mask after paint.

Bug: 1100224
Change-Id: I243e463b3c94e09b64ed3c171ece12145c9deec9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274177
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785435}

--

wpt-commits: 3d92704499a679683fb03500ceeeaef6ad652676
wpt-pr: 24440
This commit is contained in:
Xianzhu Wang 2020-07-09 14:13:47 +00:00 коммит произвёл moz-wptsync-bot
Родитель 8fef3ebf49
Коммит 6f81979165
3 изменённых файлов: 53 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,21 @@
<!DOCTYPE html>
<style>
html {
background: red;
/* an "L" shape */
clip-path: polygon(50px 50px, 100px 50px, 100px 100px, 150px 100px, 150px 150px, 50px 150px);
will-change: transform;
}
div {
width: 500px;
height: 500px;
background: green;
}
</style>
<link rel="help" href="http://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="help" href="https://drafts.fxtf.org/compositing/#rootgroup">
<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop">
<link rel="match" href="reference/clip-path-document-element-ref.html">
<meta name="assert" content="Clip-path on the document element applies to the root background.
The test passes if there is a green 'L' shape without red.">
<div></div>

Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<style>
html {
background: red;
/* an "L" shape */
clip-path: polygon(50px 50px, 100px 50px, 100px 100px, 150px 100px, 150px 150px, 50px 150px);
}
div {
width: 500px;
height: 500px;
background: green;
}
</style>
<link rel="help" href="http://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="help" href="https://drafts.fxtf.org/compositing/#rootgroup">
<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop">
<link rel="match" href="reference/clip-path-document-element-ref.html">
<meta name="assert" content="Clip-path on the document element applies to the root background.
The test passes if there is a green 'L' shape without red.">
<div></div>

Просмотреть файл

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
div {
position: absolute;
width: 50px;
height: 50px;
background: green;
}
</style>
<div style="top: 50px; left: 50px"></div>
<div style="top: 100px; left: 50px"></div>
<div style="top: 100px; left: 100px"></div>