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

Side by Side Diff: Source/devtools/front_end/elements/Spectrum.js

Issue 1175113007: Devtools: Fix "unable to change the value of R/G/B/A" in color picker (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename variable Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/ui/UIUtils.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 { 306 {
307 /** 307 /**
308 * @param {!Element} element 308 * @param {!Element} element
309 * @return {string} 309 * @return {string}
310 */ 310 */
311 function elementValue(element) 311 function elementValue(element)
312 { 312 {
313 return element.value; 313 return element.value;
314 } 314 }
315 315
316 var element = /** @type {!Element} */(event.currentTarget); 316 var inputElement = /** @type {!Element} */(event.currentTarget);
317 WebInspector.handleElementValueModifications(event, element); 317 var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.k eyIdentifier === "Down" || event.type === "mousewheel");
318 var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdent ifier === "PageDown");
319 if (arrowKeyOrMouseWheelEvent || pageKeyPressed) {
320 var newValue = WebInspector.createReplacementString(inputElement.val ue, event);
321 if (newValue) {
322 inputElement.value = newValue;
323 inputElement.selectionStart = 0;
324 inputElement.selectionEnd = newValue.length;
325 }
326 }
318 327
319 const cf = WebInspector.Color.Format; 328 const cf = WebInspector.Color.Format;
320 var colorString; 329 var colorString;
321 if (this._currentFormat === cf.HEX || this._currentFormat === cf.ShortHE X) { 330 if (this._currentFormat === cf.HEX || this._currentFormat === cf.ShortHE X) {
322 colorString = this._hexValue.value; 331 colorString = this._hexValue.value;
323 } else { 332 } else {
324 var format = this._currentFormat === cf.RGB ? "rgba" : "hsla"; 333 var format = this._currentFormat === cf.RGB ? "rgba" : "hsla";
325 var values = this._textValues.map(elementValue).join(","); 334 var values = this._textValues.map(elementValue).join(",");
326 colorString = String.sprintf("%s(%s)", format, values); 335 colorString = String.sprintf("%s(%s)", format, values);
327 } 336 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 var rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100]; 387 var rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100];
379 var color = WebInspector.Color.fromRGBA(rgba); 388 var color = WebInspector.Color.fromRGBA(rgba);
380 this.setColor(color); 389 this.setColor(color);
381 this._dispatchChangeEvent(); 390 this._dispatchChangeEvent();
382 InspectorFrontendHost.bringToFront(); 391 InspectorFrontendHost.bringToFront();
383 }, 392 },
384 393
385 394
386 __proto__: WebInspector.VBox.prototype 395 __proto__: WebInspector.VBox.prototype
387 } 396 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ui/UIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698