Closed Bug 1894546 Opened 3 months ago Closed 7 days ago

No longer possible to draw SVG image into canvas element when content visibility is auto

Categories

(Core :: SVG, defect, P3)

Firefox 125
defect

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: ctumolosus, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Steps to reproduce:

Code sandbox reproducing the issue:
https://codesandbox.io/p/sandbox/ecstatic-water-forked-j77ht7?file=%2Fsrc%2Findex.mjs%3A42%2C3

Actual results:

SVG images that make use of <foreignObject> to rasterize HTML content no longer render nested HTML elements whose styles are set to "content-visibility: auto" after upgrading to Firefox 125.

Expected results:

Ideally, it should continue to rasterize elements styled with "content-visibility: auto" as it has been prior to this release.

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

Component: Untriaged → SVG
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true

Regression window w/ layout.css.content-visibility.enabled=true:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=1a33f2261018de20748b0f4ab09b8ddb4189ce86&tochange=daff4675a8d555acf048a4fa8d8861538bca3a47

Triggered by: c1e64e8e466506d1d9a36d747df25527bd545b10 Martin Robinson — Bug 1791759 - Add support for content-visibility: auto r=emilio

Blocks: 1791759

content-visibility was not released prior to Firefox 125. After it was released (or implemented in nightly in bug 1791759) elements with content-visibility: auto are not visible until they become relevant to the user. When these elements are wrapped in a SVG document that is rendered inline in the current HTML document, then proximity to the viewport explains why such elements are visible or not. But when the SVG is loaded from a <img> element and drawn in a canvas, it's less clear to me what makes relevant to the user. It seems Chromium renders the content-visibility: auto that way but Firefox and dev version of WebKit don't do that.

The severity field is not set for this bug.
:emilio, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Flags: needinfo?(emilio)

Yeah, off-hand this seems invalid, I don't see what in the spec would make an invisible image like that "relevant to the user". I guess we could say that an SVG-as-image docs make stuff always "relevant to the user"? But that seems wrong.

I filed https://github.com/w3c/csswg-drafts/issues/10347 about this.

Severity: -- → S3
Priority: -- → P3
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3bf0251f3de5
Treat content-visibility:auto as visible when document is being used as an image. r=layout-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/47112 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: