Closed Bug 1594302 Opened 5 years ago Closed 2 years ago

Investigate if we can remove the clear primitive from webrender

Categories

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

Unspecified
Windows
task

Tracking

()

RESOLVED WONTFIX

People

(Reporter: gw, Unassigned)

References

Details

WR has a Clear primitive that uses a special blend mode to erase the current content of the framebuffer. The blend mode is different than every other primitive in WR, and it adds quite a bit of complexity to the WR rendering code.

Additionally, it doesn't work as intended when using a native compositor, where it's not feasible to erase content due to the multiple cached slices.

It was previously used on Mac for the vibrancy effect, but is no longer required for that (as of https://bugzilla.mozilla.org/show_bug.cgi?id=1592739 landing in m-c). There is (I think!) only one remaining use of the Clear primitive - related to drawing the toolbar buttons on Win7 machines. If we can remove this usage, we can completely remove Clear primitives from WR.

So, we'd need to:

  • Verify that Win7 close buttons are the only thing using this primitive type.
  • Find out why they require the clear primitive.
  • Evaluate other options we could use to avoid the clear primitive.
  • (If feasible) Remove the usage in Gecko, and all the Clear primitive code in WR.
OS: Unspecified → Windows
Priority: -- → P3
Depends on: 1415070

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

  • Verify that Win7 close buttons are the only thing using this primitive type.

I can vouch for this - the Win7 window buttons really are the only thing using this primitive type.

  • Find out why they require the clear primitive.

Windows 7 renders the window buttons (minimize, maximize, close) underneath our rendering. Our rendering on Windows 7 sometimes includes opaque background colors (set by frontend CSS, for example for lightweight themes) or a white glass "fog". The only way to make the native window buttons visible is to clear away that rendering again so that the buttons from underneath are revealed.

  • Evaluate other options we could use to avoid the clear primitive.

We could give WebRender a global "cutout region" or "cutout rect".
At the moment, the clear item is clipped to rounded corners, because the shape of the window buttons has rounded bottom corners. But it's not worth worrying about the rounding. A rectangle with square corners would be totally sufficient.

  • (If feasible) Remove the usage in Gecko, and all the Clear primitive code in WR.

If the new solution does not require any WebRender display items, we can also remove the widget method AddWindowOverlayWebRenderCommands.

We need to keep this for Win7 support. At some point in the future if Win7 is no longer supported, we could consider removal of the Clear prim then.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.