Removing layer backdrop filter breaks path-clipping

93 views
Skip to first unread message

Kamil Osuch

unread,
Sep 10, 2024, 12:01:50 PMSep 10
to Chromium-dev
Hi,
I encountered a problem with layers painting.

Scenario:
- View painting to a separate, non-opaque layer
- Add a clipping path
OK - View output is clipped as intended

- Add a layer backdrop filter (i.e. background blur)
OK - View output is clipped and the blur is applied

- Remove backdrop filters (i.e. set background blur to 0.f)
Error - Blur is removed, but the clipping is no longer applied.

I investigated this behavior and I found out that:
- adding a clipping path for a view with layer adds another mask layer
- adding a backdrop filter marks mask layer as BackdropFilterMask

See:
cc/trees/property_tree_builder.cc
PropertyTreeBuilderContext::AddEffectNodeIfNeeded(...)
  ...
  if (!node->backdrop_filters.IsEmpty() && layer->mask_layer()) {
    DCHECK(layer->mask_layer()->element_id());
    node->backdrop_mask_element_id = layer->mask_layer()->element_id();
    layer->mask_layer()->SetIsBackdropFilterMask(true);
  }
 
But removing all backdrop filters from a layer
doesn't call layer->mask_layer()->SetIsBackdropFilterMask(false) and clipping remains broken until adding a backdrop filter.

Is this intensional?

/KO
Reply all
Reply to author
Forward
0 new messages