Closed Bug 1878294 Opened 1 year ago Closed 1 year ago

SVG is blurred during CSS transform

Categories

(Core :: Graphics: WebRender, defect, P3)

Firefox 122
defect

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox124 --- wontfix
firefox125 --- fixed

People

(Reporter: max_sommerfeld, Assigned: tnikkel)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(2 files)

Attached image test_blurred_svg.jpg

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

  1. Go to: https://www.spreadshirt.de/selbst-gestalten?productType=127&view=1&draft=jnJMaepMkaI8BvezXrrW&affiliateId=1246955&orgn=CYO&netw=OT
  2. Move the design of the dog around

Actual results:

The image and text are blurred while moving.

Expected results:

Just like in Safari or Chrome, image and text should not be blurred.

Status: UNCONFIRMED → NEW
Component: Untriaged → Graphics: WebRender
Ever confirmed: true
Product: Firefox → Core
Regressed by: 1761770

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

:nical, since you are the author of the regressor, bug 1761770, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(nical.bugzilla)

Looks like the site changes the translate only svg transform attribute on an element. This triggers a call into the ActiveLayerTracker

https://searchfox.org/mozilla-central/rev/5eedf36dc46f1683af7478c7adaf308ceb42911b/layout/painting/ActiveLayerTracker.cpp#226

it's not a regular css transform so we don't detect it and think it's been removed and increment the activity count. We should check if we detected a previous scale before incrementing.

Assignee: nobody → tnikkel
Flags: needinfo?(nical.bugzilla)

So we just need to change that code to call nsIFrame::IsTransformed() instead.

The bug comes about because the svg transform is changed, so IncrementScaleRestyleCountIfNeeded gets called. It determines that there is no transform because it doesn't check svg transforms, so it incorrectly concludes that there was a transform but now it was removed, and so marks the scale as having been changed. Then in ChooseScale in StackingContextHelper, because we think the scale is being animated, we clamp the allowed scale factor based on the ratio of the viewport and the size of the svg. So avoiding marking this as incorrectly having an animating scale fixes the bug.

A simpler fix for this bug would be to check if the mPreviousTransformScale was Nothing() and only marked as mutated if it was Some.

This fix is a bit more complicated but it allows us to detect svg transform scales changing.

(In reply to Robert Longson [:longsonr] from comment #5)

FWIW I did try that: https://treeherder.mozilla.org/jobs?repo=try&revision=1a5e85f3148c75d1223465c2ead62ea6b90e106e&selectedTaskRun=OS4Q1m4CQ4K6Jpt9Kx3Bkg.0 We may need to make one reftest fuzzier.

Yeah, I ran into the same reftest with my first fix (checking if the previous scale was Nothing before marking as mutated, slightly different idea from yours but more or less the same end result). I think the fuzziness is actually probably okay (ideally we'd fix it, but I don't think it's the fault of this patch), but I uploaded a better fix that, mostly by luck, doesn't run into that issue: the arrows that get fuzzier in that reftest actually have their scale changing slightly (because of the skew transform I guess?) and so if we detect svg transform scales then we again go back to marking these elements as active.

Blocks: 1689989

Tim, can you apply Priority/Severity settings to this report, please?

Flags: needinfo?(tnikkel)
Severity: -- → S3
Flags: needinfo?(tnikkel)
Priority: -- → P3

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

Tim, is the attached patch something that we can land soon, or is more work required on this one?

Flags: needinfo?(tnikkel)

It needs a test. I actually wrote one yesterday and am I just working with try server to fine tune it into a usable final result.

There is a long history of ChooseScale fixes like this one, and it can be hard to keep all the requirements for the function in your head, so in order to keep the space reasonable to work in I feel automated tests are very important.

Flags: needinfo?(tnikkel)
Pushed by tnikkel@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/28daa2e42bd0 Teach the scale tracking in ActiveLayerTracker to understand svg transforms. r=longsonr
Regressions: 1882544
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
Duplicate of this bug: 1689989

Is this worth a Beta uplift request?

Flags: needinfo?(tnikkel)

I think it's fine to ride the trains.

Flags: needinfo?(tnikkel)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: