Open Bug 1740266 Opened 3 years ago Updated 3 years ago

backface-visibility: hidden with rotateX(0) gives different results than Chrome

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

People

(Reporter: jrmuizel, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file Testcase

Load attached test case in Chrome and Safari vs Firefox

Flags: needinfo?(dmalyshau)
Severity: -- → S4

I looked at this. The DL passed to WR by Gecko seems weird if not totally wrong.
Here is the test case:

     PushStackingContext((
      origin: (0, 0),
      spatial_id: (4, (1, 2)),
      prim_flags: (
       bits: 1,
      ),
      stacking_context: (
       transform_style: Flat,
       mix_blend_mode: Normal,
       clip_id: Some(Clip(0, (1, 2))),
       raster_space: Screen,
       flags: (
        bits: 0,
       ),
      ),
     )),// [21]
     PushReferenceFrame(()),// [23]
     PushStackingContext((
      origin: (0, 0),
      spatial_id: (5, (1, 2)),
      prim_flags: (
       bits: 0,
      ),
      stacking_context: (
       transform_style: Flat,
       mix_blend_mode: Normal,
       clip_id: Some(Clip(0, (1, 2))),
       raster_space: Screen,
       flags: (
        bits: 0,
       ),
      ),
     )),// [24]
     PushStackingContext((
      origin: (0, 0),
      spatial_id: (5, (1, 2)),
      prim_flags: (
       bits: 0,
      ),
      stacking_context: (
       transform_style: Flat,
       mix_blend_mode: Normal,
       clip_id: Some(Clip(0, (1, 2))),
       raster_space: Screen,
       flags: (
        bits: 0,
       ),
      ),
     )),// [25]
     Text((
      common: (
       clip_rect: (
        min: (-2, -2),
        max: (392.5, 52),
       ),
       clip_id: Clip(0, (1, 2)),
       spatial_id: (5, (1, 2)),
       flags: (
        bits: 1,
       ),
      ),
      bounds: (
       min: (-1, -1),
       max: (391.5, 51),
      ),
      font_key: ((3), 2),
      color: (
       r: 0,
       g: 0,
       b: 0,
       a: 1,
      ),
      glyph_options: Some((
       render_mode: Subpixel,
       flags: (
        bits: 0,
       ),
      )),
     ), [
      ...
     ]),// [27]
     PopStackingContext,// [28]
     PopStackingContext,// [29]
     PopReferenceFrame,// [30]
     PopStackingContext,// [31]

Notice 2 identical nested stacking contexts! This is a problem on multiple levels. First, you can't just add a nested stacking context without consequences: if the parent is preserve-3d, and the current context is "flat", then the rules for its primitives are different versus another "flat" context inside it. This isn't exactly what's going on here though.
The other problem is just making WR do more work. Stacking contexts can be heavy on WR, especially for 3D, where they can't be pass-through.

Now, let's see the dump for when "transform" is disabled:

PushStackingContext((
      origin: (12, 30),
      spatial_id: (3, (1, 2)),
      prim_flags: (
       bits: 1,
      ),
      stacking_context: (
       transform_style: Preserve3D,
       mix_blend_mode: Normal,
       clip_id: Some(ClipChain((4, (1, 2)))),
       raster_space: Screen,
       flags: (
        bits: 0,
       ),
      ),
     )),// [17]
     PushReferenceFrame(()),// [21]
     PushStackingContext((
      origin: (0, 0),
      spatial_id: (4, (1, 2)),
      prim_flags: (
       bits: 1,
      ),
      stacking_context: (
       transform_style: Flat,
       mix_blend_mode: Normal,
       clip_id: Some(Clip(0, (1, 2))),
       raster_space: Screen,
       flags: (
        bits: 0,
       ),
      ),
     )),// [22]
     Text((
      common: (
       clip_rect: (
        min: (-2, -2),
        max: (392.5, 52),
       ),
       clip_id: Clip(0, (1, 2)),
       spatial_id: (4, (1, 2)),
       flags: (
        bits: 1,
       ),
      ),
      bounds: (
       min: (-1, -1),
       max: (391.5, 51),
      ),
      font_key: ((3), 2),
      color: (
       r: 0,
       g: 0,
       b: 0,
       a: 1,
      ),
      glyph_options: Some((
       render_mode: Subpixel,
       flags: (
        bits: 0,
       ),
      )),
     ), [
      ...
     ]),// [24]
     PopStackingContext,// [25]
     PopReferenceFrame,// [26]
     PopStackingContext,// [27]

There is no SC's generated for our text! We have 2 nested SCs versus 0 SCs.
No SC has zero flag for IS_BACKFACE_VISIBLE in this case either.
So it looks like gecko just omits the SC altogether if only backface visibility is changed?
Note that the text still has IS_BACKFACE_VISIBLE flag set, so it's not like Gecko just promotes the flag from SC to the primitive.

We'll need to talk about how Gecko generates SC for this. Presumably, with Jeff.

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

Attachment

General

Created:
Updated:
Size: