Skip to content

Commit 7c2c201

Browse files
committed
Refactor fullscreen rejection handling to use WebIDL react pattern
This commit modernizes how the Screen Orientation specification responds to fullscreen request rejections by using the WebIDL 'react' concept instead of the previous flag-based approach. Changes: - Replace flag-based 'pending fullscreen request flag unset due to rejection' pattern - Use WebIDL 'react' pattern with 'pending fullscreen request promise' - Update reference to use proper 'pending fullscreen request flag' terminology - Maintain all existing algorithm behavior while modernizing the specification architecture This enables cleaner, more maintainable specification text that follows modern WebIDL patterns for promise-based APIs. The change complements the fullscreen spec changes in whatwg/fullscreen that add both the exported flag and promise definitions needed for this integration. Fixes #254 Fixes #255
1 parent 245ed44 commit 7c2c201

File tree

1 file changed

+81
-3
lines changed

1 file changed

+81
-3
lines changed

index.html

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,12 +866,90 @@ <h2>
866866
</h2>
867867
<p>
868868
A user agent SHOULD restrict the use of {{ScreenOrientation/lock()}} to
869-
simple fullscreen documents as a [=pre-lock condition=]. [[fullscreen]]
869+
documents that meet the <dfn>fullscreen pre-lock condition</dfn> as a
870+
[=pre-lock condition=]. [[fullscreen]]
870871
</p>
871872
<p>
872-
When a [=document=] exits fullscreen, it also runs the [=fully unlock
873-
the screen orientation steps=]. [[fullscreen]]
873+
A {{Document}} |document| meets the [=fullscreen pre-lock condition=]
874+
if any of the following are true:
874875
</p>
876+
<ol>
877+
<li>|document| has a [=fullscreen element=].
878+
</li>
879+
<li>|document| has its [=pending fullscreen request flag=] set.
880+
</li>
881+
<li>|document| is [=same origin=] with its [=top-level browsing
882+
context=]'s [=navigable/active document=], and that [=top-level
883+
browsing context=]'s [=navigable/active document=] meets one of the
884+
above conditions.
885+
</li>
886+
</ol>
887+
<p class="note">
888+
The third condition allows same-origin iframes to lock the screen
889+
orientation when their parent document is in fullscreen or has
890+
requested fullscreen. This prevents cross-origin documents from
891+
detecting the fullscreen state of their embedding document.
892+
</p>
893+
<p>
894+
When a [=document=] |doc| exits fullscreen, the user agent MUST:
895+
</p>
896+
<ol class="algorithm">
897+
<li>Run the [=fully unlock the screen orientation steps=] with |doc|.
898+
</li>
899+
<li>If |doc| is a [=top-level browsing context=]'s [=navigable/active
900+
document=]:
901+
<ol>
902+
<li>Let |descendantDocs| be an [=ordered set=] consisting of
903+
|doc|'s [=Document/descendant navigables=]'s [=navigable/active
904+
documents=], if any, in tree order.
905+
</li>
906+
<li>[=Set/For each=] |descendantDoc:Document| in |descendantDocs|:
907+
<ol>
908+
<li>If |descendantDoc| is not [=same origin=] with |doc|,
909+
continue.
910+
</li>
911+
<li>If |descendantDoc|'s
912+
{{Document/[[orientationPendingPromise]]}} is not `null`,
913+
[=reject and nullify the current lock promise=] of
914+
|descendantDoc| with an {{"AbortError"}}.
915+
</li>
916+
</ol>
917+
</li>
918+
</ol>
919+
</li>
920+
</ol>
921+
<p>
922+
[=React=] to a [=document=] |doc|'s [=pending fullscreen request
923+
promise=]. When the promise is [=reject|rejected=], run the following
924+
steps:
925+
</p>
926+
<ol class="algorithm">
927+
<li>If |doc|'s {{Document/[[orientationPendingPromise]]}} is not
928+
`null`, [=reject and nullify the current lock promise=] of |doc| with
929+
an {{"AbortError"}}.
930+
</li>
931+
<li>If |doc| is a [=top-level browsing context=]'s [=navigable/active
932+
document=]:
933+
<ol>
934+
<li>Let |descendantDocs| be an [=ordered set=] consisting of
935+
|doc|'s [=Document/descendant navigables=]'s [=navigable/active
936+
documents=], if any, in tree order.
937+
</li>
938+
<li>[=Set/For each=] |descendantDoc:Document| in |descendantDocs|:
939+
<ol>
940+
<li>If |descendantDoc| is not [=same origin=] with |doc|,
941+
continue.
942+
</li>
943+
<li>If |descendantDoc|'s
944+
{{Document/[[orientationPendingPromise]]}} is not `null`,
945+
[=reject and nullify the current lock promise=] of
946+
|descendantDoc| with an {{"AbortError"}}.
947+
</li>
948+
</ol>
949+
</li>
950+
</ol>
951+
</li>
952+
</ol>
875953
</section>
876954
<section id="appmanifest-interaction">
877955
<h2>

0 commit comments

Comments
 (0)