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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/Spectrum.js

Issue 2560553004: Revert of [DevTools] Remove methods on Common.Event. (Closed)
Patch Set: Created 4 years 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
1 /* 1 /*
2 * Copyright (C) 2011 Brian Grinstead All rights reserved. 2 * Copyright (C) 2011 Brian Grinstead All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 this._deleteIconToolbar = new UI.Toolbar('delete-color-toolbar'); 124 this._deleteIconToolbar = new UI.Toolbar('delete-color-toolbar');
125 this._deleteButton = new UI.ToolbarButton('', 'largeicon-trash-bin'); 125 this._deleteButton = new UI.ToolbarButton('', 'largeicon-trash-bin');
126 this._deleteIconToolbar.appendToolbarItem(this._deleteButton); 126 this._deleteIconToolbar.appendToolbarItem(this._deleteButton);
127 127
128 var overlay = this.contentElement.createChild('div', 'spectrum-overlay fill' ); 128 var overlay = this.contentElement.createChild('div', 'spectrum-overlay fill' );
129 overlay.addEventListener('click', this._togglePalettePanel.bind(this, false) ); 129 overlay.addEventListener('click', this._togglePalettePanel.bind(this, false) );
130 130
131 this._addColorToolbar = new UI.Toolbar('add-color-toolbar'); 131 this._addColorToolbar = new UI.Toolbar('add-color-toolbar');
132 var addColorButton = new UI.ToolbarButton(Common.UIString('Add to palette'), 'largeicon-add'); 132 var addColorButton = new UI.ToolbarButton(Common.UIString('Add to palette'), 'largeicon-add');
133 addColorButton.addEventListener(UI.ToolbarButton.Events.Click, this._addColo rToCustomPalette, this); 133 addColorButton.addEventListener('click', this._addColorToCustomPalette.bind( this));
134 this._addColorToolbar.appendToolbarItem(addColorButton); 134 this._addColorToolbar.appendToolbarItem(addColorButton);
135 135
136 this._loadPalettes(); 136 this._loadPalettes();
137 new Components.Spectrum.PaletteGenerator(this._generatedPaletteLoaded.bind(t his)); 137 new Components.Spectrum.PaletteGenerator(this._generatedPaletteLoaded.bind(t his));
138 138
139 /** 139 /**
140 * @param {function(!Event)} callback 140 * @param {function(!Event)} callback
141 * @param {!Event} event 141 * @param {!Event} event
142 * @return {boolean} 142 * @return {boolean}
143 * @this {Components.Spectrum} 143 * @this {Components.Spectrum}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 this._innerSetColor(hsva, '', undefined, Components.Spectrum._ChangeSource .Other); 186 this._innerSetColor(hsva, '', undefined, Components.Spectrum._ChangeSource .Other);
187 } 187 }
188 } 188 }
189 189
190 _updatePalettePanel() { 190 _updatePalettePanel() {
191 this._palettePanel.removeChildren(); 191 this._palettePanel.removeChildren();
192 var title = this._palettePanel.createChild('div', 'palette-title'); 192 var title = this._palettePanel.createChild('div', 'palette-title');
193 title.textContent = Common.UIString('Color Palettes'); 193 title.textContent = Common.UIString('Color Palettes');
194 var toolbar = new UI.Toolbar('', this._palettePanel); 194 var toolbar = new UI.Toolbar('', this._palettePanel);
195 var closeButton = new UI.ToolbarButton('Return to color picker', 'largeicon- delete'); 195 var closeButton = new UI.ToolbarButton('Return to color picker', 'largeicon- delete');
196 closeButton.addEventListener(UI.ToolbarButton.Events.Click, this._togglePale ttePanel.bind(this, false)); 196 closeButton.addEventListener('click', this._togglePalettePanel.bind(this, fa lse));
197 toolbar.appendToolbarItem(closeButton); 197 toolbar.appendToolbarItem(closeButton);
198 for (var palette of this._palettes.values()) 198 for (var palette of this._palettes.values())
199 this._palettePanel.appendChild(this._createPreviewPaletteElement(palette)) ; 199 this._palettePanel.appendChild(this._createPreviewPaletteElement(palette)) ;
200 } 200 }
201 201
202 /** 202 /**
203 * @param {boolean} show 203 * @param {boolean} show
204 */ 204 */
205 _togglePalettePanel(show) { 205 _togglePalettePanel(show) {
206 if (this._palettePanelShowing === show) 206 if (this._palettePanelShowing === show)
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 */ 502 */
503 _paletteColorSelected(colorText, matchUserFormat) { 503 _paletteColorSelected(colorText, matchUserFormat) {
504 var color = Common.Color.parse(colorText); 504 var color = Common.Color.parse(colorText);
505 if (!color) 505 if (!color)
506 return; 506 return;
507 this._innerSetColor( 507 this._innerSetColor(
508 color.hsva(), colorText, matchUserFormat ? this._colorFormat : color.for mat(), 508 color.hsva(), colorText, matchUserFormat ? this._colorFormat : color.for mat(),
509 Components.Spectrum._ChangeSource.Other); 509 Components.Spectrum._ChangeSource.Other);
510 } 510 }
511 511
512 /** 512 _addColorToCustomPalette() {
513 * @param {!Common.Event} event
514 */
515 _addColorToCustomPalette(event) {
516 var palette = this._customPaletteSetting.get(); 513 var palette = this._customPaletteSetting.get();
517 palette.colors.push(this.colorString()); 514 palette.colors.push(this.colorString());
518 this._customPaletteSetting.set(palette); 515 this._customPaletteSetting.set(palette);
519 this._showPalette(this._customPaletteSetting.get(), false); 516 this._showPalette(this._customPaletteSetting.get(), false);
520 } 517 }
521 518
522 /** 519 /**
523 * @param {number} colorIndex 520 * @param {number} colorIndex
524 * @param {!Event} event 521 * @param {!Event} event
525 */ 522 */
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 '#607D8B': 1033 '#607D8B':
1037 ['#ECEFF1', '#CFD8DC', '#B0BEC5', '#90A4AE', '#78909C', '#607D8B', '#546E7 A', '#455A64', '#37474F', '#263238'] 1034 ['#ECEFF1', '#CFD8DC', '#B0BEC5', '#90A4AE', '#78909C', '#607D8B', '#546E7 A', '#455A64', '#37474F', '#263238']
1038 }; 1035 };
1039 1036
1040 Components.Spectrum.MaterialPalette = { 1037 Components.Spectrum.MaterialPalette = {
1041 title: 'Material', 1038 title: 'Material',
1042 mutable: false, 1039 mutable: false,
1043 matchUserFormat: true, 1040 matchUserFormat: true,
1044 colors: Object.keys(Components.Spectrum.MaterialPaletteShades) 1041 colors: Object.keys(Components.Spectrum.MaterialPaletteShades)
1045 }; 1042 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698