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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/Icon.js

Issue 2678863004: DevTools: eliminate UI.Icon transforms (Closed)
Patch Set: recompile png's with inkscape v0.48 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs_2x.png ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {HTMLSpanElement} 7 * @extends {HTMLSpanElement}
8 */ 8 */
9 UI.Icon = class extends HTMLSpanElement { 9 UI.Icon = class extends HTMLSpanElement {
10 constructor() { 10 constructor() {
(...skipping 30 matching lines...) Expand all
41 41
42 /** 42 /**
43 * @param {string} iconType 43 * @param {string} iconType
44 */ 44 */
45 setIconType(iconType) { 45 setIconType(iconType) {
46 if (this._descriptor) { 46 if (this._descriptor) {
47 this.style.removeProperty('-webkit-mask-position'); 47 this.style.removeProperty('-webkit-mask-position');
48 this.style.removeProperty('background-position'); 48 this.style.removeProperty('background-position');
49 this.style.removeProperty('width'); 49 this.style.removeProperty('width');
50 this.style.removeProperty('height'); 50 this.style.removeProperty('height');
51 this.style.removeProperty('transform');
52 this._toggleClasses(false); 51 this._toggleClasses(false);
53 this._iconType = ''; 52 this._iconType = '';
54 this._descriptor = null; 53 this._descriptor = null;
55 } 54 }
56 var descriptor = UI.Icon.Descriptors[iconType] || null; 55 var descriptor = UI.Icon.Descriptors[iconType] || null;
57 if (descriptor) { 56 if (descriptor) {
58 this._iconType = iconType; 57 this._iconType = iconType;
59 this._descriptor = descriptor; 58 this._descriptor = descriptor;
60 this.style.setProperty('-webkit-mask-position', this._propertyValue()); 59 this.style.setProperty('-webkit-mask-position', this._propertyValue());
61 this.style.setProperty('background-position', this._propertyValue()); 60 this.style.setProperty('background-position', this._propertyValue());
62 this.style.setProperty('width', this._descriptor.width + 'px'); 61 this.style.setProperty('width', this._descriptor.width + 'px');
63 this.style.setProperty('height', this._descriptor.height + 'px'); 62 this.style.setProperty('height', this._descriptor.height + 'px');
64 if (this._descriptor.transform)
65 this.style.setProperty('transform', this._descriptor.transform);
66 this._toggleClasses(true); 63 this._toggleClasses(true);
67 } else if (iconType) { 64 } else if (iconType) {
68 throw new Error(`ERROR: failed to find icon descriptor for type: ${iconTyp e}`); 65 throw new Error(`ERROR: failed to find icon descriptor for type: ${iconTyp e}`);
69 } 66 }
70 } 67 }
71 68
72 /** 69 /**
73 * @param {boolean} value 70 * @param {boolean} value
74 */ 71 */
75 _toggleClasses(value) { 72 _toggleClasses(value) {
(...skipping 16 matching lines...) Expand all
92 /** @enum {!UI.Icon.Descriptor} */ 89 /** @enum {!UI.Icon.Descriptor} */
93 UI.Icon.Descriptors = { 90 UI.Icon.Descriptors = {
94 'smallicon-error': {x: -20, y: 0, width: 10, height: 10, spritesheet: 'smallic ons'}, 91 'smallicon-error': {x: -20, y: 0, width: 10, height: 10, spritesheet: 'smallic ons'},
95 'smallicon-warning': {x: -60, y: 0, width: 10, height: 10, spritesheet: 'small icons'}, 92 'smallicon-warning': {x: -60, y: 0, width: 10, height: 10, spritesheet: 'small icons'},
96 'smallicon-info': {x: -80, y: 0, width: 10, height: 10, spritesheet: 'smallico ns'}, 93 'smallicon-info': {x: -80, y: 0, width: 10, height: 10, spritesheet: 'smallico ns'},
97 'smallicon-device': {x: -100, y: 0, width: 10, height: 10, spritesheet: 'small icons'}, 94 'smallicon-device': {x: -100, y: 0, width: 10, height: 10, spritesheet: 'small icons'},
98 'smallicon-red-ball': {x: -120, y: 0, width: 10, height: 10, spritesheet: 'sma llicons'}, 95 'smallicon-red-ball': {x: -120, y: 0, width: 10, height: 10, spritesheet: 'sma llicons'},
99 'smallicon-green-ball': {x: -140, y: 0, width: 10, height: 10, spritesheet: 's mallicons'}, 96 'smallicon-green-ball': {x: -140, y: 0, width: 10, height: 10, spritesheet: 's mallicons'},
100 'smallicon-orange-ball': {x: -160, y: 0, width: 10, height: 10, spritesheet: ' smallicons'}, 97 'smallicon-orange-ball': {x: -160, y: 0, width: 10, height: 10, spritesheet: ' smallicons'},
101 'smallicon-thick-right-arrow': {x: -180, y: 0, width: 10, height: 10, spritesh eet: 'smallicons'}, 98 'smallicon-thick-right-arrow': {x: -180, y: 0, width: 10, height: 10, spritesh eet: 'smallicons'},
102 'smallicon-thick-left-arrow': 99 'smallicon-thick-left-arrow': {x: -180, y: -20, width: 10, height: 10, sprites heet: 'smallicons'},
103 {x: -180, y: 0, width: 10, height: 10, spritesheet: 'smallicons', transfor m: 'rotate(180deg)'},
104 'smallicon-user-command': {x: 0, y: -19, width: 10, height: 10, spritesheet: ' smallicons'}, 100 'smallicon-user-command': {x: 0, y: -19, width: 10, height: 10, spritesheet: ' smallicons'},
105 'smallicon-text-prompt': {x: -20, y: -20, width: 10, height: 10, spritesheet: 'smallicons'}, 101 'smallicon-text-prompt': {x: -20, y: -20, width: 10, height: 10, spritesheet: 'smallicons'},
106 'smallicon-command-result': {x: -40, y: -19, width: 10, height: 10, spriteshee t: 'smallicons'}, 102 'smallicon-command-result': {x: -40, y: -19, width: 10, height: 10, spriteshee t: 'smallicons'},
107 'smallicon-shadow': {x: -60, y: -20, width: 10, height: 10, spritesheet: 'smal licons', isMask: true}, 103 'smallicon-shadow': {x: -60, y: -20, width: 10, height: 10, spritesheet: 'smal licons', isMask: true},
108 'smallicon-bezier': {x: -80, y: -20, width: 10, height: 10, spritesheet: 'smal licons', isMask: true}, 104 'smallicon-bezier': {x: -80, y: -20, width: 10, height: 10, spritesheet: 'smal licons', isMask: true},
109 'smallicon-dropdown-arrow': {x: -18, y: -96, width: 12, height: 12, spriteshee t: 'largeicons', isMask: true}, 105 'smallicon-dropdown-arrow': {x: -18, y: -96, width: 12, height: 12, spriteshee t: 'largeicons', isMask: true},
110 'smallicon-triangle-right': {x: -4, y: -98, width: 10, height: 8, spritesheet: 'largeicons', isMask: true}, 106 'smallicon-triangle-right': {x: -4, y: -98, width: 10, height: 8, spritesheet: 'largeicons', isMask: true},
111 'smallicon-triangle-down': {x: -20, y: -98, width: 10, height: 8, spritesheet: 'largeicons', isMask: true}, 107 'smallicon-triangle-down': {x: -20, y: -98, width: 10, height: 8, spritesheet: 'largeicons', isMask: true},
112 'smallicon-triangle-up': {x: -4, y: -111, width: 10, height: 8, spritesheet: ' largeicons', isMask: true}, 108 'smallicon-triangle-up': {x: -4, y: -111, width: 10, height: 8, spritesheet: ' largeicons', isMask: true},
113 'smallicon-arrow-in-circle': {x: -10, y: -127, width: 11, height: 11, spritesh eet: 'largeicons', isMask: true}, 109 'smallicon-arrow-in-circle': {x: -10, y: -127, width: 11, height: 11, spritesh eet: 'largeicons', isMask: true},
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 'largeicon-pan': {x: -98, y: -120, width: 28, height: 24, spritesheet: 'largei cons', isMask: true}, 146 'largeicon-pan': {x: -98, y: -120, width: 28, height: 24, spritesheet: 'largei cons', isMask: true},
151 'largeicon-waterfall': {x: -128, y: -48, width: 28, height: 24, spritesheet: ' largeicons', isMask: true}, 147 'largeicon-waterfall': {x: -128, y: -48, width: 28, height: 24, spritesheet: ' largeicons', isMask: true},
152 'largeicon-filter': {x: -32, y: -48, width: 28, height: 24, spritesheet: 'larg eicons', isMask: true}, 148 'largeicon-filter': {x: -32, y: -48, width: 28, height: 24, spritesheet: 'larg eicons', isMask: true},
153 'largeicon-trash-bin': {x: -128, y: -24, width: 28, height: 24, spritesheet: ' largeicons', isMask: true}, 149 'largeicon-trash-bin': {x: -128, y: -24, width: 28, height: 24, spritesheet: ' largeicons', isMask: true},
154 'largeicon-pretty-print': {x: -256, y: -24, width: 28, height: 24, spritesheet : 'largeicons', isMask: true}, 150 'largeicon-pretty-print': {x: -256, y: -24, width: 28, height: 24, spritesheet : 'largeicons', isMask: true},
155 'largeicon-deactivate-breakpoints': {x: 0, y: -24, width: 28, height: 24, spri tesheet: 'largeicons', isMask: true}, 151 'largeicon-deactivate-breakpoints': {x: 0, y: -24, width: 28, height: 24, spri tesheet: 'largeicons', isMask: true},
156 'largeicon-activate-breakpoints': {x: -32, y: 0, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true}, 152 'largeicon-activate-breakpoints': {x: -32, y: 0, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true},
157 'largeicon-resume': {x: 0, y: -72, width: 28, height: 24, spritesheet: 'largei cons', isMask: true}, 153 'largeicon-resume': {x: 0, y: -72, width: 28, height: 24, spritesheet: 'largei cons', isMask: true},
158 'largeicon-pause': {x: -32, y: -72, width: 28, height: 24, spritesheet: 'large icons', isMask: true}, 154 'largeicon-pause': {x: -32, y: -72, width: 28, height: 24, spritesheet: 'large icons', isMask: true},
159 'largeicon-pause-on-exceptions': {x: -256, y: 0, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true}, 155 'largeicon-pause-on-exceptions': {x: -256, y: 0, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true},
160 'largeicon-play-back': 156 'largeicon-play-back': {x: -96, y: -48, width: 28, height: 24, spritesheet: 'l argeicons', isMask: true},
161 {x: -64, y: -48, width: 28, height: 24, spritesheet: 'largeicons', isMask: true, transform: 'scaleX(-1)'},
162 'largeicon-play': {x: -64, y: -48, width: 28, height: 24, spritesheet: 'largei cons', isMask: true}, 157 'largeicon-play': {x: -64, y: -48, width: 28, height: 24, spritesheet: 'largei cons', isMask: true},
163 'largeicon-step-over': {x: -128, y: -72, width: 28, height: 24, spritesheet: ' largeicons', isMask: true}, 158 'largeicon-step-over': {x: -128, y: -72, width: 28, height: 24, spritesheet: ' largeicons', isMask: true},
164 'largeicon-step-out': {x: -96, y: -72, width: 28, height: 24, spritesheet: 'la rgeicons', isMask: true}, 159 'largeicon-step-out': {x: -96, y: -72, width: 28, height: 24, spritesheet: 'la rgeicons', isMask: true},
165 'largeicon-step-in': {x: -64, y: -72, width: 28, height: 24, spritesheet: 'lar geicons', isMask: true}, 160 'largeicon-step-in': {x: -64, y: -72, width: 28, height: 24, spritesheet: 'lar geicons', isMask: true},
166 'largeicon-camera': {x: -96, y: -24, width: 28, height: 24, spritesheet: 'larg eicons', isMask: true}, 161 'largeicon-camera': {x: -96, y: -24, width: 28, height: 24, spritesheet: 'larg eicons', isMask: true},
167 'largeicon-stop-recording': {x: -288, y: -24, width: 28, height: 24, spriteshe et: 'largeicons', isMask: true}, 162 'largeicon-stop-recording': {x: -288, y: -24, width: 28, height: 24, spriteshe et: 'largeicons', isMask: true},
168 'largeicon-start-recording': {x: -288, y: 0, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true}, 163 'largeicon-start-recording': {x: -288, y: 0, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true},
169 'largeicon-large-list': {x: -224, y: 0, width: 28, height: 24, spritesheet: 'l argeicons', isMask: true}, 164 'largeicon-large-list': {x: -224, y: 0, width: 28, height: 24, spritesheet: 'l argeicons', isMask: true},
170 'largeicon-visibility': {x: -96, y: 0, width: 28, height: 24, spritesheet: 'la rgeicons', isMask: true}, 165 'largeicon-visibility': {x: -96, y: 0, width: 28, height: 24, spritesheet: 'la rgeicons', isMask: true},
171 'largeicon-refresh': {x: 0, y: 0, width: 28, height: 24, spritesheet: 'largeic ons', isMask: true}, 166 'largeicon-refresh': {x: 0, y: 0, width: 28, height: 24, spritesheet: 'largeic ons', isMask: true},
172 'largeicon-dock-to-right': {x: -256, y: -48, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true}, 167 'largeicon-dock-to-right': {x: -256, y: -48, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true},
173 'largeicon-dock-to-left': 168 'largeicon-dock-to-left': {x: -224, y: -48, width: 28, height: 24, spritesheet : 'largeicons', isMask: true},
174 {x: -256, y: -48, width: 28, height: 24, spritesheet: 'largeicons', isMask : true, transform: 'rotate(180deg)'},
175 'largeicon-dock-to-bottom': {x: -32, y: -24, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true}, 169 'largeicon-dock-to-bottom': {x: -32, y: -24, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true},
176 'largeicon-undock': {x: 0, y: -48, width: 28, height: 24, spritesheet: 'largei cons', isMask: true}, 170 'largeicon-undock': {x: 0, y: -48, width: 28, height: 24, spritesheet: 'largei cons', isMask: true},
177 'largeicon-settings-gear': {x: -288, y: -72, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true}, 171 'largeicon-settings-gear': {x: -288, y: -72, width: 28, height: 24, spriteshee t: 'largeicons', isMask: true},
178 172
179 'largeicon-show-left-sidebar': {x: -160, y: -72, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true}, 173 'largeicon-show-left-sidebar': {x: -160, y: -72, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true},
180 'largeicon-hide-left-sidebar': {x: -192, y: -72, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true}, 174 'largeicon-hide-left-sidebar': {x: -192, y: -72, width: 28, height: 24, sprite sheet: 'largeicons', isMask: true},
181 'largeicon-show-right-sidebar': 175 'largeicon-show-right-sidebar': {x: -192, y: -96, width: 28, height: 24, sprit esheet: 'largeicons', isMask: true},
182 {x: -160, y: -72, width: 28, height: 24, spritesheet: 'largeicons', isMask : true, transform: 'scaleX(-1)'}, 176 'largeicon-hide-right-sidebar': {x: -192, y: -120, width: 28, height: 24, spri tesheet: 'largeicons', isMask: true},
183 'largeicon-hide-right-sidebar':
184 {x: -192, y: -72, width: 28, height: 24, spritesheet: 'largeicons', isMask : true, transform: 'scaleX(-1)'},
185 'largeicon-show-top-sidebar': { 177 'largeicon-show-top-sidebar': {
186 x: -160, 178 x: -288,
187 y: -72, 179 y: -96,
188 width: 28, 180 width: 28,
189 height: 24, 181 height: 24,
190 spritesheet: 'largeicons', 182 spritesheet: 'largeicons',
191 isMask: true, 183 isMask: true,
192 transform: 'translate(4px, 0) rotate(90deg)'
193 }, 184 },
194 'largeicon-hide-top-sidebar': { 185 'largeicon-hide-top-sidebar': {
195 x: -192, 186 x: -256,
196 y: -72, 187 y: -96,
197 width: 28, 188 width: 28,
198 height: 24, 189 height: 24,
199 spritesheet: 'largeicons', 190 spritesheet: 'largeicons',
200 isMask: true, 191 isMask: true,
201 transform: 'translate(4px, 1px) rotate(90deg)'
202 }, 192 },
203 'largeicon-show-bottom-sidebar': { 193 'largeicon-show-bottom-sidebar': {
204 x: -160, 194 x: -224,
205 y: -72, 195 y: -144,
206 width: 28, 196 width: 28,
207 height: 24, 197 height: 24,
208 spritesheet: 'largeicons', 198 spritesheet: 'largeicons',
209 isMask: true, 199 isMask: true,
210 transform: 'translate(4px, 0) rotate(-90deg)'
211 }, 200 },
212 'largeicon-hide-bottom-sidebar': { 201 'largeicon-hide-bottom-sidebar': {
213 x: -192, 202 x: -256,
214 y: -72, 203 y: -120,
215 width: 28, 204 width: 28,
216 height: 24, 205 height: 24,
217 spritesheet: 'largeicons', 206 spritesheet: 'largeicons',
218 isMask: true, 207 isMask: true,
219 transform: 'translate(4px, 1px) rotate(-90deg)'
220 }, 208 },
221 'largeicon-navigator-file': {x: -224, y: -72, width: 32, height: 24, spriteshe et: 'largeicons', isMask: true}, 209 'largeicon-navigator-file': {x: -224, y: -72, width: 32, height: 24, spriteshe et: 'largeicons', isMask: true},
222 'largeicon-navigator-file-sync': {x: -160, y: -24, width: 32, height: 24, spri tesheet: 'largeicons', isMask: true}, 210 'largeicon-navigator-file-sync': {x: -160, y: -24, width: 32, height: 24, spri tesheet: 'largeicons', isMask: true},
223 'badge-navigator-file-sync': {x: -320, y: -72, width: 32, height: 24, spritesh eet: 'largeicons'}, 211 'badge-navigator-file-sync': {x: -320, y: -72, width: 32, height: 24, spritesh eet: 'largeicons'},
224 'largeicon-navigator-folder': {x: -64, y: -120, width: 32, height: 24, sprites heet: 'largeicons', isMask: true}, 212 'largeicon-navigator-folder': {x: -64, y: -120, width: 32, height: 24, sprites heet: 'largeicons', isMask: true},
225 'largeicon-navigator-domain': {x: -160, y: -144, width: 32, height: 24, sprite sheet: 'largeicons', isMask: true}, 213 'largeicon-navigator-domain': {x: -160, y: -144, width: 32, height: 24, sprite sheet: 'largeicons', isMask: true},
226 'largeicon-navigator-frame': {x: -256, y: -144, width: 32, height: 24, sprites heet: 'largeicons', isMask: true}, 214 'largeicon-navigator-frame': {x: -256, y: -144, width: 32, height: 24, sprites heet: 'largeicons', isMask: true},
227 'largeicon-navigator-worker': {x: -320, y: -144, width: 32, height: 24, sprite sheet: 'largeicons', isMask: true}, 215 'largeicon-navigator-worker': {x: -320, y: -144, width: 32, height: 24, sprite sheet: 'largeicons', isMask: true},
228 'largeicon-navigator-snippet': {x: -224, y: -96, width: 32, height: 24, sprite sheet: 'largeicons', isMask: true}, 216 'largeicon-navigator-snippet': {x: -224, y: -96, width: 32, height: 24, sprite sheet: 'largeicons', isMask: true},
229 'largeicon-edit': {x: -160, y: -0, width: 28, height: 24, spritesheet: 'largei cons'}, 217 'largeicon-edit': {x: -160, y: -0, width: 28, height: 24, spritesheet: 'largei cons'},
230 'largeicon-chevron': {x: -68, y: -143, width: 24, height: 26, spritesheet: 'la rgeicons', isMask: true}, 218 'largeicon-chevron': {x: -68, y: -143, width: 24, height: 26, spritesheet: 'la rgeicons', isMask: true},
231 219
232 'mediumicon-manifest': {x: 0, y: -0, width: 16, height: 16, spritesheet: 'reso urceicons', isMask: true}, 220 'mediumicon-manifest': {x: 0, y: -0, width: 16, height: 16, spritesheet: 'reso urceicons', isMask: true},
233 'mediumicon-service-worker': {x: -20, y: -0, width: 16, height: 16, spriteshee t: 'resourceicons', isMask: true}, 221 'mediumicon-service-worker': {x: -20, y: -0, width: 16, height: 16, spriteshee t: 'resourceicons', isMask: true},
234 'mediumicon-clear-storage': {x: -40, y: -0, width: 16, height: 16, spritesheet : 'resourceicons', isMask: true}, 222 'mediumicon-clear-storage': {x: -40, y: -0, width: 16, height: 16, spritesheet : 'resourceicons', isMask: true},
235 'mediumicon-database': {x: -60, y: -0, width: 16, height: 16, spritesheet: 're sourceicons', isMask: true}, 223 'mediumicon-database': {x: -60, y: -0, width: 16, height: 16, spritesheet: 're sourceicons', isMask: true},
236 'mediumicon-table': {x: -80, y: -0, width: 16, height: 16, spritesheet: 'resou rceicons', isMask: true}, 224 'mediumicon-table': {x: -80, y: -0, width: 16, height: 16, spritesheet: 'resou rceicons', isMask: true},
237 'mediumicon-cookie': {x: -120, y: -0, width: 16, height: 16, spritesheet: 'res ourceicons', isMask: true}, 225 'mediumicon-cookie': {x: -120, y: -0, width: 16, height: 16, spritesheet: 'res ourceicons', isMask: true},
238 }; 226 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs_2x.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698