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

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

Issue 2171003002: DevTools: Allow ESC for source color picker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698