-
Notifications
You must be signed in to change notification settings - Fork 141
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
Allow speculative evaluation #439
Changes from 3 commits
28084b3
5e309c7
ac505d8
a0d3cba
a2e7e63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,7 +437,8 @@ Note: The user agent can optionally defer drawing images which are <a>paint-inva | |
</div> | ||
|
||
The <a>draw a paint image</a> function is invoked by the user agent during the <a>object size | ||
negotiation</a> algorithm which is responsible for rendering an <<image>>. | ||
negotiation</a> algorithm which is responsible for rendering an <<image>>, | ||
with |concreteObjectSize| set to the <a>concrete object size</a> of the <a>box</a>. | ||
|
||
For the purposes of the <a>object size negotiation</a> algorithm, the paint image has no | ||
<a>intrinsic dimensions</a>. | ||
|
@@ -450,6 +451,15 @@ Note: In a future version of the spec, the author could have the ability to spec | |
The {{PaintSize}} object represents the size of the image that the author should draw. This is | ||
the <a>concrete object size</a> given by the user agent. | ||
|
||
The <a>draw a paint image</a> function may be speculatively invoked by the user agent at any point, | ||
with any |concreteObjectSize|. The resulting image is not displayed. | ||
|
||
Note: User agents may use any heuristic to speculate a possible future value | ||
for |concretObjectSize|, for example speculating that the size remains unchanged. | ||
|
||
Note: Although the image is not displayed, it may still be cached, and subsequent invocations | ||
of <<paint()>> may use the cached image. | ||
|
||
<pre class='idl'> | ||
[Exposed=PaintWorklet] | ||
interface PaintSize { | ||
|
@@ -461,12 +471,12 @@ interface PaintSize { | |
<div algorithm> | ||
When the user agent wants to <dfn>draw a paint image</dfn> of a <<paint()>> function for a |box| | ||
into its appropriate stacking level (as defined by the property the CSS property its associated | ||
with), given its |concreteObjectSize| (<a>concrete object size</a>) it <em>must</em> run the | ||
following steps: | ||
with), given |concreteObjectSize| it <em>must</em> run the following steps: | ||
1. Let |paintFunction| be the <<paint()>> function on the |box| which the user agent wants to | ||
draw. | ||
|
||
2. If the <a>paint valid flag</a> for the |paintFunction| is <a>paint-valid</a> the user agent | ||
2. If the <a>paint valid flag</a> for the |paintFunction| is <a>paint-valid</a>, | ||
and the previous invocation had the same |concreteObjectSize|, the user agent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This implies that there can only ever be one speculative evaluation at a time. If we want to allow speculating multiple frames ahead, this should probably say something about checking for results of a speculative evaluation that match the input state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the discussion of the paint valid flag is dubious, perhaps we should just delete it? It's very single-threaded. This is probably a separate issue though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a separate section which allows for the caching inside "invoke a paint callback", see step 10. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bfgeek yes, this is why I was thinking we could just remove all the stuff about the paint valid flag, since we're already allowing caching inside "invoke a paint callback". Shall I submit a separate PR for that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that sounds good, we still need to describe how the inputProperties invalidate that image on a box, but we can have that in prose vs. as an algorithm. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I'll file an issue for this. |
||
<em>may</em> use the drawn image from the previous invocation. If so it <em>may</em> abort | ||
all these steps and use the previously drawn image. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to be this general about which value the function might be invoked with and when? Being more explicit about when and why a user agent might do this might be useful:
"The draw a paint image function may be speculatively invoked by the user agent with an expected value for |concreteObjectSize|. Once the |concreteObjectSize| is known, the resulting image either used if the speculation succeeded or discarded if the speculation failed."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added text to the note: "Note: User agents may use whichever heuristics to speculate a possible future value for |concretObjectSize|, for example speculating that the size remains unchanged." I'm not sure that we want to say more about how to speculate in the normative text.
I replaced "discarded" by "not displayed", which is hopefully less confusing.