Modernize algorithms in "Algorithm" section#120
Merged
rakuco merged 1 commit intow3c:gh-pagesfrom Mar 8, 2024
Merged
Conversation
The original main goal was to give a name to the existing algorithm that used to run in the "next animation frame task" so that it could be referenced in the upcoming WebDriver section, but "animation frame task" as a concept did not exist, and one thing led to another and the final change includes a better version of the original algorithms, but without any user-visible changes. This change borrows a lot of ideas from the Screen Orientation spec as of its 2023-08-09 Editor's Draft. Most important changes: - The "update the device posture information" algorithm was renamed to "calculate the device posture information" so that it returns a value instead of updating `[[CurrentPosture]]` directly -- that is done as task queued in the user interaction task source (more on this below). - Call the main algorithm "device posture change steps". - Merge the separate page visibility-related algorithm into the main one, and add the proper checks to it to ensure that documents whose visibility state is "hidden" are not updated and that calls to "update the device posture information" that result in the same value being stored do not fire any "change" events. - The "change" event is now queued to be fired in the user interaction task source so that the moment it is actually fired is more predictable (the "device posture change steps" are not running at any specific point of the HTML event loop). While here: the definition of the `onchange` attribute was updated to mention the current terms defined in the HTML spec, along with a proper `<dfn>` for the event handler event type. The language and the references used in the text have also been updated: we no longer deal with browsing contexts, but with navigables; the PAGE-VISIBILITY spec is no longer treated as a separate specification, as it was merged into HTML a few years ago. Related to w3c#104. Fixes w3c#95.
darktears
approved these changes
Mar 8, 2024
rakuco
pushed a commit
to rakuco/device-posture
that referenced
this pull request
Mar 11, 2024
Follow-up w3c#120. `disallowRecursion` is an optional boolean parameter for the "device posture change steps" algorithm. Passing just `true` or `false` in call sites is not very legible though, so follow the suggestion from the Infa spec and pass the arguments as a named parameter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original main goal was to give a name to the existing algorithm that
used to run in the "next animation frame task" so that it could be
referenced in the upcoming WebDriver section, but "animation frame task" as
a concept did not exist, and one thing led to another and the final change
includes a better version of the original algorithms, but without any
user-visible changes.
This change borrows a lot of ideas from the Screen Orientation spec as of
its 2023-08-09 Editor's Draft.
Most important changes:
"calculate the device posture information" so that it returns a value
instead of updating
[[CurrentPosture]]directly -- that is done as taskqueued in the user interaction task source (more on this below).
and add the proper checks to it to ensure that documents whose visibility
state is "hidden" are not updated and that calls to "update the device
posture information" that result in the same value being stored do not
fire any "change" events.
source so that the moment it is actually fired is more predictable (the
"device posture change steps" are not running at any specific point of the
HTML event loop).
While here: the definition of the
onchangeattribute was updated tomention the current terms defined in the HTML spec, along with a proper
<dfn>for the event handler event type.The language and the references used in the text have also been updated: we
no longer deal with browsing contexts, but with navigables; the
PAGE-VISIBILITY spec is no longer treated as a separate specification, as it
was merged into HTML a few years ago.
Related to #104. Fixes #95.
Preview | Diff