Skip to content

[css-contain-2] WIP: Stop monkey-patching the HTML spec. #12105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions css-contain-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ Size Containment</h3>

<wpt>
contain-size-064.html
<wpt>
</wpt>
</dl>

Note: [=Size containment=] does not suppress baseline alignment.
Expand Down Expand Up @@ -1994,6 +1994,37 @@ Suppressing An Element's Contents Entirely: the 'content-visibility' property {#
When the element becomes disconnected, the element's [=proximity to the viewport=] becomes [=not determined=].
</div>

<div>
All elements have a <dfn>currently relevant to the user</dfn> flag, initially false.
</div>

<div algorithm="update content relevancy for a document">
To <dfn export>update content relevancy for a document</dfn> given a document <var>doc</var>, and a boolean <var>isFirstIteration</var>:

1. Let <var>changed</var> be false.
1. For each <var>element</var> [=connected=] to doc with ''auto'' used value of ''content-visibility''
1. Determine proximity to the viewport for <var>element</var>.
1. If <var>element</var> is not [=currently relevant to the user=] and <var>element</var> is [=relevant to the user=], then:
2. Set <var>changed</var> to true.
2. Set <var>element</var>'s [=currently relevant to the user=] flag to true.
1. If <var>isFirstIteration</var> is false, then [=continue=].
1. If <var>element</var> is [=relevant to the user=], then:
1. If <var>element</var>'s [=currently relevant to the user=] flag is false, set <var>changed</var> to true.
1. Set <var>element</var>'s [=currently relevant to the user=] flag to true.
1. Otherwise:
1. If <var>element</var>'s [=currently relevant to the user=] flag is true, set <var>changed</var> to true.
1. Set <var>element</var>'s [=currently relevant to the user=] flag to false.
1. return <var>changed</var>.

<div class=note>
The intent of the <var>changed</var> variable is for the initial viewport
proximity determination, which takes effect immediately, to be reflected in
the style and layout calculation which is carried out in a previous step of
this loop. Proximity determinations other than the initial one take effect
at the next rendering opportunity.
</div>
</div>

<div algorithm>
An element is <dfn export>relevant to the user</dfn>
if <strong>any</strong> of the following conditions are true:
Expand Down Expand Up @@ -2308,14 +2339,7 @@ Restrictions and Clarifications {#cv-notes}
</wpt>

3. If an element starts or stops [=skipped contents|skipping its contents=],
this change happens
after the requestAnimationFrame callbacks
of the frame that renders the effects of the change
have run.
Specifically, such changes will take effect between steps 13 and 14
of [=update the rendering=] step of the Processing Model
(between “run the animation frame callbacks”
and “run the update intersection observations steps”).
this change happens when [=update content relevancy for a document=] runs.

<div class=note>
Determining the viewport intersection of the element
Expand Down