fullscreen icon indicating copy to clipboard operation
fullscreen copied to clipboard

Change fullscreen CSS from `top`/`bottom`/`left`/`right` to `inset`

Open mfreed7 opened this issue 2 years ago • 6 comments

The fullscreen spec says this:

*|*:not(:root):fullscreen {
  top:0 !important; right:0 !important; bottom:0 !important; left:0 !important;
}
::backdrop {
  top:0; right:0; bottom:0; left:0;
}

For brevity and (small) performance improvement, would it be better to do this?

*|*:not(:root):fullscreen {
  inset:0 !important;
}
::backdrop {
  inset:0;
}

On at least Chromium, inset:0 can be faster than individual top/left/bottom/right properties. And the notation is easier to understand. This also seems like a web-compatible change to make.

@dbaron @bfgeek

mfreed7 avatar Aug 22 '22 21:08 mfreed7

This also seems like a web-compatible change to make.

Is this because top, right, bottom and left if specified still override inset? Or what kinds of breakage are possible here?

@annevk do you know who could look into this proposal for Apple?

For Gecko it looks like @EdgarChen and @marti4d have some recent fullscreen-related changes. Do either of you know who should weigh in from Mozilla's side?

foolip avatar Aug 29 '22 13:08 foolip

This works for us.

I couldn't work out a way in which this would be observable, but maybe there is?

annevk avatar Aug 29 '22 15:08 annevk

This also seems like a web-compatible change to make.

Is this because top, right, bottom and left if specified still override inset? Or what kinds of breakage are possible here?

Right - I think the behavior should be identical between inset:0 and top:0;left:0;..., and as @annevk said, likely not observable. (It will be "observable" in devtools.)

mfreed7 avatar Aug 29 '22 16:08 mfreed7

cc @emilio.

EdgarChen avatar Aug 29 '22 18:08 EdgarChen

Not opposed to this, and it shouldn't be observable, but I'm curious about the performance argument, is the claim that's faster to parse? I expect the performance difference to be close to none in practice, but worth the simplification I suppose.

emilio avatar Aug 29 '22 20:08 emilio

Not opposed to this, and it shouldn't be observable, but I'm curious about the performance argument, is the claim that's faster to parse? I expect the performance difference to be close to none in practice, but worth the simplification I suppose.

@bfgeek can add more color, but it sounds like inset:0 is faster (again, very slightly!) for the layout engine. And of course fewer tokens for the parser, but that's also very small.

Again, since it's not observable and the effect is small, I debated not even opening this issue. But I did. 😄

mfreed7 avatar Sep 02 '22 15:09 mfreed7