@@ -78,43 +78,6 @@ response to size / computed style changes with an additional <<image>> function.
7878Note: In a future version of the spec, support could be added for defining the clip, global alpha,
7979 filter on a portion of a box (for example on the background layers).
8080
81- Paint Invalidation {#paint-invalidation}
82- ========================================
83-
84- Each <<paint()>> function for a box has an associated <dfn>paint valid flag</dfn> . It may be either
85- <dfn>paint-valid</dfn> or <dfn>paint-invalid</dfn> . It is initially set to <a>paint-invalid</a> .
86-
87- <div algorithm>
88- When the user agent wants to <dfn>invalidate paint functions</dfn> given |box|, the user agent
89- <em> must</em> run the following steps:
90- 1. For each <<paint()>> function on the |box|, perform the following steps:
91- 1. Let |paintFunction| be the current <<paint()>> function on the |box|.
92-
93- 2. Let |name| be the first argument of the <<paint()>> function.
94-
95- 3. Let |documentPaintDefinitionMap| be the associated <a>document</a> 's <a>document paint
96- definitions</a> map.
97-
98- 4. Let |documentDefinition| be the result of <a>get</a>
99- |documentPaintDefinitionMap|[|name|] .
100-
101- 5. Let |inputProperties| be |documentDefinition|'s <a for="document paint definition">input
102- properties</a> list.
103-
104- 6. For each |property| in |inputProperties|, if the |property|'s <a>computed value</a> has
105- changed, set the <a>paint valid flag</a> on the |paintFunction| to <a>paint-invalid</a> .
106- </div>
107-
108- Performing <a>draw a paint image</a> results in the <a>paint valid flag</a> for a <<paint()>>
109- function on a box to be set to <a>paint-valid</a> .
110-
111- <a>Invalidate paint functions</a> <em> must</em> be run when the user agent recalculates the computed
112- style for a box.
113-
114- Note: In a future version of the spec, support could be added for partial invalidation. The user
115- agent will be able to specify a region of the rendering context which needs to be re-painted by
116- the paint class.
117-
11881Paint Worklet {#paint-worklet}
11982==============================
12083
@@ -446,11 +409,14 @@ Note: This should eventually be moved to the canvas section of the HTML specific
446409Drawing an image {#drawing-an-image}
447410====================================
448411
449- If a <<paint()>> function for a <a>box</a> is <a>paint-invalid</a> and the <a>box</a> is inside the
450- visual viewport, then user agent <em> must</em> <a>draw a paint image</a> for the current frame .
412+ If a <<paint()>> function image for a <a>box</a> is within the visual viewport, the user agent
413+ <em> must</em> display an image output from an invocation of the <a>draw a paint image</a> algorithm .
451414
452- Note: The user agent can optionally defer drawing images which are <a>paint-invalid</a> and outside
453- the visual viewport.
415+ Note: The user agent doesn't have to run <a>draw a paint image</a> each frame for a <<paint()>>
416+ function within the visual viewport. It can cache results, (potentially using additional
417+ invalidation steps) to display the correct image output.
418+
419+ Note: The user agent can optionally defer drawing images which are outside the visual viewport.
454420
455421<div class="example">
456422 If an author updates a style inside a <code> requestAnimationFrame</code> , e.g.
@@ -510,38 +476,28 @@ with), given |snappedConcreteObjectSize| it <em>must</em> run the following step
510476 1. Let |paintFunction| be the <<paint()>> function on the |box| which the user agent wants to
511477 draw.
512478
513- 2. If the <a>paint valid flag</a> for the |paintFunction| is <a>paint-valid</a> , and the
514- previous invocation had the same |snappedConcreteObjectSize|, the user agent <em> may</em> use the
515- drawn image from the previous invocation. If so it <em> may</em> abort all these steps and
516- use the previously drawn image.
517-
518- Note: The user agent for implementation reasons may also continue with all these steps in
519- this case. It can do this every frame, or multiple times per frame.
520-
521- 3. Set the <a>paint valid flag</a> for the |paintFunction| to <a>paint-valid</a> .
522-
523- 4. Let |name| be the first argument of the |paintFunction|.
479+ 2. Let |name| be the first argument of the |paintFunction|.
524480
525- 5 . Let |documentPaintDefinitionMap| be the associated <a>document's</a> <a>document paint
481+ 3 . Let |documentPaintDefinitionMap| be the associated <a>document's</a> <a>document paint
526482 definitions</a> map.
527483
528- 6 . If |documentPaintDefinitionMap|[|name|] does not <a for=map>exist</a> , let the image output
484+ 4 . If |documentPaintDefinitionMap|[|name|] does not <a for=map>exist</a> , let the image output
529485 be an <a>invalid image</a> and abort all these steps.
530486
531- 7 . Let |documentDefinition| be the result of <a for=map>get</a>
487+ 5 . Let |documentDefinition| be the result of <a for=map>get</a>
532488 |documentPaintDefinitionMap|[|name|] .
533489
534- 8 . If |documentDefinition| is <code> "invalid"</code> , let the image output be an <a>invalid
490+ 6 . If |documentDefinition| is <code> "invalid"</code> , let the image output be an <a>invalid
535491 image</a> and abort all these steps.
536492
537- 9 . Let |inputArgumentSyntaxes| be |documentDefinition|'s <a for="document paint
493+ 7 . Let |inputArgumentSyntaxes| be |documentDefinition|'s <a for="document paint
538494 definition">input argument syntaxes</a> .
539495
540- 10 . Let |inputArguments| be the <a>list</a> of all the |paintFunction| arguments <em> after</em>
496+ 8 . Let |inputArguments| be the <a>list</a> of all the |paintFunction| arguments <em> after</em>
541497 the "paint name" argument.
542498
543- 11 . If |inputArguments| do not match the registered grammar given by |inputArgumentSyntaxes|,
544- let the image output be an <a>invalid image</a> and abort all these steps.
499+ 9 . If |inputArguments| do not match the registered grammar given by |inputArgumentSyntaxes|, let
500+ the image output be an <a>invalid image</a> and abort all these steps.
545501
546502 <div class=example>
547503 This step may fail in the following cases:
@@ -577,14 +533,14 @@ with), given |snappedConcreteObjectSize| it <em>must</em> run the following step
577533 arguments.
578534 </div>
579535
580- 12 . Let |workletGlobalScope| be a {{PaintWorkletGlobalScope}} from the list of <a>worklet's
536+ 10 . Let |workletGlobalScope| be a {{PaintWorkletGlobalScope}} from the list of <a>worklet's
581537 WorkletGlobalScopes</a> from the paint {{Worklet}} , following the rules defined in
582538 [[#global-scope-selection]] .
583539
584540 The user agent <em> may</em> also <a>create a WorkletGlobalScope</a> at this time, given the
585541 paint {{Worklet}} .
586542
587- 13 . Run <a>invoke a paint callback</a> given |name|, |inputArguments|, |snappedConcreteObjectSize|,
543+ 11 . Run <a>invoke a paint callback</a> given |name|, |inputArguments|, |snappedConcreteObjectSize|,
588544 |workletGlobalScope| optionally <a>in parallel</a> .
589545
590546 Note: If the user agent runs <a>invoke a paint callback</a> on a thread <a>in parallel</a> ,
0 commit comments