You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -94,12 +93,11 @@ When the <dfn method for=RenderWorkletGlobalScope>registerPaint(<var>name</var>,
94
93
3. If the result of <a>IsConstructor</a>(argument=|paintCtor|) is false, <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
95
94
4. Let <var>prototype</var> be the result of <a>Get</a>(O=|paintCtor|, P="prototype").
96
95
5. If the result of <a>IsCallable</a>(argument=<a>Get</a>(O=|prototype|, P="paint")) is false, <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
97
-
6. If the result of <a>HasProperty</a>(O=|prototype|, P="overflow") and <a>IsCallable</a>(argument=<a>Get</a>(O=|prototype|, P="overflow")) is false, <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
98
-
7. Let <var>inputProperties</var> be the result of <a>Get</a>(O=|paintCtor|, P="inputProperties").
99
-
8. If the result of <a>IsArray</a>(argument=|inputProperties|) is false, <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
100
-
9. Add the key-value pair (|name| - |inputProperties|) to the <b>paint name to input properties map</b> of the associated <a>document</a>.
101
-
10. Let <var>paintInstance</var> be the result of <a>Construct</a>(|paintCtor|).
102
-
11. Add the key-value pair (|name| - |paintInstance|) to the <b>name to paint instance map</b> of the {{RenderWorkletGlobalScope}}.
96
+
6. Let <var>inputProperties</var> be the result of <a>Get</a>(O=|paintCtor|, P="inputProperties").
97
+
7. If the result of <a>IsArray</a>(argument=|inputProperties|) is false, <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
98
+
8. Add the key-value pair (|name| - |inputProperties|) to the <b>paint name to input properties map</b> of the associated <a>document</a>.
99
+
9. Let <var>paintInstance</var> be the result of <a>Construct</a>(|paintCtor|).
100
+
10. Add the key-value pair (|name| - |paintInstance|) to the <b>name to paint instance map</b> of the {{RenderWorkletGlobalScope}}.
103
101
104
102
Note: The list of CSS properties provided by the input properties getter can either be custom or native CSS properties.
105
103
@@ -155,14 +153,8 @@ Note: The {{PaintRenderingContext2D}} implements a subset of the {{CanvasRenderi
155
153
{{CanvasUserInterface}} APIs.
156
154
157
155
A {{PaintRenderingContext2D}} object has a <a>scratch bitmap</a>. This is initialised when the
158
-
object is created. The size of the <a>scratch bitmap</a> is the size of the fragment it is rendering
159
-
plus the size specified by the overflow method.
160
-
161
-
The logical origin (0,0) is not necessarily placed at the origin of the <a>scratch bitmap</a>. If
162
-
the fragment which is being painted has an associated overflow, the logical origin is placed at
163
-
(overflow-left,overflow-top) of the <a>scratch bitmap</a>.
164
-
165
-
Issue: Add image explaining origin vs. logical origin.
156
+
object is created. The size of the <a>scratch bitmap</a> is the size of the fragment it is
157
+
rendering.
166
158
167
159
The size of the <a>scratch bitmap</a> does not necessarily represent the size of the actual bitmap
168
160
that the user agent will use internally or during rendering. For example, if the visual viewport is
@@ -174,12 +166,11 @@ the <a>scratch bitmap</a> such that the user agent can subsequently draw onto a
174
166
correct resolution. This also allows user agents to re-use the same output of the <a>scratch
175
167
bitmap</a> repeatably while the visual viewport is being zoomed for example.
176
168
177
-
When the user agent is to <dfn>create a PaintRenderingContext2D object</dfn> for a given
178
-
|width|, |height| and |overflowOffset| it <em>must</em> run the following steps:
169
+
When the user agent is to <dfn>create a PaintRenderingContext2D object</dfn> for a given |width|,
170
+
|height| it <em>must</em> run the following steps:
179
171
1. Create a new {{PaintRenderingContext2D}}.
180
172
2. <a>Set bitmap dimensions</a> for the context's <a>scratch bitmap</a> to |width| and |height|.
181
-
3. Set the logical origin of the <a>scratch bitmap</a> to |overflowOffset|.
182
-
4. Return the new {{PaintRenderingContext2D}}.
173
+
3. Return the new {{PaintRenderingContext2D}}.
183
174
184
175
Drawing an image {#drawing-an-image}
185
176
====================================
@@ -211,32 +202,18 @@ When the user agent wants to <dfn>draw an image</dfn> of a <<paint()>> for a <va
211
202
212
203
5. Let <var>styleMap</var> be a new {{StylePropertyMap}} populated with <em>only</em> the <a>computed value</a>'s for properties listed in |inputProperties|.
213
204
214
-
6. Let <var>overflow</var> be the result <a>invoke a method on a class inside a Worklet</a> given "overflow" as the <em>methodPropertyKey</em> and [|styleMap|] as the <em>arguments</em> with the following options:
215
-
- To <a>create a worklet global scope</a> the user agent will:
216
-
217
-
Return a new {{RenderWorkletGlobalScope}}.
218
-
- To <a>lookup a class instance on a worklet global scope</a> given a |workletGlobalScope|, the user agent will:
219
-
220
-
Return the result of looking up |name| on the |workletGlobalScope|'s <b>name to paint instance map</b>.
221
-
222
-
Note: User agents may have to compute overflow before entering their paint phase in order to determine which fragments to paint (overflow changes what could be seen on the output device).
223
-
User agents may opt into running the steps up to this point, to determine overflow, then continuing later to determine the drawn image for the fragments which need painting.
224
-
225
-
7. Let <var>renderingContext</var> be the result of <a>create a PaintRenderingContext2D object</a> given:
226
-
- "overflowOffset" - The logical offset for the <a>scratch bitmap</a> specified by |overflow|.
227
-
- "width" - The width of the |fragment| plus the additional width specified by |overflow|.
228
-
- "height" - The height of the |fragment| plus the additional height specified by |overflow|.
205
+
6. Let <var>renderingContext</var> be the result of <a>create a PaintRenderingContext2D object</a> given:
206
+
- "width" - The width of the |fragment|.
207
+
- "height" - The height of the |fragment|.
229
208
230
209
Note: The |renderingContext| must not be re-used between invocations of paint. Implicitly this means that there is no stored data, or state on the |renderingContext| between invocations.
231
210
For example you can't setup a clip on the context, and expect the same clip to be applied next time the paint method is called.
232
211
233
-
Issue: TODO add note we should specify the output of overflow.
234
-
235
-
8. Let <var>geometry</var> be a new {{Geometry}} initialized to the width and height of the |fragment|.
212
+
7. Let <var>geometry</var> be a new {{Geometry}} initialized to the width and height of the |fragment|.
236
213
237
214
Issue(w3c/css-houdini-drafts#23): Decide geometry information should be in level 1.
238
215
239
-
9. To produce the image output, <a>invoke a method on a class inside a Worklet</a> given "paint" as the <em>methodPropertyKey</em> and [|renderingContext|, |geometry|, |styleMap|] as the <em>arguments</em> with the following options:
216
+
8. To produce the image output, <a>invoke a method on a class inside a Worklet</a> given "paint" as the <em>methodPropertyKey</em> and [|renderingContext|, |geometry|, |styleMap|] as the <em>arguments</em> with the following options:
240
217
- To <a>create a worklet global scope</a> the user agent will:
241
218
242
219
Return a new {{RenderWorkletGlobalScope}}.
@@ -250,7 +227,7 @@ When the user agent wants to <dfn>draw an image</dfn> of a <<paint()>> for a <va
250
227
251
228
Note: User agents should provide tooling within their debugging tools to show authors a partial output of the image, if an exception is thrown.
252
229
253
-
10. Set the <b>paint valid flag</b> for the <<paint()>> function on the |fragment| to <a>paint-valid</a>.
230
+
9. Set the <b>paint valid flag</b> for the <<paint()>> function on the |fragment| to <a>paint-valid</a>.
254
231
255
232
Note: The user agent should consider long running paint functions similar to long running script in the main execution context.
256
233
For example, they should show a "unresponsive script" dialog or similar.
0 commit comments