Skip to content

Commit

Permalink
[css-anchor-1] Define how top layer and anchors interact.
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed Dec 12, 2022
1 parent 448f9a6 commit a5eb357
Showing 1 changed file with 47 additions and 10 deletions.
57 changes: 47 additions & 10 deletions css-anchor-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ spec:css-position-3;
type:property; text:inset-inline-start
</pre>

<style>
/* Put nice boxes around each algorithm. */
[data-algorithm]:not(.heading) {
padding: .5em;
border: thin solid #ddd; border-radius: .5em;
margin: .5em calc(-0.5em - 1px);
}
[data-algorithm]:not(.heading) > :first-child {
margin-top: 0;
}
[data-algorithm]:not(.heading) > :last-child {
margin-bottom: 0;
}
[data-algorithm] [data-algorithm] {
margin: 1em 0;
}
</style>

Introduction {#intro}
=====================

Expand Down Expand Up @@ -442,21 +460,40 @@ might not be capable of anchoring the positioned element.
but the details of that will depend on the API assigning them.)
</div>

<div algorithm>
<div algorithm="acceptable anchor element">
An element |el| is a <dfn export>acceptable anchor element</dfn>
for an [=absolutely positioned=] element |query el|
if all of the following properties apply:
if any of the following are true:

* |query el| is in a higher [=root layer=] than |el|.

* |query el| and |el| are in the same [=root layer=],
and all of the following are true:

* Either |el| is a descendant of |query el|'s [=containing block=],
or |query el|'s [=containing block=] is the [=initial containing block=].

* If |el| has the same [=containing block=] as |query el|,
|el| is not [=absolutely positioned=].

* Either |el| is a descendant of |query el|'s [=containing block=],
or |query el|'s [=containing block=] is the [=initial containing block=].
* If |el| has a different [=containing block=] from |query el|,
the last [=containing block=] in |el|'s [=containing block chain=]
before reaching |query el|'s [=containing block=]
is not [=absolutely positioned=].

* If |el| has the same [=containing block=] as |query el|,
|el| is not [=absolutely positioned=].
For the purposes of this algorithm,
an element is in a particular <dfn noexport>root layer</dfn>
corresponding to the closest [=inclusive ancestor=]
that is in the [=top layer=],
or the document if there isn't one.
[=Root layers=] are "higher" if their corresponding element
is later in the [=top layer=] list;
the layer corresponding to the document is lower than all other layers.

* If |el| has a different [=containing block=] from |query el|,
the last [=containing block=] in |el|'s [=containing block chain=]
before reaching |query el|'s [=containing block=]
is not [=absolutely positioned=].
Note: This wording around "root layer"
needs to live in a stacking-context spec,
after pulling the [=top layer=] stuff
out of [[fullscreen]].
</div>

An element can also have an <dfn export>implicit anchor element</dfn>,
Expand Down

0 comments on commit a5eb357

Please sign in to comment.