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

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: Addressed comments 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 9d07485c0f8827f00db0503b340b0e0683526d6d..49bbec382d2ec6e39063ba4c245880cc2393b990 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js
@@ -182,9 +182,10 @@ WebInspector.CSSSourceFrame.prototype = {
{
event.consume(true);
if (this._swatchPopoverHelper.isShowing()) {
- this._swatchPopoverHelper.hide();
+ this._swatchPopoverHelper.hide(true);
return;
}
+ this._hadSpectrumChange = false;
this._currentSwatch = swatch;
this._currentColorPosition = colorPosition;
this.textEditor.setSelection(WebInspector.TextRange.createFromLocation(colorPosition.textRange.startLine, colorPosition.textRange.startColumn));
@@ -209,19 +210,27 @@ WebInspector.CSSSourceFrame.prototype = {
_spectrumChanged: function(event)
{
this._muteColorProcessing = true;
+ this._hadSpectrumChange = true;
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._hadSpectrumChange)
+ this.textEditor.undo();
delete this._spectrum;
+ delete this._currentSwatch;
+ delete this._currentColorPosition;
+ 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
« 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