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

Update type of MediaMetadata's artwork #343

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Changes from 3 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
83 changes: 47 additions & 36 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ table td, table th {

<pre class="link-defaults">
spec:html; type:element; text:link
spec:webidl; type:interface; text:object
</pre>

<pre class="anchors">
Expand Down Expand Up @@ -1063,7 +1064,7 @@ interface MediaMetadata {
attribute DOMString title;
attribute DOMString artist;
attribute DOMString album;
attribute FrozenArray&lt;MediaImage> artwork;
attribute FrozenArray&lt;object> artwork;
[SameObject] readonly attribute FrozenArray&lt;ChapterInformation> chapterInfo;
};

Expand Down Expand Up @@ -1094,8 +1095,10 @@ dictionary MediaMetadataInit {
</p>

<p>
A {{MediaMetadata}} has an associated list of <dfn for="MediaMetadata">artwork
images</dfn>.
A {{MediaMetadata}} has an associated sequence of <dfn for="MediaMetadata">artwork
images</dfn>, which is a sequence of type {{MediaImage}}.
A {{MediaMetadata}} also has has an associated <dfn for="MediaMetadata">
converted artwork images</dfn> which is initially <code>undefined</code>.
</p>

<p>
Expand Down Expand Up @@ -1164,7 +1167,8 @@ dictionary MediaMetadataInit {
</p>

When the <dfn>convert artwork algorithm</dfn> with <var>input</var> parameter is
invoked, the user agent MUST run the following steps:
invoked, where the <var>input</var> is a sequence of type {{MediaImage}},
the user agent MUST run the following steps:
<ol>
<li>
Let <var>output</var> be an empty list of type {{MediaImage}}.
Expand Down Expand Up @@ -1227,52 +1231,58 @@ invoked, the user agent MUST run the following steps:
<p>
The <dfn attribute for="MediaMetadata">artwork</dfn>
attribute reflects the {{MediaMetadata}}'s <a for="MediaMetadata">artwork
images</a>. On getting, it MUST return the result of the following steps:
images</a>. On getting, it MUST run the following steps:
<ol>
<li>
Let <var>frozenArtwork</var> be an empty list of type {{MediaImage}}.
</li>
<li>
For each <var>entry</var> in the {{MediaMetadata}}'s <a
for="MediaMetadata">artwork images</a>, perform the following steps:
If the {{MediaMetadata}}'s <dfn>converted artwork images</dfn> is <code>undefined</code>,
run the following steps:
<ol>
<li>
Let <var>image</var> be a new {{MediaImage}}.
</li>
<li>
Set <var>image</var>'s {{MediaImage/src}} to <var>entry</var>'s
{{MediaImage/src}}.
</li>
<li>
Set <var>image</var>'s {{MediaImage/sizes}} to <var>entry</var>'s
{{MediaImage/sizes}}.
Let <var>frozenArtwork</var> be a Javascript Array value.
</li>
<li>
Set <var>image</var>'s {{MediaImage/type}} to <var>entry</var>'s
{{MediaImage/type}}.
For each <var>entry</var> in the {{MediaMetadata}}'s <a
for="MediaMetadata">artwork images</a>, perform the following steps:
<ol>
<li>
Convert <var>entry</var> into a Javascript object named <var>image</var>.
</li>
<li>
Perform [=!=] <a abstract-op>SetIntegrityLevel</a>(<var>image</var>,
"<code>frozen</code>"), to prevent accidental mutation by scripts.
</li>
<li>
Push <var>image</var> to <var>frozenArtwork</var>.
</li>
</ol>
</li>
<!-- XXX IDL dictionaries are usually returned by value, so don't need
to be immutable. But FrozenArray reifies the dictionaries to mutable JS
objects accessed by reference, so we explicitly freeze them. It would be
better to do this with IDL primitives instead of JS - see
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29004 -->
<li>
Call {{Object/freeze(O)}} on <var>image</var>, to prevent accidental
mutation by scripts.
Perform [=!=] <a abstract-op>SetIntegrityLevel</a>(<var>frozenArtwork</var>, "<code>frozen</code>").
</li>
<li>
Append <var>image</var> to <var>frozenArtwork</var>.
Set the {{MediaMetadata}}'s <a>converted artwork images</a> to <var>frozenArtwork</var>.
</li>
</ol>
</li>
<li>
<a>Create a frozen array</a> from <var>frozenArtwork</var>.
Return the {{MediaMetadata}}'s <a>converted artwork images</a>.
</li>
</ol>
On setting, it MUST run the following steps:
<ol>
<li>
Let <var>convertedArtwork</var> be the result of converting
the new value <var>input</var> into a sequence of type {{MediaImage}}.
</li>
<li>
Run <a>convert artwork algorithm</a> with the converted sequence as
<var>input</var>, and set the {{MediaMetadata}}'s
<a for="MediaMetadata">artwork images</a> as the result if it succeeds.
</li>
<li>
Set the {{MediaMetadata}}'s <a>converted artwork images</a> to <code>undefined</code>.
</li>
</ol>
On setting, it MUST run the
<a>convert artwork algorithm</a> with the new value as <var>input</var>, and
set the {{MediaMetadata}}'s <a for="MediaMetadata">artwork images</a> as the
result if it succeeded.
</p>

<p>
Expand Down Expand Up @@ -1369,11 +1379,12 @@ dictionary ChapterInformationInit {
</li>
<li>
Let {{ChapterInformationInit/artwork}} be the result of running the
<a>convert artwork algorithm</a>.
<a>convert artwork algorithm</a> with <var>init</var>'s
{{ChapterInformation/artwork}} as <var>input</var>.
</li>
<li>
Set <var>chapterInfo</var>'s <a for="ChapterInformation">artwork
images</a> to the result of [=Create a frozen array|creating a frozen
images</a> be the result of [=Create a frozen array|creating a frozen
array=] from {{ChapterInformationInit/artwork}}.
</li>
<li>
Expand Down
Loading