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) |
(...skipping 23 matching lines...) Expand all Loading... |
34 If the paint worklet does not have a `CSSPaintDefinition` matching the paint `na
me` the | 34 If the paint worklet does not have a `CSSPaintDefinition` matching the paint `na
me` the |
35 `CSSPaintImageGeneratorImpl` is placed in a "pending" map. Once a paint class wi
th `name` is | 35 `CSSPaintImageGeneratorImpl` is placed in a "pending" map. Once a paint class wi
th `name` is |
36 registered the generator is notified so it can invalidate an display the correct
image. | 36 registered the generator is notified so it can invalidate an display the correct
image. |
37 | 37 |
38 [generator]: ../../core/css/CSSPaintImageGenerator.h | 38 [generator]: ../../core/css/CSSPaintImageGenerator.h |
39 [generator-impl]: CSSPaintImageGeneratorImpl.h | 39 [generator-impl]: CSSPaintImageGeneratorImpl.h |
40 [paint-value]: ../../core/css/CSSPaintValue.h | 40 [paint-value]: ../../core/css/CSSPaintValue.h |
41 | 41 |
42 ### Generating a [PaintGeneratedImage](../../platform/graphics/PaintGeneratedIma
ge.h) | 42 ### Generating a [PaintGeneratedImage](../../platform/graphics/PaintGeneratedIma
ge.h) |
43 | 43 |
44 `PaintGeneratedImage` is a `Image` which just paints a single `SkPicture`. | 44 `PaintGeneratedImage` is a `Image` which just paints a single `PaintRecord`. |
45 | 45 |
46 A `CSSPaintValue` can generate an image from the method `CSSPaintImageGenerator#
paint`. This method | 46 A `CSSPaintValue` can generate an image from the method `CSSPaintImageGenerator#
paint`. This method |
47 calls through to `CSSPaintDefinition#paint` which actually invokes the javascrip
t paint method. | 47 calls through to `CSSPaintDefinition#paint` which actually invokes the javascrip
t paint method. |
48 This method returns the `PaintGeneratedImage`. | 48 This method returns the `PaintGeneratedImage`. |
49 | 49 |
50 The `SkPicture` is produced from a `RecordingImageBufferSurface`. | 50 The `PaintRecord` is produced from a `RecordingImageBufferSurface`. |
51 | 51 |
52 ### Style Invalidation | 52 ### Style Invalidation |
53 | 53 |
54 The `CSSPaintDefinition` keeps a list of both native and custom properties it wi
ll invalidate on. | 54 The `CSSPaintDefinition` keeps a list of both native and custom properties it wi
ll invalidate on. |
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 |