Skip to content

Commit ac7e941

Browse files
committed
[css-paint-api] Remove the concept of overflow from paint.
1 parent 9f541de commit ac7e941

File tree

1 file changed

+16
-39
lines changed

1 file changed

+16
-39
lines changed

css-paint-api/Overview.bs

+16-39
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ The {{RenderWorkletGlobalScope}} has a map of <b>name to paint instance map</b>.
8383
callback interface PaintClass {
8484
readonly attribute sequence&lt;DOMString&gt; inputProperties;
8585
void paint(PaintRenderingContext2D ctx, Geometry geom, StylePropertyMap inputProperties);
86-
void overflow(StylePropertyMap inputProperties);
8786
};
8887
</pre>
8988
</div>
@@ -94,12 +93,11 @@ When the <dfn method for=RenderWorkletGlobalScope>registerPaint(<var>name</var>,
9493
3. If the result of <a>IsConstructor</a>(argument=|paintCtor|) is false, <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
9594
4. Let <var>prototype</var> be the result of <a>Get</a>(O=|paintCtor|, P="prototype").
9695
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}}.
103101

104102
Note: The list of CSS properties provided by the input properties getter can either be custom or native CSS properties.
105103

@@ -155,14 +153,8 @@ Note: The {{PaintRenderingContext2D}} implements a subset of the {{CanvasRenderi
155153
{{CanvasUserInterface}} APIs.
156154

157155
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.
166158

167159
The size of the <a>scratch bitmap</a> does not necessarily represent the size of the actual bitmap
168160
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
174166
correct resolution. This also allows user agents to re-use the same output of the <a>scratch
175167
bitmap</a> repeatably while the visual viewport is being zoomed for example.
176168

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:
179171
1. Create a new {{PaintRenderingContext2D}}.
180172
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}}.
183174

184175
Drawing an image {#drawing-an-image}
185176
====================================
@@ -211,32 +202,18 @@ When the user agent wants to <dfn>draw an image</dfn> of a <<paint()>> for a <va
211202

212203
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|.
213204

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|.
229208

230209
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.
231210
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.
232211

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|.
236213

237214
Issue(w3c/css-houdini-drafts#23): Decide geometry information should be in level 1.
238215

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:
240217
- To <a>create a worklet global scope</a> the user agent will:
241218

242219
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
250227

251228
Note: User agents should provide tooling within their debugging tools to show authors a partial output of the image, if an exception is thrown.
252229

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>.
254231

255232
Note: The user agent should consider long running paint functions similar to long running script in the main execution context.
256233
For example, they should show a "unresponsive script" dialog or similar.

0 commit comments

Comments
 (0)