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

Drop WebIDL enums #899

Closed
wants to merge 3 commits into from
Closed
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
96 changes: 74 additions & 22 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1078,12 +1078,6 @@ <h3>
The output from inputting an JSON document into this algorithm is a
<dfn>processed manifest</dfn>.
</p>
<p class="issue">
We need to catch throws associated with enumerations in IDL
conversion as the spec might gain new values over time not supported
by all existing browsers. This is especially important as we rely on
enums not defined in this specification.
</p>
<ol>
<li>Let <var>json</var> be the result of [=parse JSON from bytes=]
<var>text</var>. If parsing throws an error:
Expand Down Expand Up @@ -1112,6 +1106,16 @@ <h3>
value|converting=] <var>json</var> to a <a>WebAppManifest</a>
dictionary.
</li>
<li>Set |manifest|["{{dir}}"] to the result of running [=processing
the `dir` member=] given |manifest|["{{dir}}"].
</li>
<li>Set |manifest|["{{display}}"] to the result of running
[=processing the `display` member=] given |manifest|["{{display}}"].
</li>
<li>Set |manifest|["{{orientation}}"] to the result of running
[=processing the `orientation` member=] given
|manifest|["{{orientation}}"].
</li>
<li>Set <var>manifest</var>["<a>start_url</a>"] to the result of
running <a>processing the <code>start_url</code> member</a> given
<var>manifest</var>["<a>start_url</a>"], <var>manifest URL</var>, and
Expand Down Expand Up @@ -1161,6 +1165,27 @@ <h3>
<li>Return <var>manifest</var>.
</li>
</ol>
<section>
<h4>
Processing enumeration members
</h4>
<p>
The steps for <dfn>processing an enumeration member</dfn> are given
by the following algorithm. The algorithm takes a [=DOMString=]
|value| and a [=set=] of |supported values|. This algorithm returns
a `DOMString?`.
</p>
<ol>
<li>Set |value| to [=ascii lowercased=] |value|.
</li>
<li>If |supported values| [=set/contain|contains=] |value|, then return
|value|.
</li>
<li>Otherwise, [=issue a developer warning=] that |value| is not
supported and return `undefined`.
</li>
</ol>
</section>
</section>
<section>
<h3 id="applying">
Expand Down Expand Up @@ -1260,7 +1285,7 @@ <h2>
</h2>
<pre class="idl">
dictionary WebAppManifest {
TextDirectionType dir = "auto";
DOMString dir = "auto";
DOMString lang;
USVString name;
USVString short_name;
Expand All @@ -1270,8 +1295,8 @@ <h2>
sequence&lt;USVString&gt; categories;
DOMString iarc_rating_id;
USVString start_url;
DisplayModeType display = "browser";
OrientationLockType orientation;
DOMString display = "browser";
DOMString orientation;
USVString theme_color;
USVString background_color;
USVString scope;
Expand All @@ -1293,9 +1318,6 @@ <h2>
<h3>
<code>dir</code> member
</h3>
<pre class="idl">
enum TextDirectionType { "ltr", "rtl", "auto" };
</pre>
<p>
The <dfn>dir</dfn> member specifies the <dfn>base direction</dfn> for
the <a>localizable members</a> of the <a>manifest</a>. The <a>dir</a>
Expand Down Expand Up @@ -1347,8 +1369,8 @@ <h3>
</dd>
</dl>
<p data-link-for="TextDirectionType">
When displaying the <a>localizable members</a> to an end-user,
if the <a>base direction</a> is <a>ltr</a> or <a>rtl</a>:
When displaying the <a>localizable members</a> to an end-user, if the
<a>base direction</a> is <a>ltr</a> or <a>rtl</a>:
</p>
<ol>
<li data-link-for="TextDirectionType">If the member is being
Expand All @@ -1363,6 +1385,20 @@ <h3>
if the <a>base direction</a> is <a>rtl</a>.
</li>
</ol>
<p>
The steps for <dfn>processing the `dir` member</dfn> is given by the
following algorithm. The algorithm takes a [=DOMString=] |value| as
an argument. This algorithm returns a `DOMString`.
</p>
<ol>
<li>Let |value| be [=processing an enumeration member=] given |value|
and [=TextDirectionType=].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TextDirectionType and DisplayModeType are referenced several times throughout the spec, and are no longer formally defined. Your new structure implies that these are now "sets of DOMStrings" (as opposed to WebIDL enum types), so I think they need to be formally declared as such.

</li>
<li>If |value| is undefined, then return "{{auto}}".
</li>
<li>Otherwise, return |value|.
</li>
</ol>
</section>
<section>
<h3>
Expand Down Expand Up @@ -1580,19 +1616,25 @@ <h3>
<h3>
<code>display</code> member
</h3>
<pre class="idl">
enum DisplayModeType {
"fullscreen",
"standalone",
"minimal-ui",
"browser"
};
</pre>
<p>
The <dfn>display</dfn> member is a <a>DisplayModeType</a>, whose
value is one of <a>display modes values</a>. The item represents the
developer's preferred <a>display mode</a> for the web application.
</p>
<p>
The steps for <dfn>processing the `display` member</dfn> is given by
the following algorithm. The algorithm takes a [=DOMString=] |value|
as an argument. This algorithm returns a `DOMString`.
</p>
<ol>
<li>Let |value| [=processing an enumeration member=] given |value|
and [=DisplayModeType=].
</li>
<li>If |value| is `undefined`, then return "{{browser}}".
</li>
<li>Return |value|.
</li>
</ol>
</section>
<section>
<h3>
Expand Down Expand Up @@ -1634,6 +1676,16 @@ <h3>
orientation of a <a>top-level browsing context</a> (such as via
[[SCREEN-ORIENTATION]] API).
</p>
<p>
The steps for <dfn>processing the `orientation` member</dfn> is given
by the following algorithm. The algorithm takes a [=DOMString=]
|value| as an argument. This algorithm returns a `DOMString?`.
</p>
<ol>
<li>Return [=processing an enumeration member=] given |value| and
{{OrientationLockType}}.
</li>
</ol>
</section>
<section>
<h3>
Expand Down