Title: [117306] trunk/Source/WebCore
Revision
117306
Author
vse...@chromium.org
Date
2012-05-16 10:36:23 -0700 (Wed, 16 May 2012)

Log Message

Web Inspector: Pressing esc after requesting snippet creation should remove snippet.
https://bugs.webkit.org/show_bug.cgi?id=86639

Reviewed by Pavel Feldman.

Added committed parameter to NavigatorView.rename() callback.

* inspector/front-end/NavigatorView.js:
(WebInspector.NavigatorView.prototype.rename.commitHandler):
(WebInspector.NavigatorView.prototype.rename.cancelHandler):
(WebInspector.NavigatorView.prototype.rename.afterEditing):
* inspector/front-end/ScriptsNavigator.js:
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._snippetCreationRequested.callback):
(WebInspector.ScriptsPanel.prototype._snippetCreationRequested):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117305 => 117306)


--- trunk/Source/WebCore/ChangeLog	2012-05-16 17:29:31 UTC (rev 117305)
+++ trunk/Source/WebCore/ChangeLog	2012-05-16 17:36:23 UTC (rev 117306)
@@ -1,3 +1,21 @@
+2012-05-16  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: Pressing esc after requesting snippet creation should remove snippet.
+        https://bugs.webkit.org/show_bug.cgi?id=86639
+
+        Reviewed by Pavel Feldman.
+
+        Added committed parameter to NavigatorView.rename() callback.
+
+        * inspector/front-end/NavigatorView.js:
+        (WebInspector.NavigatorView.prototype.rename.commitHandler):
+        (WebInspector.NavigatorView.prototype.rename.cancelHandler):
+        (WebInspector.NavigatorView.prototype.rename.afterEditing):
+        * inspector/front-end/ScriptsNavigator.js:
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._snippetCreationRequested.callback):
+        (WebInspector.ScriptsPanel.prototype._snippetCreationRequested):
+
 2012-05-16  Abhishek Arya  <infe...@chromium.org>
 
         Missing RenderApplet cast check in HTMLAppletElement::renderWidgetForJSBindings.

Modified: trunk/Source/WebCore/inspector/front-end/NavigatorView.js (117305 => 117306)


--- trunk/Source/WebCore/inspector/front-end/NavigatorView.js	2012-05-16 17:29:31 UTC (rev 117305)
+++ trunk/Source/WebCore/inspector/front-end/NavigatorView.js	2012-05-16 17:36:23 UTC (rev 117306)
@@ -243,7 +243,7 @@
 
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
-     * @param {function()=} callback
+     * @param {function(boolean)=} callback
      */
     rename: function(uiSourceCode, callback)
     {
@@ -260,19 +260,22 @@
                 this._fileRenamed(uiSourceCode, newTitle);
             else
                 this._updateScriptTitle(uiSourceCode);
-            afterEditing();
+            afterEditing(true);
         }
 
         function cancelHandler()
         {
-            afterEditing();
+            afterEditing(false);
         }
 
-        function afterEditing()
+        /**
+         * @param {boolean} committed
+         */
+        function afterEditing(committed)
         {
             WebInspector.markBeingEdited(scriptTreeElement.treeOutline.element, false);
             if (callback)
-                callback();
+                callback(committed);
         }
 
         var editingConfig = new WebInspector.EditingConfig(commitHandler.bind(this), cancelHandler.bind(this));

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js (117305 => 117306)


--- trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js	2012-05-16 17:29:31 UTC (rev 117305)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js	2012-05-16 17:36:23 UTC (rev 117306)
@@ -132,7 +132,7 @@
 
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
-     * @param {function()=} callback
+     * @param {function(boolean)=} callback
      */
     rename: function(uiSourceCode, callback)
     {

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


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-05-16 17:29:31 UTC (rev 117305)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-05-16 17:36:23 UTC (rev 117306)
@@ -990,10 +990,19 @@
             this._navigatorController.showNavigatorOverlay();
         this._navigator.rename(snippetJavaScriptSource, callback.bind(this));
     
-        function callback()
+        /**
+         * @param {boolean} committed
+         */
+        function callback(committed)
         {
             if (shouldHideNavigator)
                 this._navigatorController.hideNavigatorOverlay();
+
+            if (!committed) {
+                WebInspector.scriptSnippetModel.deleteScriptSnippet(snippetJavaScriptSource);
+                return;
+            }
+
             this._showSourceLine(snippetJavaScriptSource);
         }
     },
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to