Closed Bug 1384839 Opened 7 years ago Closed 7 years ago

Support mask in layers-free mode

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: ethlin, Assigned: ethlin)

References

Details

Attachments

(4 files)

I will create webrender commands for nsDisplayMask in this bug. In the original path, there are many checks to decide if we should create a mask layer. I guess that's because we don't want to keep creating/deleting layers. Layers-free mode doesn't have this problem. I will try to always create wr mask.
I checked the tests in layout/reftests/w3c-css/submitted/masking. In layers-free mode, the original result is "Successful: 11, Unexpected: 82". After adding the mask support, the result is "Successful: 56, Unexpected: 37". Some failures are about nsDisplayFilter. I will have another bug for nsDisplayFilter.
Comment on attachment 8891911 [details]
Bug 1384839 - Part1. Extract the generation of fallback data from PushItemAsImage into a helper function to reuse it for mask painting.

https://reviewboard.mozilla.org/r/162928/#review168310

::: commit-message-556f1:1
(Diff revision 1)
> +Bug 1384839 - Part1. Move the generating of fallback data to another function from PushItemAsImage for mask. r=kats

This commit message could be worded better. Something like "Extract the generation of fallback data from PushItemAsImage into a helper function to reuse it for mask painting"

::: gfx/layers/wr/WebRenderLayerManager.cpp
(Diff revision 1)
>          lastAsr = asr;
>          mLayerScrollData.emplace_back();
>          mLayerScrollData.back().Initialize(mScrollData, item);
>        }
>      }
> -

Spurious line removal, please put it back or I'm going to have to manually rebase my other patches that touch this code :(
Attachment #8891911 - Flags: review?(bugmail) → review+
Comment on attachment 8891912 [details]
Bug 1384839 - Part2. Add BuildWrMaskImage() for creating WrImageMask.

https://reviewboard.mozilla.org/r/162930/#review168312
Attachment #8891912 - Flags: review?(bugmail) → review+
Comment on attachment 8891913 [details]
Bug 1384839 - Part3. Implement nsDisplayMask::CreateWebRenderCommands.

https://reviewboard.mozilla.org/r/162932/#review168314

::: layout/painting/nsDisplayList.cpp:8844
(Diff revision 1)
> +  Maybe<wr::WrImageMask> mask = aManager->BuildWrMaskImage(this, aBuilder, aSc, aDisplayListBuilder, bounds);
> +  if (mask) {
> +    aBuilder.PushClip(aSc.ToRelativeLayoutRect(bounds), mask.ptr());
> +  }
> +
> +  nsDisplayWrapList::CreateWebRenderCommands(aBuilder, aSc, aParentCommands, aManager, aDisplayListBuilder);

s/nsDisplayWrapList/nsDisplaySVGEffects/ just to be safe. If we implement CreateWebRenderCommands on nsDisplaySVGEffects we'll want to call that one rather than skipping past it up to the nsDisplayWrapList.
Attachment #8891913 - Flags: review?(bugmail) → review+
Comment on attachment 8891914 [details]
Bug 1384839 - Part4. Use A8 format when painting mask image.

https://reviewboard.mozilla.org/r/162934/#review168316
Attachment #8891914 - Flags: review?(bugmail) → review+
Pushed by ethlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7266739602ca
Part1. Extract the generation of fallback data from PushItemAsImage into a helper function to reuse it for mask painting. r=kats
https://hg.mozilla.org/integration/autoland/rev/8a64c01f5411
Part2. Add BuildWrMaskImage() for creating WrImageMask. r=kats
https://hg.mozilla.org/integration/autoland/rev/0f775046102c
Part3. Implement nsDisplayMask::CreateWebRenderCommands. r=kats
https://hg.mozilla.org/integration/autoland/rev/8086b15aa74b
Part4. Use A8 format when painting mask image. r=kats
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: