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; |