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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js

Issue 2310633002: DevTools: Reduce color parsing by passing in Color to ColorSwatch (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js
index 7fd36524368405e12bbf0d8879feeb2759b2cb2e..d0408b1c709a155d07d125a85c11c0f038051222 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js
@@ -141,7 +141,7 @@ WebInspector.CSSSourceFrame.prototype = {
for (var i = 0; i < colorPositions.length; i++) {
var colorPosition = colorPositions[i];
var swatch = WebInspector.ColorSwatch.create();
- swatch.setColorText(colorPosition.color.asString(WebInspector.Color.Format.Original));
+ swatch.setColor(colorPosition.color);
swatch.iconElement().title = WebInspector.UIString("Open color picker.");
swatch.hideText(true);
var bookmark = this.textEditor.addBookmark(colorPosition.textRange.startLine, colorPosition.textRange.startColumn, swatch, WebInspector.CSSSourceFrame.SwatchBookmark);
@@ -200,10 +200,13 @@ WebInspector.CSSSourceFrame.prototype = {
*/
_spectrumChanged: function(event)
{
+ var colorString = /** @type {string} */ (event.data);
+ var color = WebInspector.Color.parse(colorString)
dgozman 2016/09/02 22:08:01 style: missing semicolon
flandy 2016/09/02 23:09:18 Sorry, done.
+ if (!color)
+ return;
+ this._currentSwatch.setColor(color);
this._muteColorProcessing = true;
this._hadSpectrumChange = true;
- var colorString = /** @type {string} */ (event.data);
- this._currentSwatch.setColorText(colorString);
this._textEditor.editRange(this._currentColorTextRange, colorString, "*color-text-changed");
this._currentColorTextRange.endColumn = this._currentColorTextRange.startColumn + colorString.length;
},

Powered by Google App Engine
This is Rietveld 408576698