Closed Bug 1671784 Opened 4 years ago Closed 1 year ago

Rotate clip-path background (CSS) will render outlines of element from ff82

Categories

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

Firefox 82
defect

Tracking

()

VERIFIED FIXED
119 Branch
Tracking Status
firefox-esr78 --- disabled
firefox-esr102 --- wontfix
firefox-esr115 --- wontfix
firefox81 --- wontfix
firefox82 --- wontfix
firefox83 --- wontfix
firefox84 --- wontfix
firefox85 --- wontfix
firefox86 --- wontfix
firefox117 --- wontfix
firefox118 --- wontfix
firefox119 --- verified
firefox120 --- verified

People

(Reporter: u672315, Assigned: gw)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(8 files)

Attached file test.html

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

Steps to reproduce:

"Transform rotate" an element with clip-path background, bug appears from FF82beta and in FF83.0a1, see test file and screenshots.

Actual results:

Outlines of element start to show

On FF 81 it is not detected with webrender off.
On FF 82 and 83 with both webrender on or off, if not initially, they will appear when for example the window is "dragged to another size"

Expected results:

Outlines of element should not show

Attached image ff83-before.PNG
Attached image ff83-after.PNG
Attached image ff83-WebRend-on.PNG

I can reproduce on Nightly83.0a1 Windows10.

Status: UNCONFIRMED → NEW
Component: Untriaged → Web Painting
Ever confirmed: true
Product: Firefox → Core
Has Regression Range: --- → yes
Component: Web Painting → Graphics: WebRender
Flags: needinfo?(gwatson)
Has STR: --- → yes
OS: Unspecified → All
Hardware: Unspecified → All
Assignee: nobody → gwatson
Flags: needinfo?(gwatson)

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Severity: -- → N/A
Flags: needinfo?(jmathies)
Priority: -- → P3

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Severity: N/A → S4
Flags: needinfo?(jmathies)

(In reply to papoxa8620 from comment #8)

Any news on this one?

The best fix for this will be to ensure that the off-screen surface establishes a raster root, and the image clip mask gets applied in that local space before being drawn in to the parent picture.

The first step of that work is https://bugzilla.mozilla.org/show_bug.cgi?id=1696842 - this ensures that all off-screen surfaces establish a raster root. However, that patch was backed out for causing some unexpected performance regressions, which need further investigation before that can be re-landed.

See Also: → 1758615

All the work to make off-screen surfaces establish raster roots has landed now, so I'll take a look again at this and see why it still happens.

The issue is that the clip-mask is applied in the post-transform space, which is causing accuracy issues (since it's applied on the WR stacking context, not the primitive).

There's a couple of options here:

  1. Try to be more accurate in handling clip-mask edges when there is a non-axis-aligned transform present.
  2. Have the clip-mask be applied in the local space of the off-screen surface, so it's axis-aligned with the content it is masking.

(1) is likely to be a smaller change, but difficult to get 100% right - we could probably get it mostly right, but there will still be edge cases that are difficult to get pixel-perfect. (2) is a much better solution, it will give pixel-perfect results, but I'm not sure if this is a complex change to make.

Next step will be to look in to what's involved in option (2) and see how much work would be involved to do this.

A third option:

Make the clip-mask implementation instead be a filter-style property in the WR API. This would implicitly mean the mask is applied in the same local space as the stacking context, prior to the transform being applied.

Assignee: gwatson → ahale
Status: NEW → ASSIGNED

Looking at how I can fix this bug, expect some questions and rambles on what I learn :)

Current plan of attack (per discussion with :gw ) - implement new filter type (Filter::ImageMask) to apply a clip mask in the shader in a better way that won't have this class of rendering artifact.

Rough steps planned so far:

  • Prepare a wrench reftests yaml file with help from :gw to test the new filter (done).
  • Stub out the new filter case in each place it is used (done).
  • Implement the stubs for the filter that are hit in testing.
  • Make a list of stubs not hit by any tests, as these may indicate missing test coverage.
  • Implement the new filter in the shader code, hooking up a new sampler for the mask.
  • Add a config variable for whether to use the new filter type for clip masks and make the code conditional on that.
  • Change the way clipmasks are fed to WebRender to use the new filter type (based on the config variable).
  • Verify reftests work correctly.
  • ?

The severity field for this bug is relatively low, S4. However, the bug has 5 duplicates.
:ahale, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(ahale)

Increased severity due to 5 duplicate bugs.

Severity: S4 → S3
Flags: needinfo?(ahale)
Blocks: 1782590
Depends on: 1784382
Depends on: 1784383

Putting clipped or masked element in .parent { border-radius: 0.01px; overflow: hidden; } removes the outline.

That seems like a novel workaround, my focus however is on making it look right every time without workarounds :)

Status: Nearly looks right with my code changes, but there are polygon gaps between ImageMask tiles at some scroll offsets and zoom levels, so there's something doing some coordinate rounding in the primitive handling that I need to fix.

(In reply to georg.pukk from comment #24)

Putting clipped or masked element in .parent { border-radius: 0.01px; overflow: hidden; } removes the outline.

Thanks for the workaround Georg (psst Ashley I think the workaround was aimed at devs struggling with the bug like me, not you as the assignee).

(In reply to georg.pukk from comment #24)

Putting clipped or masked element in .parent { border-radius: 0.01px; overflow: hidden; } removes the outline.

Seems like you mean to rotate the parent instead. However I found I also needed to add transform: rotate(0deg) to the child too to hide the artifact.

(In reply to mfishe from comment #27)

(In reply to georg.pukk from comment #24)

Putting clipped or masked element in .parent { border-radius: 0.01px; overflow: hidden; } removes the outline.

Seems like you mean to rotate the parent instead. However I found I also needed to add transform: rotate(0deg) to the child too to hide the artifact.

For me it works if I rotate the .child itself.
However, it seems that position other than static on either element also plays a role.

(In reply to georg.pukk from comment #28)

(In reply to mfishe from comment #27)

(In reply to georg.pukk from comment #24)

Putting clipped or masked element in .parent { border-radius: 0.01px; overflow: hidden; } removes the outline.

Seems like you mean to rotate the parent instead. However I found I also needed to add transform: rotate(0deg) to the child too to hide the artifact.

For me it works if I rotate the .child itself.
However, it seems that position other than static on either element also plays a role.

Ah yes, you are right. I had position: absolute on the .parent which was what made rotation by 0 necessary on the child.

For people looking for workarounds:
I managed to avoid this issue by applying {padding: 1px, margin: -1px} to the element with the clip-path and box-shadow: 0 0 1px transparent to the child.

Attached file mask-rotate.html

Reproduction using mask-image and rotate.

Here's the rendering of attached mask-rotate.html to showcase this bug is not limited to clip-path, but also happens when mask-image and tranform: rotate are applied together. Same use case renders without this subpixel "border" in Blink.

Attachment #9337736 - Attachment description: Rendering of mask-image and rotate → Rendering of mask-rotate.html

One the work in https://bugzilla.mozilla.org/show_bug.cgi?id=1823579 is complete, we should be in a much better position to fix this case. That work should be complete in the next 2-3 weeks.

Depends on: 1823579
Assignee: ahale → gwatson
Depends on: 1847472, 1847133
Depends on: 1848066
Depends on: 1849530
Depends on: 1849661

Both the repro in comment #1 and comment #36 appear fixed for me with the patches in #1849530 and #1849661 applied. There is a try build with these at [1] if anyone wants to do some local testing, build artifacts should be available soon.

I think there are still some other edge cases that can cause this to occur, but I will fix those if / when they are reported as separate bugs, which should be much simpler after the work done to fix this most common case.

[1] https://treeherder.mozilla.org/jobs?repo=try&revision=9d9c1d8c2dd5fbcc45726bb0afb9e5b04c8de5a9

Duplicate of this bug: 1822563

With the latest nightly (that contains the fix from bug 1849661), I can still repro the dotted lines on the first testcase by pinch-zooming and maybe panning on the image. It may also be dependent on some parts of the zoomed-out testcase being beyond the visible part of the page.
:gw, let me know if you want this to be tracked in a new bug.

Edit2: The second testcase also renders the dotted line with pinch-zoom and maybe some panning.

Attached image bug2.png

Yes, let's track that in a separate bug - I know what the cause is, and it's a different issue than what was resolved in this bug.

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
See Also: → 1850869

(In reply to Glenn Watson [:gw] from comment #42)

Yes, let's track that in a separate bug - I know what the cause is, and it's a different issue than what was resolved in this bug.

Filed bug 1850869

No longer duplicate of this bug: 1776809
See Also: → 1776809
No longer duplicate of this bug: 1757851
See Also: → 1757851
Flags: qe-verify+

Reproducible on a 2023-08-24 Nightly build on Windows 10.
Verified as fixed on Firefox 119.0b2(build ID: 20230928191344) and Nightly 120.0a1(build ID: 20230928215127) on Windows 10, macOS 12, Ubuntu 22.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
See Also: 1758615, 1776809, 1757851
Depends on: 1850869
See Also: 1850869
Duplicate of this bug: 1771911
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: