| Index: third_party/WebKit/LayoutTests/csspaint/resources/generate-paint-style-logging.js
|
| diff --git a/third_party/WebKit/LayoutTests/csspaint/resources/generate-paint-style-logging.js b/third_party/WebKit/LayoutTests/csspaint/resources/generate-paint-style-logging.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e9175beb8b719acfda31a8296776c309142f23c6
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/csspaint/resources/generate-paint-style-logging.js
|
| @@ -0,0 +1,24 @@
|
| +// Generates code for a CSS paint API function which logs the given properties
|
| +// to the console.
|
| +//
|
| +// Usage:
|
| +// generatePaintStyleLogging([
|
| +// '--foo',
|
| +// 'line-height',
|
| +// ]);
|
| +
|
| +function generatePaintStyleLogging(properties) {
|
| + const json = JSON.stringify(properties);
|
| + return `
|
| + registerPaint('test', class {
|
| + static get inputProperties() { return ${json}; }
|
| + paint(ctx, geom, styleMap) {
|
| + const properties = styleMap.getProperties().sort();
|
| + for (let i = 0; i < properties.length; i++) {
|
| + const value = styleMap.get(properties[i]);
|
| + console.log(properties[i] + ': ' + (value ? value.cssString : '[null]'));
|
| + }
|
| + }
|
| + });
|
| + `;
|
| +}
|
|
|