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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 var fs = require('fs');
2 var sizeOf = require('image-size');
3
4 class SVGSprite {
5 /**
6 * @param {string} filePath
7 * @param {string} content
8 * @param {number} width
9 * @param {number} height
10 */
11 constructor(filePath, content, width, height) {
12 this.filePath = filePath;
13 this.content = content;
14 this.width = width;
15 this.height = height;
16 }
17
18 /**
19 * @param {string} filePath
20 * @return {!SVGSprite}
21 */
22 static loadFromFile(filePath) {
23 var content = fs.readFileSync(filePath, 'utf-8');
24 var dimensions = sizeOf(filePath);
25 return new SVGSprite(filePath, content, dimensions.width, dimensions.height) ;
26 }
27 };
28
29 module.exports = SVGSprite;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698