Title: [143184] trunk/Source/WebCore
Revision
143184
Author
[email protected]
Date
2013-02-18 02:45:04 -0800 (Mon, 18 Feb 2013)

Log Message

Web Inspector: _javascript_SourceFrame should inherit UISourceCodeFrame
https://bugs.webkit.org/show_bug.cgi?id=110091

Reviewed by Pavel Feldman.

Removed duplicated code from _javascript_SourceFrame and made it inherit UISourceCodeFrame.

* inspector/front-end/_javascript_SourceFrame.js:
(WebInspector._javascript_SourceFrame):
(WebInspector._javascript_SourceFrame.prototype.onUISourceCodeContentChanged):
(WebInspector._javascript_SourceFrame.prototype.populateTextAreaContextMenu):
* inspector/front-end/ScriptsPanel.js:
* inspector/front-end/UISourceCodeFrame.js:
(WebInspector.UISourceCodeFrame.prototype.canEditSource):
(WebInspector.UISourceCodeFrame.prototype.onTextChanged):
(WebInspector.UISourceCodeFrame.prototype._onFormattedChanged):
(WebInspector.UISourceCodeFrame.prototype.onUISourceCodeContentChanged):
(WebInspector.UISourceCodeFrame.prototype._innerSetContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143183 => 143184)


--- trunk/Source/WebCore/ChangeLog	2013-02-18 10:35:58 UTC (rev 143183)
+++ trunk/Source/WebCore/ChangeLog	2013-02-18 10:45:04 UTC (rev 143184)
@@ -1,5 +1,26 @@
 2013-02-18  Vsevolod Vlasov  <[email protected]>
 
+        Web Inspector: _javascript_SourceFrame should inherit UISourceCodeFrame
+        https://bugs.webkit.org/show_bug.cgi?id=110091
+
+        Reviewed by Pavel Feldman.
+
+        Removed duplicated code from _javascript_SourceFrame and made it inherit UISourceCodeFrame.
+
+        * inspector/front-end/_javascript_SourceFrame.js:
+        (WebInspector._javascript_SourceFrame):
+        (WebInspector._javascript_SourceFrame.prototype.onUISourceCodeContentChanged):
+        (WebInspector._javascript_SourceFrame.prototype.populateTextAreaContextMenu):
+        * inspector/front-end/ScriptsPanel.js:
+        * inspector/front-end/UISourceCodeFrame.js:
+        (WebInspector.UISourceCodeFrame.prototype.canEditSource):
+        (WebInspector.UISourceCodeFrame.prototype.onTextChanged):
+        (WebInspector.UISourceCodeFrame.prototype._onFormattedChanged):
+        (WebInspector.UISourceCodeFrame.prototype.onUISourceCodeContentChanged):
+        (WebInspector.UISourceCodeFrame.prototype._innerSetContent):
+
+2013-02-18  Vsevolod Vlasov  <[email protected]>
+
         Web Inspector: Remove unused _files field in FileSystemProjectDelegate
         https://bugs.webkit.org/show_bug.cgi?id=110082
 

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


--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2013-02-18 10:35:58 UTC (rev 143183)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2013-02-18 10:45:04 UTC (rev 143184)
@@ -30,7 +30,7 @@
 
 /**
  * @constructor
- * @extends {WebInspector.SourceFrame}
+ * @extends {WebInspector.UISourceCodeFrame}
  * @param {WebInspector.ScriptsPanel} scriptsPanel
  * @param {WebInspector.UISourceCode} uiSourceCode
  */
@@ -44,7 +44,7 @@
     for (var i = 0; i < locations.length; ++i)
         this._breakpointAdded({data:locations[i]});
 
-    WebInspector.SourceFrame.call(this, uiSourceCode);
+    WebInspector.UISourceCodeFrame.call(this, uiSourceCode);
 
     this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.textEditor.element,
             this._getPopoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), this._onHidePopover.bind(this), true);
@@ -56,9 +56,6 @@
     this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
     this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);
 
-    this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._onFormattedChanged, this);
-    this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyChanged, this);
-    this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this);
     this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
     this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved, this._consoleMessageRemoved, this);
     this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this);
@@ -81,60 +78,14 @@
     },
 
     /**
-     * @return {boolean}
+     * @param {string} content
      */
-    canEditSource: function()
+    onUISourceCodeContentChanged: function(content, contentEncoded, mimeType)
     {
-        return this._uiSourceCode.isEditable();
-    },
-
-    /**
-     * @param {string} text
-     */
-    commitEditing: function(text)
-    {
-        if (!this._uiSourceCode.isDirty())
-            return;
-
-        this._isCommittingEditing = true;
-        this._uiSourceCode.commitWorkingCopy(function() { });
-        delete this._isCommittingEditing;
-    },
-
-    /**
-     * @param {WebInspector.Event} event
-     */
-    _onFormattedChanged: function(event)
-    {
-        var content = /** @type {string} */ (event.data.content);
-        this._textEditor.setReadOnly(this._uiSourceCode.formatted());
-        this.setContent(content, false, this._uiSourceCode.mimeType());
-    },
-
-    /**
-     * @param {WebInspector.Event} event
-     */
-    _onWorkingCopyChanged: function(event)
-    {
-        this._innerSetContent(this._uiSourceCode.workingCopy());
-    },
-
-    /**
-     * @param {WebInspector.Event} event
-     */
-    _onWorkingCopyCommitted: function(event)
-    {
-        this._innerSetContent(this._uiSourceCode.workingCopy());
-    },
-
-    _innerSetContent: function(content)
-    {
-        if (this._isSettingWorkingCopy || this._isCommittingEditing)
-            return;
         var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);
         for (var i = 0; i < breakpointLocations.length; ++i)
             breakpointLocations[i].breakpoint.remove();
-        this.setContent(content, false, this._uiSourceCode.mimeType());
+        WebInspector.UISourceCodeFrame.prototype.onUISourceCodeContentChanged.call(this, content);
     },
 
     populateLineGutterContextMenu: function(contextMenu, lineNumber)
@@ -180,17 +131,9 @@
             contextMenu.appendItem(liveEditLabel, liveEdit.bind(this));
             contextMenu.appendSeparator();
         }
-        contextMenu.appendApplicableItems(this._uiSourceCode);
+        WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
     },
 
-    onTextChanged: function(oldRange, newRange)
-    {
-        WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, newRange);
-        this._isSettingWorkingCopy = true;
-        this._uiSourceCode.setWorkingCopy(this._textEditor.text());
-        delete this._isSettingWorkingCopy;
-    },
-
     _willMergeToVM: function()
     {
         if (this._supportsEnabledBreakpointsWhileEditing())
@@ -644,5 +587,5 @@
         WebInspector.debuggerModel.continueToLocation(rawLocation);
     },
 
-    __proto__: WebInspector.SourceFrame.prototype
+    __proto__: WebInspector.UISourceCodeFrame.prototype
 }

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (143183 => 143184)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2013-02-18 10:35:58 UTC (rev 143183)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2013-02-18 10:45:04 UTC (rev 143184)
@@ -27,6 +27,7 @@
 importScript("BreakpointsSidebarPane.js");
 importScript("CallStackSidebarPane.js");
 importScript("FilteredItemSelectionDialog.js");
+importScript("UISourceCodeFrame.js");
 importScript("_javascript_SourceFrame.js");
 importScript("NavigatorOverlayController.js");
 importScript("NavigatorView.js");
@@ -37,7 +38,6 @@
 importScript("SnippetJavaScriptSourceFrame.js");
 importScript("StyleSheetOutlineDialog.js");
 importScript("TabbedEditorContainer.js");
-importScript("UISourceCodeFrame.js");
 importScript("WatchExpressionsSidebarPane.js");
 importScript("WorkersSidebarPane.js");
 

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js (143183 => 143184)


--- trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js	2013-02-18 10:35:58 UTC (rev 143183)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js	2013-02-18 10:45:04 UTC (rev 143184)
@@ -46,7 +46,7 @@
      */
     canEditSource: function()
     {
-        return true;
+        return this._uiSourceCode.isEditable();
     },
 
     /**
@@ -64,6 +64,7 @@
 
     onTextChanged: function(oldRange, newRange)
     {
+        WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, newRange);
         this._isSettingWorkingCopy = true;
         this._uiSourceCode.setWorkingCopy(this._textEditor.text());
         delete this._isSettingWorkingCopy;
@@ -84,7 +85,7 @@
     {
         var content = /** @type {string} */ (event.data.content);
         this._textEditor.setReadOnly(this._uiSourceCode.formatted());
-        this._innerSetContent(content);
+        this.setContent(content, false, this._uiSourceCode.mimeType());
     },
 
     /**
@@ -103,12 +104,22 @@
         this._innerSetContent(this._uiSourceCode.workingCopy());
     },
 
+    /**
+     * @param {string} content
+     */
+    onUISourceCodeContentChanged: function(content)
+    {
+        this.setContent(content, false, this._uiSourceCode.mimeType());
+    },
+
+    /**
+     * @param {string} content
+     */
     _innerSetContent: function(content)
     {
         if (this._isSettingWorkingCopy || this._isCommittingEditing)
             return;
-
-        this.setContent(this._uiSourceCode.content() || "", false, this._uiSourceCode.contentType().canonicalMimeType());
+        this.onUISourceCodeContentChanged(content);
     },
 
     populateTextAreaContextMenu: function(contextMenu, lineNumber)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to