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

Unified Diff: third_party/WebKit/Source/devtools/scripts/spritesheet_assembler/SVGSprite.js

Issue 2671413004: DevTools: introduce spritesheet assembler. (Closed)
Patch Set: rebaseline tests Created 3 years, 10 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
Index: third_party/WebKit/Source/devtools/scripts/spritesheet_assembler/SVGSprite.js
diff --git a/third_party/WebKit/Source/devtools/scripts/spritesheet_assembler/SVGSprite.js b/third_party/WebKit/Source/devtools/scripts/spritesheet_assembler/SVGSprite.js
new file mode 100644
index 0000000000000000000000000000000000000000..f0ef0b0f7bb34ca8f3056e2c70c656770cb9c358
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/scripts/spritesheet_assembler/SVGSprite.js
@@ -0,0 +1,29 @@
+var fs = require('fs');
+var sizeOf = require('image-size');
+
+class SVGSprite {
+ /**
+ * @param {string} filePath
+ * @param {string} content
+ * @param {number} width
+ * @param {number} height
+ */
+ constructor(filePath, content, width, height) {
+ this.filePath = filePath;
+ this.content = content;
+ this.width = width;
+ this.height = height;
+ }
+
+ /**
+ * @param {string} filePath
+ * @return {!SVGSprite}
+ */
+ static loadFromFile(filePath) {
+ var content = fs.readFileSync(filePath, 'utf-8');
+ var dimensions = sizeOf(filePath);
+ return new SVGSprite(filePath, content, dimensions.width, dimensions.height);
+ }
+};
+
+module.exports = SVGSprite;

Powered by Google App Engine
This is Rietveld 408576698