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

Unified Diff: Source/devtools/front_end/StylesSourceMapping.js

Issue 18347003: DevTools: Implement CSS pretty-printing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comments addressed Created 7 years, 3 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
Index: Source/devtools/front_end/StylesSourceMapping.js
diff --git a/Source/devtools/front_end/StylesSourceMapping.js b/Source/devtools/front_end/StylesSourceMapping.js
index 1ca9186dd055d7efce6b3cf2c8d4d14d3168fb25..c39f07cd2dbc79ad60d51d43c197a309dd6eac48 100644
--- a/Source/devtools/front_end/StylesSourceMapping.js
+++ b/Source/devtools/front_end/StylesSourceMapping.js
@@ -207,6 +207,7 @@ WebInspector.StylesSourceMapping.prototype = {
WebInspector.StyleFile = function(uiSourceCode)
{
this._uiSourceCode = uiSourceCode;
+ this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._formattedChanged, this);
vsevik 2013/09/30 16:12:13 You don't need this because this should work out o
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
}
@@ -216,6 +217,11 @@ WebInspector.StyleFile.updateTimeout = 200;
WebInspector.StyleFile.sourceURLRegex = /\n[\040\t]*\/\*#[\040\t]sourceURL=[\040\t]*([^\s]*)[\040\t]*\*\/[\040\t]*$/m;
WebInspector.StyleFile.prototype = {
+ _formattedChanged: function()
+ {
+ WebInspector.styleContentBinding.styleContentFormattingChanged(this._uiSourceCode);
+ },
+
_workingCopyCommitted: function(event)
{
if (this._isAddingRevision)
@@ -278,6 +284,7 @@ WebInspector.StyleFile.prototype = {
{
this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+ this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._formattedChanged, this);
}
}
@@ -295,6 +302,16 @@ WebInspector.StyleContentBinding = function(cssModel, workspace)
WebInspector.StyleContentBinding.prototype = {
/**
* @param {WebInspector.UISourceCode} uiSourceCode
+ */
+ styleContentFormattingChanged: function(uiSourceCode)
+ {
+ var styleSheetIds = this._cssModel.styleSheetIdsForURL(uiSourceCode.url);
+ for (var i = 0; i < styleSheetIds.length; ++i)
+ this._cssModel.styleSheetHeaderForId(styleSheetIds[i]).updateLocations();
+ },
+
+ /**
+ * @param {WebInspector.UISourceCode} uiSourceCode
* @param {string} content
* @param {boolean} majorChange
* @param {function(?string)} userCallback

Powered by Google App Engine
This is Rietveld 408576698