Skip to content

Commit c068986

Browse files
flackrstephenmcgruer
authored andcommitted
Abort creating a new animator instance if one already exists for that root. (w3c#31)
We should only have one instance of a named animator per animator-root element.
1 parent 92bad2e commit c068986

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Overview.bs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,32 +249,32 @@ Each <a>animator instance</a> lives in an {{AnimationWorkletGlobalScope}}. The
249249
<a>animator instance</a> cannot be disposed arbitrarily (e.g., in the middle of running animation
250250
as it may contain the scripted animation state.
251251

252-
The {{AnimationWorkletGlobalScope}} has an <dfn>animator instance list</dfn>. Anytime a new
252+
The {{AnimationWorkletGlobalScope}} has an <dfn>animator instance list</dfn>. Anytime a new
253253
<a>animator instance</a> is constructed in that scope, it gets added to the list.
254254

255-
To <dfn>create a new animator instance</dfn> given |name|, |outside port|, and |workletGlobalScope|,
255+
To <dfn>create a new animator instance</dfn> given a |root element|, |name|, and |workletGlobalScope|,
256256
the user agent <em>must</em> run the following steps:
257257

258-
1. Let the |definition| be the result of looking up |name| on the |workletGlobalScope|'s
259-
<a>animator name to animator definition map</a>.
258+
1. If an |animatorInstance| with the same |name| and |root element| exists within the <a>animator
259+
instance list</a> then abort the following steps.
260260

261-
If |definition| does not exist abort the following steps.
261+
2. Let the |definition| be the result of looking up |name| on the |workletGlobalScope|'s
262+
<a>animator name to animator definition map</a>.
262263

263-
Issue: We should check the animator instance list to make sure we don't create duplicate
264-
instances for the same name and element.
264+
If |definition| does not exist abort the following steps.
265265

266-
2. Let |animatorCtor| be the <a>class constructor</a> of |definition|.
266+
3. Let |animatorCtor| be the <a>class constructor</a> of |definition|.
267267

268-
3. Let |animatorInstance| be the result of <a>Construct</a>(|animatorCtor|).
268+
4. Let |animatorInstance| be the result of <a>Construct</a>(|animatorCtor|).
269269

270270
Issue: handle invalid construction.
271-
272-
4. Set the following on |animatorInstance| with:
271+
272+
5. Set the following on |animatorInstance| with:
273273
- <a>animator name</a> being |name|
274274

275275
- <a>animation request flag</a> being <a>frame-current</a>
276276

277-
5. Add |animatorInstance| to <a>animator instance list</a>.
277+
6. Add |animatorInstance| to <a>animator instance list</a>.
278278

279279

280280
Creating an Element Proxy {#creating-element-proxy}

0 commit comments

Comments
 (0)