Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js b/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js |
| index 903183a7c3c5097d94e06b268e328d553d2568e2..f0c60bc3da28c2cc36e3655dfef2e32c9597fa81 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js |
| @@ -31,15 +31,15 @@ WebInspector.ColorSwatch.prototype = { |
| }, |
| /** |
| - * @param {string} colorText |
| + * @param {!WebInspector.Color} color |
| */ |
| - setColorText: function(colorText) |
| + setColor: function(color) |
| { |
| - this._color = WebInspector.Color.parse(colorText); |
| - console.assert(this._color, "Color text could not be parsed."); |
| + this._color = color; |
| this._format = this._color.format(); |
| - this._colorValueElement.textContent = this._color.asString(this._format); |
| - this._swatchInner.style.backgroundColor = colorText; |
| + var colorString = this._color.asString(this._format); |
| + this._colorValueElement.textContent = colorString; |
| + this._swatchInner.style.backgroundColor = colorString; |
| }, |
| /** |
| @@ -97,8 +97,6 @@ WebInspector.ColorSwatch.prototype = { |
| root.createChild("content"); |
| this._colorValueElement = this.createChild("span"); |
| - |
| - this.setColorText("white"); |
|
dgozman
2016/09/02 22:08:01
Why removed?
flandy
2016/09/02 23:09:18
All of the clients set the color on their own afte
|
| }, |
| /** |
| @@ -220,7 +218,12 @@ WebInspector.CSSShadowSwatch.prototype = { |
| var result = results[i]; |
| if (result.regexIndex === 1) { |
| this._colorSwatch = WebInspector.ColorSwatch.create(); |
| - this._colorSwatch.setColorText(result.value); |
| + var color = WebInspector.Color.parse(result.value); |
| + if (!color) { |
| + this._contentElement.appendChild(createTextNode(result.value)); |
| + continue; |
| + } |
| + this._colorSwatch.setColor(color); |
| this._contentElement.appendChild(this._colorSwatch); |
| } else { |
| this._contentElement.appendChild(createTextNode(result.value)); |