Skip to content
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

Editorial: refactor getting the window.orientation angle #241

Merged
merged 1 commit into from
Apr 22, 2023
Merged
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
27 changes: 9 additions & 18 deletions compatibility.bs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ urlPrefix: https://w3c.github.io/screen-orientation/;
type: interface
text: ScreenOrientation; url: #screenorientation-interface
type: dfn
text: update the orientation information; url: #dfn-update-the-orientation-information
text: current orientation angle; url: #dfn-current-orientation-angle
urlPrefix: https://www.w3.org/TR/CSS/; spec: CSS2
type: dfn
text: vendor prefix; url: #vendor-prefix
Expand Down Expand Up @@ -780,9 +780,9 @@ compatibility with the web.</div>
<a attribute lt="orientation"><code>window.orientation</code></a> angle
</h4>

The possible values for the <a attribute lt="orientation"><code>window.orientation</code></a> angle
are: <code>-90</code>, <code>0</code>, <code>90</code>, <code>180</code>. User agents must support
the <code>-90</code>, <code>0</code> and <code>90</code> values and may optionally support
The possible integer values for the <a attribute lt="orientation"><code>window.orientation</code></a>
angle are: <code>-90</code>, <code>0</code>, <code>90</code>, <code>180</code>. User agents must
support the <code>-90</code>, <code>0</code> and <code>90</code> values and may optionally support
<code>180</code>.

<p class="note">
Expand All @@ -796,15 +796,12 @@ In order to determine the current <a attribute lt="orientation"><code>window.ori
angle, the user agent must run the following steps:

<ol>
<li>Return the result of step 3 of the {{ScreenOrientation}}'s
<a>update the orientation information</a> algorithm with the following changes:
<li>Let |orientationAngle| be the <a>current orientation angle</a>.
<ol>
<li>If the orientation angle is less than or equal to 180, return the orientation angle
<li>If the orientation angle is greater than 180, return the orientation angle - 360.
<li>If the resulting orientation angle is 180 and the user agent does not support that value,
return 0.
<!-- This is what Windows phone, some iPhones running various iOSes, and Chrome Mobile do on
some of my test Androids. It's possible something else happens! -->
<li>If |orientationAngle| is less than 180, return |orientationAngle|.
<li>If |orientationAngle| is 180, and the [=user agent=] supports that value, return
|orientationAngle|, else return 0.
<li>If |orientationAngle| is greater than 180, return |orientationAngle| - 360.
</ol>
</li>
</ol>
Expand Down Expand Up @@ -833,12 +830,6 @@ supported on all {{Window}} objects and <code><{body}></code> elements as attrib
</tbody>
</table>

<div class="XXX">
WebKit also has this on
<a href="https://github.com/WebKit/webkit/blob/e455672f9e6861ced85d8be01cb7bc03a30a0555/LayoutTests/fast/dom/event-handler-attributes.html#L335">HTMLFrameSetElement</a>.
It's unclear if this is needed for compatibility.
</div>

<h2 id="ua-string-section">The User-Agent String</h2>

The <code>User-Agent</code> header field syntax is formally defined by [[!HTTP-SEMANTICS]] and
Expand Down