Problem on implementing ::backdrop pseudo-element

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem on implementing ::backdrop pseudo-element

Xidorn Quan
Hi,

I'm currently working on ::backdrop pseudo-element, which is part of
the Fullscreen API [1], and is the last non-trivial part I plan to fix
before unprefixing that API.

::backdrop is a pseudo-element which presents right below every
fullscreen element (precisely, every top layer element) for covering
everything else below. The pseudo-element as well as the fullscreen
element both have out-of-flow frames.

Except several special cases, a frame of a pseudo-element is a child
of a frame of its originating element.

However, ::backdrop cannot be implemented that way, becasue any
element can go fullscreen, which means the frame of the fullscreen
element can be video, image, or iframe. Those frame are not container
frame, and thus cannot be a parent frame.

bz suggested that we could probably create an anonymous node in canvas
frame, and put the placeholder of ::backdrop as a child of the canvas
frame. The main difficulty of this solution is that, we would need
quite a bit of hack in the element restyler. Also we may need to
manage several raw pointers between them to allow efficient access,
which could complicate the lifetime management.

dbaron suggested we may be able to remove the constraint that only
nsContainerFrame can be a parent frame, and if that's possible, we can
handle it like other normal pseudo-elements. But it seems to me
removing that restriction is non-trivial, because several places
(especially in text frame and bidi pres utils) assume parents have
principal child list.

I still have no clear idea how can I implement this pseudo-element.
Any suggestion?

[1] https://fullscreen.spec.whatwg.org/#::backdrop-pseudo-element

- Xidorn
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem on implementing ::backdrop pseudo-element

Robert O'Callahan-3
On Mon, Nov 2, 2015 at 6:58 PM, Xidorn Quan <[hidden email]> wrote:

> However, ::backdrop cannot be implemented that way, becasue any
> element can go fullscreen, which means the frame of the fullscreen
> element can be video, image, or iframe. Those frame are not container
> frame, and thus cannot be a parent frame.
>

nsVideoFrame is a container frame.

How about we make nsImageFrame and nsSubdocumentFrame inherit from
nsContainerFrame?

Rob
--
lbir ye,ea yer.tnietoehr  rdn rdsme,anea lurpr  edna e hnysnenh hhe uresyf
toD
selthor  stor  edna  siewaoeodm  or v sstvr  esBa  kbvted,t
rdsme,aoreseoouoto
o l euetiuruewFa  kbn e hnystoivateweh uresyf tulsa rehr  rdm  or rnea
lurpr
.a war hsrer holsa rodvted,t  nenh hneireseoouot.tniesiewaoeivatewt sstvr
esn
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem on implementing ::backdrop pseudo-element

Xidorn Quan
On Mon, Nov 2, 2015 at 9:50 PM, Robert O'Callahan <[hidden email]> wrote:

> On Mon, Nov 2, 2015 at 6:58 PM, Xidorn Quan <[hidden email]> wrote:
>>
>> However, ::backdrop cannot be implemented that way, becasue any
>> element can go fullscreen, which means the frame of the fullscreen
>> element can be video, image, or iframe. Those frame are not container
>> frame, and thus cannot be a parent frame.
>
>
> nsVideoFrame is a container frame.
>
> How about we make nsImageFrame and nsSubdocumentFrame inherit from
> nsContainerFrame?

Well, any HTML element can enter fullscreen. Does that mean we would
make all possible frame inherit from nsContainerFrame?

Hmmm, it seems most of them already have been. The left ones, as far
as I can see, are: image, subdocument, form control, and br. (It seems
table col does not become a normal block as expected. I'll have a look
at it.) Do we want all of them to inherit from nsContainerFrame?

It looks like the easiest approach. I'm not quite comfortable with it,
though. FWIW that would bloat those frames by four pointers.

- Xidorn
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem on implementing ::backdrop pseudo-element

Robert O'Callahan-3
On Tue, Nov 3, 2015 at 12:20 AM, Xidorn Quan <[hidden email]> wrote:

> On Mon, Nov 2, 2015 at 9:50 PM, Robert O'Callahan <[hidden email]>
> wrote:
> > On Mon, Nov 2, 2015 at 6:58 PM, Xidorn Quan <[hidden email]>
> wrote:
> >>
> >> However, ::backdrop cannot be implemented that way, becasue any
> >> element can go fullscreen, which means the frame of the fullscreen
> >> element can be video, image, or iframe. Those frame are not container
> >> frame, and thus cannot be a parent frame.
> >
> >
> > nsVideoFrame is a container frame.
> >
> > How about we make nsImageFrame and nsSubdocumentFrame inherit from
> > nsContainerFrame?
>
> Well, any HTML element can enter fullscreen. Does that mean we would
> make all possible frame inherit from nsContainerFrame?
>
> Hmmm, it seems most of them already have been. The left ones, as far
> as I can see, are: image, subdocument, form control, and br. (It seems
> table col does not become a normal block as expected. I'll have a look
> at it.) Do we want all of them to inherit from nsContainerFrame?
>

Sure!

There are text frames, but they're not elements and can't be fullscreen I
hope!

It looks like the easiest approach. I'm not quite comfortable with it,
> though. FWIW that would bloat those frames by four pointers.
>

I don't think it matters for those frame types.

Rob
--
lbir ye,ea yer.tnietoehr  rdn rdsme,anea lurpr  edna e hnysnenh hhe uresyf
toD
selthor  stor  edna  siewaoeodm  or v sstvr  esBa  kbvted,t
rdsme,aoreseoouoto
o l euetiuruewFa  kbn e hnystoivateweh uresyf tulsa rehr  rdm  or rnea
lurpr
.a war hsrer holsa rodvted,t  nenh hneireseoouot.tniesiewaoeivatewt sstvr
esn
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Loading...