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 4 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
48 changes: 40 additions & 8 deletions css-contain-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,45 @@ 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 currently relevant to the user">
To <dfn>update currently relevant to the user</dfn> given an element <var>element</var>:

1. Let <var>currentlyRelevant</var> be true if <var>element</var> is [=relevant to the user=], otherwise false.
1. If <var>element</var>'s [=currently relevant to the user=] flag is equal to <var>currentlyRelevant</var>, then return false.
1. Set <var>element</var>'s [=currently relevant to the user=] flag to <var>currentlyRelevant</var>.
1. return true.
</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>updateNonInitial</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. If <var>updateNonInitial</var> is true:
1. If [=update currently relevant to the user=] for <var>element</var> returns true.
1. Set <var>changed</var> to true.
1. Let <var>isInitialDetermination</var> be true if <var>element</var>'s [=proximity to the viewport=] is [=not determined=], otherwise false.
1. Determine [=proximity to the viewport=] for <var>element</var>.
1. If <var>isInitialDetermination</var> is false, then [=continue=].
1. If [=update currently relevant to the user=] for <var>element</var> returns true.
1. Set <var>changed</var> to true.
1. return <var>changed</var>.

<div class=note>
The intent of the <var>changed</var> and <var>updateNonInitial</var>
variables is for the initial viewport proximity determination, which takes
effect immediately, to be reflected in the style and layout calculation
this frame.

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 +2347,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