Title: [157966] trunk/Source/WebInspectorUI
Revision
157966
Author
[email protected]
Date
2013-10-24 17:15:38 -0700 (Thu, 24 Oct 2013)

Log Message

Allow editing CSS resources after they have been pretty printed.

https://bugs.webkit.org/show_bug.cgi?id=123297

Reviewed by Joseph Pecoraro.

* UserInterface/TextEditor.js:
(WebInspector.TextEditor): Remove the need for _readOnly.
(WebInspector.TextEditor.prototype.set readOnly): Set CodeMirror readOnly directly.
(WebInspector.TextEditor.prototype.set formatted): Don't call _updateCodeMirrorReadOnly.
(WebInspector.TextEditor.prototype._updateCodeMirrorReadOnly): Removed.
(WebInspector.TextEditor.prototype._contentChanged): Clear _formatted and _formatterSourceMap
on edit and notify the delegate and fire the FormattingDidChange event.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (157965 => 157966)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-10-25 00:14:35 UTC (rev 157965)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-10-25 00:15:38 UTC (rev 157966)
@@ -1,5 +1,21 @@
 2013-10-24  Timothy Hatcher  <[email protected]>
 
+        Allow editing CSS resources after they have been pretty printed.
+
+        https://bugs.webkit.org/show_bug.cgi?id=123297
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/TextEditor.js:
+        (WebInspector.TextEditor): Remove the need for _readOnly.
+        (WebInspector.TextEditor.prototype.set readOnly): Set CodeMirror readOnly directly.
+        (WebInspector.TextEditor.prototype.set formatted): Don't call _updateCodeMirrorReadOnly.
+        (WebInspector.TextEditor.prototype._updateCodeMirrorReadOnly): Removed.
+        (WebInspector.TextEditor.prototype._contentChanged): Clear _formatted and _formatterSourceMap
+        on edit and notify the delegate and fire the FormattingDidChange event.
+
+2013-10-24  Timothy Hatcher  <[email protected]>
+
         Adjust the precision of byte strings in Web Inspector.
 
         https://bugs.webkit.org/show_bug.cgi?id=123281

Modified: trunk/Source/WebInspectorUI/UserInterface/TextEditor.js (157965 => 157966)


--- trunk/Source/WebInspectorUI/UserInterface/TextEditor.js	2013-10-25 00:14:35 UTC (rev 157965)
+++ trunk/Source/WebInspectorUI/UserInterface/TextEditor.js	2013-10-25 00:15:38 UTC (rev 157966)
@@ -32,10 +32,8 @@
     this._element.classList.add(WebInspector.TextEditor.StyleClassName);
     this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
 
-    this._readOnly = true;
-
     this._codeMirror = CodeMirror(this.element, {
-        readOnly: this._readOnly,
+        readOnly: true,
         indentWithTabs: true,
         indentUnit: 4,
         lineNumbers: true,
@@ -148,8 +146,7 @@
 
     set readOnly(readOnly)
     {
-        this._readOnly = readOnly;
-        this._updateCodeMirrorReadOnly();
+        this._codeMirror.setOption("readOnly", readOnly);
     },
 
     get formatted()
@@ -171,7 +168,6 @@
         delete this._ignoreCodeMirrorContentDidChangeEvent;
 
         this._formatted = formatted;
-        this._updateCodeMirrorReadOnly();
 
         this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
     },
@@ -594,15 +590,21 @@
 
     // Private
 
-    _updateCodeMirrorReadOnly: function()
-    {
-        this._codeMirror.setOption("readOnly", this._readOnly || this._formatted);
-    },
-
     _contentChanged: function(codeMirror, change)
     {
         if (this._ignoreCodeMirrorContentDidChangeEvent)
             return;
+
+        if (this._formatted) {
+            this._formatterSourceMap = null;
+            this._formatted = false;
+
+            if (this._delegate && typeof this._delegate.textEditorUpdatedFormatting === "function")
+                this._delegate.textEditorUpdatedFormatting(this);
+
+            this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
+        }
+
         this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);
     },
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to