OLD | NEW |
1 # CSS Paint API | 1 # CSS Paint API |
2 | 2 |
3 This directory contains the implementation of the CSS Paint API. | 3 This directory contains the implementation of the CSS Paint API. |
4 | 4 |
5 See [CSS Paint API](https://drafts.css-houdini.org/css-paint-api/) for the web e
xposed APIs this | 5 See [CSS Paint API](https://drafts.css-houdini.org/css-paint-api/) for the web e
xposed APIs this |
6 implements. | 6 implements. |
7 | 7 |
8 ## Implementation | 8 ## Implementation |
9 | 9 |
10 ### [CSSPaintDefinition](CSSPaintDefinition.h) | 10 ### [CSSPaintDefinition](CSSPaintDefinition.h) |
11 | 11 |
12 Represents a class registered by the author through `PaintWorkletGlobalScope#reg
isterPaint`. | 12 Represents a class registered by the author through `PaintWorkletGlobalScope#reg
isterPaint`. |
13 Specifically this class holds onto the javascript constructor and paint function
s of the class via | 13 Specifically this class holds onto the javascript constructor and paint function
s of the class via |
14 persistent handles. This class keeps these functions alive so they don't get gar
bage collected. | 14 persistent handles. This class keeps these functions alive so they don't get gar
bage collected. |
15 | 15 |
16 The `CSSPaintDefinition` also holds onto an instance of the paint class va a per
sistent handle. This | 16 The `CSSPaintDefinition` also holds onto an instance of the paint class via a pe
rsistent handle. This |
17 instance is lazily created upon first use. If the constructor throws for some re
ason the constructor | 17 instance is lazily created upon first use. If the constructor throws for some re
ason the constructor |
18 is marked as invalid and will always produce invalid images. | 18 is marked as invalid and will always produce invalid images. |
19 | 19 |
20 The `PaintWorkletGlobalScope` has a map of paint `name` to `CSSPaintDefinition`. | 20 The `PaintWorkletGlobalScope` has a map of paint `name` to `CSSPaintDefinition`. |
21 | 21 |
22 ### [CSSPaintImageGenerator][generator] and [CSSPaintImageGeneratorImpl][generat
or-impl] | 22 ### [CSSPaintImageGenerator][generator] and [CSSPaintImageGeneratorImpl][generat
or-impl] |
23 | 23 |
24 `CSSPaintImageGenerator` represents the interface from which the `CSSPaintValue`
can generate | 24 `CSSPaintImageGenerator` represents the interface from which the `CSSPaintValue`
can generate |
25 `Image`s. This is done via the `CSSPaintImageGenerator#paint` method. Each `CSSP
aintValue` owns a | 25 `Image`s. This is done via the `CSSPaintImageGenerator#paint` method. Each `CSSP
aintValue` owns a |
26 separate instance of `CSSPaintImageGenerator`. | 26 separate instance of `CSSPaintImageGenerator`. |
(...skipping 28 matching lines...) Expand all Loading... |
55 During style invalidation `ComputedStyle` checks if it has any `CSSPaintValue`s,
and if any of their | 55 During style invalidation `ComputedStyle` checks if it has any `CSSPaintValue`s,
and if any of their |
56 properties have changed; if so it will invalidate paint for that `ComputedStyle`
. | 56 properties have changed; if so it will invalidate paint for that `ComputedStyle`
. |
57 | 57 |
58 If the `CSSPaintValue` doesn't have a corresponding `CSSPaintDefinition` yet, it
doesn't invalidate | 58 If the `CSSPaintValue` doesn't have a corresponding `CSSPaintDefinition` yet, it
doesn't invalidate |
59 paint. | 59 paint. |
60 | 60 |
61 ## Testing | 61 ## Testing |
62 | 62 |
63 Tests live [here](../../../LayoutTests/csspaint/). | 63 Tests live [here](../../../LayoutTests/csspaint/). |
64 | 64 |
OLD | NEW |