Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1767)

Unified Diff: third_party/WebKit/LayoutTests/csspaint/resources/generate-paint-style-logging.js

Issue 2054023002: [CSS Paint API] Add StylePropertyMap as an argument to the paint function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/style-background-image.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]'));
+ }
+ }
+ });
+ `;
+}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/style-background-image.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698