Unify most clip-path code paths of pre-CAP and CAP #24440
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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}