Title: [104541] trunk/Source/WebCore
Revision
104541
Author
[email protected]
Date
2012-01-10 01:58:33 -0800 (Tue, 10 Jan 2012)

Log Message

Web Inspector: introduce experimental setting that makes source files always editable
https://bugs.webkit.org/show_bug.cgi?id=75626

Patch by [email protected] <[email protected]> on 2012-01-10
Reviewed by Timothy Hatcher.

* English.lproj/localizedStrings.js:
* inspector/front-end/_javascript_SourceFrame.js:
(WebInspector._javascript_SourceFrame):
(WebInspector._javascript_SourceFrame.prototype.setReadOnly):
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView):
* inspector/front-end/ScriptsNavigator.js:
(WebInspector.NavigatorScriptTreeElement.prototype.onselect):
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype.get statusBarItems):
(WebInspector.SourceFrame.prototype.setReadOnly):
* inspector/front-end/inspector.js:
(WebInspector.loaded):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104540 => 104541)


--- trunk/Source/WebCore/ChangeLog	2012-01-10 09:08:57 UTC (rev 104540)
+++ trunk/Source/WebCore/ChangeLog	2012-01-10 09:58:33 UTC (rev 104541)
@@ -1,3 +1,27 @@
+2012-01-10  [email protected]  <[email protected]>
+
+        Web Inspector: introduce experimental setting that makes source files always editable
+        https://bugs.webkit.org/show_bug.cgi?id=75626
+
+        Reviewed by Timothy Hatcher.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/_javascript_SourceFrame.js:
+        (WebInspector._javascript_SourceFrame):
+        (WebInspector._javascript_SourceFrame.prototype.setReadOnly):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView):
+        * inspector/front-end/ScriptsNavigator.js:
+        (WebInspector.NavigatorScriptTreeElement.prototype.onselect):
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        (WebInspector.SourceFrame.prototype.get statusBarItems):
+        (WebInspector.SourceFrame.prototype.setReadOnly):
+        * inspector/front-end/inspector.js:
+        (WebInspector.loaded):
+
 2012-01-09  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r104507.

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js (104540 => 104541)


--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-01-10 09:08:57 UTC (rev 104540)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-01-10 09:58:33 UTC (rev 104541)
@@ -37,13 +37,14 @@
  */
 WebInspector._javascript_SourceFrame = function(scriptsPanel, model, uiSourceCode)
 {
-    WebInspector.SourceFrame.call(this, uiSourceCode.url);
-
     this._scriptsPanel = scriptsPanel;
     this._model = model;
     this._uiSourceCode = uiSourceCode;
     this._popoverObjectGroup = "popover";
     this._breakpoints = {};
+
+    WebInspector.SourceFrame.call(this, uiSourceCode.url);
+
     this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.textViewer.element,
             this._getPopoverAnchor.bind(this), this._onShowPopover.bind(this), this._onHidePopover.bind(this), true);
 
@@ -95,7 +96,7 @@
 
     setReadOnly: function(readOnly)
     {
-        if (!readOnly)
+        if (this._popoverHelper && !readOnly)
             this._popoverHelper.hidePopover();
         WebInspector.SourceFrame.prototype.setReadOnly.call(this, readOnly);
         if (readOnly)
@@ -202,10 +203,13 @@
 
     cancelEditing: function()
     {
+        if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
+            return false;
+
         WebInspector.SourceFrame.prototype.cancelEditing.call(this);
 
         if (!this._javaScriptSourceFrameState)
-            return;
+            return true;
 
         if (typeof this._javaScriptSourceFrameState.executionLineNumber === "number") {
             this.clearExecutionLine();
@@ -225,6 +229,7 @@
         }
 
         delete this._javaScriptSourceFrameState;
+        return true;
     },
 
     didEditContent: function(error)

Modified: trunk/Source/WebCore/inspector/front-end/ResourceView.js (104540 => 104541)


--- trunk/Source/WebCore/inspector/front-end/ResourceView.js	2012-01-10 09:08:57 UTC (rev 104540)
+++ trunk/Source/WebCore/inspector/front-end/ResourceView.js	2012-01-10 09:58:33 UTC (rev 104541)
@@ -82,8 +82,8 @@
  */
 WebInspector.ResourceSourceFrame = function(resource)
 {
+    this._resource = resource;
     WebInspector.SourceFrame.call(this, resource.url);
-    this._resource = resource;
 }
 
 //This is a map from resource.type to mime types
@@ -147,11 +147,15 @@
 
     cancelEditing: function()
     {
+        if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
+            return false;
+
         this._clearIncrementalUpdateTimer();
         const majorChange = false;
         if (this._viewerState)
             this.resource.setContent(this._viewerState.textModelContent, majorChange);
         WebInspector.SourceFrame.prototype.cancelEditing.call(this);
+        return true;
     },
 
     afterTextChanged: function(oldRange, newRange)

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (104540 => 104541)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-01-10 09:08:57 UTC (rev 104540)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-01-10 09:58:33 UTC (rev 104541)
@@ -168,7 +168,8 @@
     // Add currently running experiments here.
     // FIXME: Move out from experiments once navigator is production-ready.
     this.useScriptsNavigator = this._createExperiment("useScriptsNavigator", "Use file navigator and tabbed editor container in scripts panel");
-    
+    this.sourceFrameAlwaysEditable = this._createExperiment("sourceFrameAlwaysEditable", "Make resources always editable");
+
     this._cleanUpSetting();
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (104540 => 104541)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-01-10 09:08:57 UTC (rev 104540)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-01-10 09:58:33 UTC (rev 104541)
@@ -53,6 +53,9 @@
     this._messages = [];
     this._rowMessages = {};
     this._messageBubbles = {};
+
+    if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
+        this.startEditing();
 }
 
 WebInspector.SourceFrame.Events = {
@@ -106,7 +109,7 @@
 
     get statusBarItems()
     {
-        return [this._editButton.element];
+        return WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled() ? [] : [this._editButton.element];
     },
 
     get loaded()
@@ -568,8 +571,12 @@
 
     cancelEditing: function()
     {
+        if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
+            return false;
+
         this._restoreViewerState();
         this.setReadOnly(true);
+        return true;
     },
 
     get readOnly()
@@ -579,9 +586,10 @@
 
     setReadOnly: function(readOnly)
     {
+        if (readOnly && WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled())
+            return;
         this._textViewer.readOnly = readOnly;
         this._editButton.toggled = !readOnly;
-        WebInspector.markBeingEdited(this._textViewer.element, !readOnly);
     }
 }
 
@@ -620,7 +628,7 @@
 
     cancelEditing: function()
     {
-        this._sourceFrame.cancelEditing();
+        return this._sourceFrame.cancelEditing();
     },
 
     populateLineGutterContextMenu: function(contextMenu, lineNumber)

Modified: trunk/Source/WebCore/inspector/front-end/TextViewer.js (104540 => 104541)


--- trunk/Source/WebCore/inspector/front-end/TextViewer.js	2012-01-10 09:08:57 UTC (rev 104540)
+++ trunk/Source/WebCore/inspector/front-end/TextViewer.js	2012-01-10 09:58:33 UTC (rev 104541)
@@ -329,8 +329,7 @@
         if (this.readOnly)
             return false;
 
-        this._delegate.cancelEditing();
-        return true;
+        return this._delegate.cancelEditing();
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to