Skip to content

Commit 051d37a

Browse files
committed
[css-position-4] Pull definition of ::backdrop, and additional rendering details, from Fullscreen.
1 parent 77ab99c commit 051d37a

File tree

1 file changed

+106
-6
lines changed

1 file changed

+106
-6
lines changed

css-position-4/Overview.bs

Lines changed: 106 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,19 @@ with its top left corner at the canvas origin.
8989
and |canvas|.
9090

9191
2. For each element |el| in |doc|'s [=Document/top layer=]:
92-
1. [=Paint a stacking context=] given |el| and |canvas|,
92+
1. [=Paint a stacking context=]
93+
given |el|'s ''::backdrop'' pseudo-element
94+
and |canvas|.
95+
96+
2. [=Paint a stacking context=] given |el| and |canvas|,
9397
treating |el| as a [=stacking context=],
9498
with the [=initial containing block=]
9599
as its [=containing block=].
96100
</div>
97101

98102
<div algorithm>
99103
To <dfn export>paint a stacking context</dfn>
100-
given an [=element=] or [=box=] |root|,
104+
given an [=element=], [=pseudo-element=], or [=box=] |root|,
101105
and an infinite canvas |canvas|:
102106

103107
1. If |root| is an [=element=],
@@ -332,9 +336,9 @@ as if they were siblings of the root element.
332336
[=Document/Top layer=] elements are rendered in the order they appear in the [=Document/top layer=];
333337
the last element in the [=Document/top layer=] is rendered on top of everything else.
334338

335-
{{Document}}s also have a <dfn export>pending top layer removals</dfn> [=ordered set=],
336-
containing elements that are pending removal.
337-
(See the algorithms, below, for details on how this is used.)
339+
An element is <dfn export>in the top layer</dfn>
340+
if it's present in its document's [=Document/top layer=],
341+
and its computed 'overlay' value is ''overlay/auto''.
338342

339343
Note: This special rendering behavior ensures
340344
that elements in the [=Document/top layer=] cannot be clipped by anything in the document,
@@ -353,12 +357,107 @@ Note: The [=Document/top layer=] interacts with the 'overlay' property
353357
in a somewhat unusual way.
354358
See 'overlay' for details.
355359

360+
{{Document}}s also have a <dfn export>pending top layer removals</dfn> [=ordered set=],
361+
containing elements that are pending removal.
362+
(See the algorithms, below, for details on how this is used.)
363+
356364
The [=Document/top layer=]
357365
(and the [=pending top layer removals=])
358366
should not be interacted with directly
359367
by specification algorithms.
368+
(Individual features using the [=Document/top layer=]
369+
might have ownership over various things in the top layer,
370+
like a popover inside of a popover,
371+
that need to be reordered or moved as a group.)
360372
Instead, specifications should use the following algorithms.
361373

374+
Top Layer Styling {#top-styling}
375+
-----------------
376+
377+
If an element is [=in the top layer=],
378+
it generates a
379+
380+
Every element [=in the top layer=],
381+
as well as its corresponding ''::backdrop'' pseudo-element,
382+
are rendered with the following qualities:
383+
384+
* It generates a new [=stacking context=].
385+
386+
* Its parent stacking context is the root stacking context.
387+
388+
* If it consists of multiple layout boxes, the first box is used.
389+
390+
Issue: Not sure what this means.
391+
Maybe it's talking about fragmentation?
392+
393+
* It is rendered as an atomic unit as if it were a sibling of the document's root.
394+
395+
Note: Ancestor elements with 'overflow', 'opacity', 'mask', etc. cannot affect it.
396+
397+
* If its 'position' property computes to ''position/fixed'',
398+
its containing block is the viewport;
399+
otherwise, it's the initial containing block.
400+
401+
* If it is an element,
402+
it and its ''::backdrop'' pseudo-element are not rendered
403+
if its [=shadow-including inclusive ancestor=] has the ''display: none''.
404+
405+
* If its specified 'display' property is ''display/contents'',
406+
it computes to ''display/block''.
407+
408+
* If its specified 'position' property
409+
is not ''position/absolute'' or ''position/fixed'',
410+
it computes to ''position/absolute''.
411+
412+
* Unless overridden by another specification,
413+
its static position for left, right, and top is zero.
414+
415+
416+
The ''::backdrop'' Pseudo-Element {#backdrop}
417+
---------------------------------
418+
419+
Each element [=in the top layer=] has a <dfn selector>::backdrop</dfn> pseudo-element,
420+
for which it is the [=originating element=].
421+
422+
When its computed 'content' value is not ''content/none'',
423+
''::backdrop'' pseudo-elements generate boxes
424+
as if they were siblings of the root element.
425+
They're automatically rendered as a separate item in the [=Document/top layer=],
426+
below their [=originating element=].
427+
(See "[=paint a document=]" for details.)
428+
429+
Note: The ''::backdrop'' pseudo-element
430+
can be used to create a backdrop
431+
that hides the underlying document for an element in a top layer
432+
(such as an element that is displayed fullscreen).
433+
434+
The ''::backdrop'' pseudo-element is a [=tree-abiding pseudo-element=].
435+
It accepts all properties.
436+
It inherits from its [=originating element=].
437+
438+
User agents should contain the following rules in a UA-level style sheet:
439+
440+
<pre highlight=css>
441+
::backdrop {
442+
position: fixed;
443+
inset: 0;
444+
}
445+
</pre>
446+
447+
Other specifications can additional properties
448+
to the default ''::backdrop'' rendering.
449+
450+
Note: For example, a fullscreen element
451+
(see [[FULLSCREEN]])
452+
styles its ''::backdrop'' as opaque black by default.
453+
454+
See [[#top-styling]] for additional details
455+
on how ''::backdrop'' elements are rendered.
456+
457+
458+
Top Layer Manipulation {#top-manip}
459+
----------------------
460+
362461
<div algorithm>
363462
To <dfn export lt="add an element to the top layer | add to the top layer">add an element to the top layer</dfn>,
364463
given a {{Document}} |doc|
@@ -410,7 +509,8 @@ Instead, specifications should use the following algorithms.
410509
Note: This algorithm is only intended to be used in special cases
411510
where removing something from the top layer immediately
412511
(bypassing things like an 'overlay' transition)
413-
is necessary.
512+
is necessary,
513+
such as a modal dialog that is removed from the document.
414514
Most of the time, [=requesting removal from the top layer=] is more appropriate.
415515
</div>
416516

0 commit comments

Comments
 (0)