Closed Bug 1787623 Opened 2 years ago Closed 2 years ago

backdrop-filter: url(#svg-filter) causes the element to not render

Categories

(Core :: Graphics: WebRender, defect)

Firefox 104
defect

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- wontfix
firefox104 --- wontfix
firefox105 --- wontfix
firefox106 --- fixed

People

(Reporter: kyza, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

Attached image firefox_bug.png

Steps to reproduce:

  1. Create an SVG filter.
  2. Apply the SVG filter to the backdrop-filter of an element outside of the SVG.

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0

Issue Example: https://codepen.io/Kyza/pen/WNzqjML

Actual results:

The element does not render. Similar to opacity: 0.

Expected results:

The element renders with the appropriate filter from the SVG.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core

With WebRender and backdrop-filter force-enabled, I got this range with mozregression. Suspects include bug 1578777, bug 1581307. Botond, Sotaro, what do you think?

Flags: needinfo?(sotaro.ikeda.g)
Flags: needinfo?(botond)
Status: UNCONFIRMED → NEW
Ever confirmed: true

It's possible that we hit a path where we don't support that SVG filter on a backdrop-filter, and we should just drop the filter but render the rest of the content for now, at least. Any ideas if something like that might be happening Emilio?

Flags: needinfo?(emilio)
Severity: -- → S3

(In reply to Gregory Pappas from comment #2)

With WebRender and backdrop-filter force-enabled, I got this range with mozregression. Suspects include bug 1578777, bug 1581307. Botond, Sotaro, what do you think?

bug 1581307 does not change a behavior. It seems not related to this problem.

Flags: needinfo?(sotaro.ikeda.g)

So, that's already what's happening for some unsupported backdrop-filters:

However in this case we hit the !initialized code-path below:

Because we hit this code-path in SVGFilterInstance:

Same happens if we replace backdrop-filter with just filter.

So there are two issues:

  • Invalid filters should probably not paint nothing, that's also true of masks, see bug 1483225. That's what Chrome does in the test-case if you use filter rather than backdrop-filter.
  • Not sure how we should treat the BackgroundImage / BackgroundAlpha filter input, maybe we should treat it as SourceImage / SourceAlpha when using backdrop-filter? Markus seems familiar with this code, do you know (when you have the time / are back from PTO)?
Flags: needinfo?(emilio) → needinfo?(mstange.moz)

(In reply to Gregory Pappas from comment #2)

With WebRender and backdrop-filter force-enabled, I got this range with mozregression. Suspects include bug 1578777, bug 1581307. Botond, Sotaro, what do you think?

This does seem to be a regression from bug 1578777.

The culprit appears to be https://phabricator.services.mozilla.com/D46060, which was intended to be just a refactoring, but accidentally introduced a functional change: it factored out a helper function to be shared by nsDisplayFilters::CanCreateWebRenderCommands and nsDisplayBackdropFilters::CanCreateWebRenderCommands, without realizing that the first was looking at StyleEffects()->mFilters and the second was looking at StyleEffects()->mBackdropFilters. The helper function looked at StyleEffects()->mFilters, thereby giving an incorrect answer when called from nsDisplayBackdropFilters::CanCreateWebRenderCommands.

The effect of this function was to gate the creation of an nsDisplayBackdropFilters display item.

That condition was removed in bug 1423746, whose commit message includes:

Remove the BackdropFilters::CanCreateWebrenderCommands call because it
was testing for StyleSVGEffects::mFilters rather than mBackdropFilters,
so it was doing nothing.

I suspect that the correct implementation returned false at the time, thereby inhibiting the creation of an nsDisplayBackdropFilters display item, and resulting in rendering the element without the backdrop filter.

Flags: needinfo?(botond)
Regressed by: 1578777

Set release status flags based on info from the regressing bug 1578777

Assignee: nobody → botond
Attachment #9292374 - Attachment is obsolete: true
Attachment #9292441 - Attachment description: Bug 1787623 - Make invalid filters paint the unfiltered frame. r=botond,tnikkel → Bug 1787623 - Make invalid and unsupported filters paint the unfiltered frame. r=botond,tnikkel
Assignee: botond → emilio
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b134d587690d Make invalid and unsupported filters paint the unfiltered frame. r=botond
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/35775 for changes under testing/web-platform/tests

Backed out changeset b134d587690d (Bug 1787623) for causing reftest failures on filter-basic-01.svg.
Backout link
Push with failures <--> Rs7
Failure Log

Flags: needinfo?(emilio)
Upstream PR was closed without merging
Attachment #9292441 - Attachment description: Bug 1787623 - Make invalid and unsupported filters paint the unfiltered frame. r=botond,tnikkel → Bug 1787623 - Make invalid and unsupported filters paint the unfiltered frame. r=botond
Flags: needinfo?(mstange.moz)
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c3d6bd944022 Make invalid and unsupported filters paint the unfiltered frame. r=botond

Backed out for causing mochitest failures on test_filter_crossorigin.html . CLOSED TREE
Backout link
Push with failures
Backfill range
Link to failure log
Failure line : TEST-UNEXPECTED-FAIL | layout/svg/tests/test_filter_crossorigin.html | reftest comparison: == Testcase loaded from mochi.test Reference: black/yellow

Flags: needinfo?(emilio)
Upstream PR was closed without merging

Third time's the charm.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/06480f550b00 Make invalid and unsupported filters paint the unfiltered frame. r=botond
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
Upstream PR merged by moz-wptsync-bot

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox105 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(emilio)

It's non-trivial and not a regression so probably not, but please feel free to request uplift if you disagree.

Flags: needinfo?(emilio)
Blocks: 1802459
Duplicate of this bug: 1665047
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: