Chromium Code Reviews| 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 eed8305089dc0111298b341d1f0336bf5e72e543..35c5791be63d6100e88c93316a691fbbfec65c6d 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
| @@ -182,11 +182,12 @@ WebInspector.CSSSourceFrame.prototype = { |
| { |
| event.consume(true); |
| if (this._swatchPopoverHelper.isShowing()) { |
| - this._swatchPopoverHelper.hide(); |
| + this._swatchPopoverHelper.hide(true); |
| return; |
| } |
| this._currentSwatch = swatch; |
| this._currentColorPosition = colorPosition; |
| + this._originalColorText = colorPosition.color.asString(WebInspector.Color.Format.Original); |
| this._spectrum = new WebInspector.Spectrum(); |
| this._spectrum.setColor(swatch.color(), swatch.format()); |
| this._spectrum.addEventListener(WebInspector.Spectrum.Events.SizeChanged, this._spectrumResized, this); |
| @@ -215,12 +216,20 @@ WebInspector.CSSSourceFrame.prototype = { |
| this._currentColorPosition.textRange.endColumn = this._currentColorPosition.textRange.startColumn + colorString.length; |
| }, |
| - _spectrumHidden: function() |
| + /** |
| + * @param {boolean} commitEdit |
| + */ |
| + _spectrumHidden: function(commitEdit) |
| { |
| - this._muteColorProcessing = false; |
| this._spectrum.removeEventListener(WebInspector.Spectrum.Events.SizeChanged, this._spectrumResized, this); |
| this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorChanged, this._spectrumChanged, this); |
| + if (!commitEdit) |
| + this._textEditor.editRange(this._currentColorPosition.textRange, this._originalColorText); |
|
lushnikov
2016/07/21 22:58:35
will the undo stack make sense in this case?
flandy
2016/07/22 00:17:10
Good catch. Just calling CM.undo works better and
|
| delete this._spectrum; |
| + delete this._currentSwatch; |
| + delete this._currentColorPosition; |
| + delete this._originalColorText; |
| + this._muteColorProcessing = false; |
| this._updateColorSwatches(); |
| }, |
| @@ -257,7 +266,7 @@ WebInspector.CSSSourceFrame.prototype = { |
| { |
| WebInspector.UISourceCodeFrame.prototype.scrollChanged.call(this, lineNumber); |
| if (this._swatchPopoverHelper.isShowing()) |
| - this._swatchPopoverHelper.hide(); |
| + this._swatchPopoverHelper.hide(true); |
| }, |
| __proto__: WebInspector.UISourceCodeFrame.prototype |