> may use the cached image.
+
[Exposed=PaintWorklet]
interface PaintSize {
@@ -478,12 +488,12 @@ interface PaintSize {
When the user agent wants to
draw a paint image of a <
> function for a |box|
into its appropriate stacking level (as defined by the property the CSS property its associated
-with), given its |concreteObjectSize| (concrete object size) it must run the
-following steps:
+with), given |concreteObjectSize| it must run the following steps:
1. Let |paintFunction| be the <> function on the |box| which the user agent wants to
draw.
- 2. If the paint valid flag for the |paintFunction| is paint-valid the user agent
+ 2. If the paint valid flag for the |paintFunction| is paint-valid,
+ and the previous invocation had the same |concreteObjectSize|, the user agent
may use the drawn image from the previous invocation. If so it may abort
all these steps and use the previously drawn image.
diff --git a/worklets/Overview.bs b/worklets/Overview.bs
index f747217e..b6960868 100644
--- a/worklets/Overview.bs
+++ b/worklets/Overview.bs
@@ -123,6 +123,26 @@ The following techniques are used in order to encourage authors to write code in
- User agents can create and destroy {{WorkletGlobalScope}}s at any time for these specifications.
+Speculative Evaluation {#speculative-evaluation}
+------------------------------------------------
+
+Some specifications which use worklets ([[css-paint-api-1]]) may invoke methods on a class based on
+the state of the user agent. To increase the concurrency between threads, a user agent may invoke a
+method speculatively, based on potential future states.
+
+In these specifications user agents might invoke methods on a class at any time, and with any
+arguments, not just ones corresponding to the current state of the user agent. The results of such
+speculative evaluations are not displayed immediately, but may be cached for use if the user agent
+state matches the speculated state. This may increase the concurrency between the user agent and
+worklet threads.
+
+As a result of this, to prevent this compatibility risk between user agents, authors who register
+classes on the global scope using these APIs, should make their code stateless. That is, the only
+effect of invoking a method should be its result, not any side-effects such as updating mutable
+state.
+
+The same techniques which encourage code idempotence also encourage authors to write stateless code.
+
Infrastructure {#infrastructure}
================================