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 9d07485c0f8827f00db0503b340b0e0683526d6d..1d7093f8647f2b692931564d998c562e896b3908 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
@@ -182,7 +182,7 @@ WebInspector.CSSSourceFrame.prototype = { |
{ |
event.consume(true); |
if (this._swatchPopoverHelper.isShowing()) { |
- this._swatchPopoverHelper.hide(); |
+ this._swatchPopoverHelper.hide(true); |
return; |
} |
this._currentSwatch = swatch; |
@@ -209,19 +209,28 @@ WebInspector.CSSSourceFrame.prototype = { |
_spectrumChanged: function(event) |
{ |
this._muteColorProcessing = true; |
+ this._spectrumChangeOccurred = true; |
lushnikov
2016/07/22 04:58:17
this._hadSpectrumChange = true;
flandy
2016/07/22 15:56:09
Done.
|
var colorString = /** @type {string} */ (event.data); |
this._currentSwatch.setColorText(colorString); |
- this._textEditor.editRange(this._currentColorPosition.textRange, colorString, "*color-text-changed"); |
+ this.textEditor.editRange(this._currentColorPosition.textRange, colorString, "*color-text-changed"); |
this._currentColorPosition.color = WebInspector.Color.parse(colorString); |
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._spectrumChangeOccurred) |
+ this.textEditor.undo(); |
delete this._spectrum; |
+ delete this._currentSwatch; |
+ delete this._currentColorPosition; |
+ delete this._spectrumChangeOccurred; |
lushnikov
2016/07/22 04:58:17
i'd rather initialize spectrumChangeOccured in _sh
flandy
2016/07/22 15:56:08
Done.
|
+ this._muteColorProcessing = false; |
this._updateColorSwatches(); |
}, |
@@ -258,7 +267,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 |