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

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

Issue 2377193004: [DevTools] Rework some focus code. (Closed)
Patch Set: fixes Created 4 years, 2 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
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return; 221 return;
222 if (show) 222 if (show)
223 this._updatePalettePanel(); 223 this._updatePalettePanel();
224 this._focus(); 224 this._focus();
225 this._palettePanelShowing = show; 225 this._palettePanelShowing = show;
226 this.contentElement.classList.toggle("palette-panel-showing", show); 226 this.contentElement.classList.toggle("palette-panel-showing", show);
227 }, 227 },
228 228
229 _focus: function() 229 _focus: function()
230 { 230 {
231 if (this.isShowing() && WebInspector.currentFocusElement() !== this.cont entElement) 231 if (this.isShowing())
232 WebInspector.setCurrentFocusElement(this.contentElement); 232 this.contentElement.focus();
233 }, 233 },
234 234
235 /** 235 /**
236 * @param {string} colorText 236 * @param {string} colorText
237 * @param {number=} animationDelay 237 * @param {number=} animationDelay
238 * @return {!Element} 238 * @return {!Element}
239 */ 239 */
240 _createPaletteColor: function(colorText, animationDelay) 240 _createPaletteColor: function(colorText, animationDelay)
241 { 241 {
242 var element = createElementWithClass("div", "spectrum-palette-color"); 242 var element = createElementWithClass("div", "spectrum-palette-color");
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 this._shadesContainer.style.left = colorElement.offsetLeft + "px"; 321 this._shadesContainer.style.left = colorElement.offsetLeft + "px";
322 colorElement.classList.add("spectrum-shades-shown"); 322 colorElement.classList.add("spectrum-shades-shown");
323 323
324 var shades = WebInspector.Spectrum.MaterialPaletteShades[colorText]; 324 var shades = WebInspector.Spectrum.MaterialPaletteShades[colorText];
325 for (var i = shades.length - 1; i >= 0; i--) { 325 for (var i = shades.length - 1; i >= 0; i--) {
326 var shadeElement = this._createPaletteColor(shades[i], i * 200 / sha des.length + 100); 326 var shadeElement = this._createPaletteColor(shades[i], i * 200 / sha des.length + 100);
327 shadeElement.addEventListener("mousedown", this._paletteColorSelecte d.bind(this, shades[i], false)); 327 shadeElement.addEventListener("mousedown", this._paletteColorSelecte d.bind(this, shades[i], false));
328 this._shadesContainer.appendChild(shadeElement); 328 this._shadesContainer.appendChild(shadeElement);
329 } 329 }
330 330
331 WebInspector.setCurrentFocusElement(this._shadesContainer); 331 this._shadesContainer.focus();
332 this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement) ; 332 this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement) ;
333 this._shadesContainer.ownerDocument.addEventListener("mousedown", this._ shadesCloseHandler, true); 333 this._shadesContainer.ownerDocument.addEventListener("mousedown", this._ shadesCloseHandler, true);
334 }, 334 },
335 335
336 /** 336 /**
337 * @param {!Event} e 337 * @param {!Event} e
338 * @return {number} 338 * @return {number}
339 */ 339 */
340 _slotIndexForEvent: function(e) 340 _slotIndexForEvent: function(e)
341 { 341 {
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B" , "#FDD835", "#FBC02D", "#F9A825", "#F57F17"], 1017 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B" , "#FDD835", "#FBC02D", "#F9A825", "#F57F17"],
1018 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107" , "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"], 1018 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107" , "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"],
1019 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800" , "#FB8C00", "#F57C00", "#EF6C00", "#E65100"], 1019 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800" , "#FB8C00", "#F57C00", "#EF6C00", "#E65100"],
1020 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722" , "#F4511E", "#E64A19", "#D84315", "#BF360C"], 1020 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722" , "#F4511E", "#E64A19", "#D84315", "#BF360C"],
1021 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548" , "#6D4C41", "#5D4037", "#4E342E", "#3E2723"], 1021 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548" , "#6D4C41", "#5D4037", "#4E342E", "#3E2723"],
1022 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E" , "#757575", "#616161", "#424242", "#212121"], 1022 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E" , "#757575", "#616161", "#424242", "#212121"],
1023 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B" , "#546E7A", "#455A64", "#37474F", "#263238"] 1023 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B" , "#546E7A", "#455A64", "#37474F", "#263238"]
1024 }; 1024 };
1025 1025
1026 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha des) }; 1026 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha des) };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698