Title: [185104] trunk/Source/WebInspectorUI
Revision
185104
Author
[email protected]
Date
2015-06-01 22:46:23 -0700 (Mon, 01 Jun 2015)

Log Message

Web Inspector: Better handle keyboard events in the quick console prompt
https://bugs.webkit.org/show_bug.cgi?id=145548

Patch by Joseph Pecoraro <[email protected]> on 2015-06-01
Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WebInspector.saveDataToFile):
Move generic InspectorFrontendHost code here.

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype._save):
(WebInspector.ContentBrowser.prototype._saveAs):
(WebInspector.ContentBrowser.prototype._saveDataToFile): Deleted.
Use the generic save code.

* UserInterface/Controllers/_javascript_LogViewController.js:
(WebInspector._javascript_LogViewController):
(WebInspector._javascript_LogViewController.prototype._save):
(WebInspector._javascript_LogViewController.prototype._saveAs):
Handle save keyboard shortcuts while the prompt is focused.

* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView.prototype.focusSearchBar):
(WebInspector.LogContentView.prototype.save):
(WebInspector.LogContentView.prototype.saveAs):
Better handle keyboard shortcut cases in the console prompt for cases
like a collapsed or split console view.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (185103 => 185104)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-06-02 05:39:11 UTC (rev 185103)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-06-02 05:46:23 UTC (rev 185104)
@@ -1,3 +1,33 @@
+2015-06-01  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Better handle keyboard events in the quick console prompt
+        https://bugs.webkit.org/show_bug.cgi?id=145548
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.saveDataToFile):
+        Move generic InspectorFrontendHost code here.
+
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype._save):
+        (WebInspector.ContentBrowser.prototype._saveAs):
+        (WebInspector.ContentBrowser.prototype._saveDataToFile): Deleted.
+        Use the generic save code.
+
+        * UserInterface/Controllers/_javascript_LogViewController.js:
+        (WebInspector._javascript_LogViewController):
+        (WebInspector._javascript_LogViewController.prototype._save):
+        (WebInspector._javascript_LogViewController.prototype._saveAs):
+        Handle save keyboard shortcuts while the prompt is focused.
+
+        * UserInterface/Views/LogContentView.js:
+        (WebInspector.LogContentView.prototype.focusSearchBar):
+        (WebInspector.LogContentView.prototype.save):
+        (WebInspector.LogContentView.prototype.saveAs):
+        Better handle keyboard shortcut cases in the console prompt for cases
+        like a collapsed or split console view.
+
 2015-06-01  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Pause/resume button in the debugger dashboard is vertically misaligned

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (185103 => 185104)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-06-02 05:39:11 UTC (rev 185103)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-06-02 05:46:23 UTC (rev 185104)
@@ -655,6 +655,25 @@
     InspectorFrontendHost.closeWindow();
 };
 
+WebInspector.saveDataToFile = function(saveData, forceSaveAs)
+{
+    console.assert(saveData);
+    if (!saveData)
+        return;
+
+    if (typeof saveData.customSaveHandler === "function") {
+        saveData.customSaveHandler(forceSaveAs);
+        return;
+    }
+
+    console.assert(saveData.url);
+    console.assert(typeof saveData.content === "string");
+    if (!saveData.url || typeof saveData.content !== "string")
+        return;
+
+    InspectorFrontendHost.save(saveData.url, saveData.content, false, forceSaveAs || saveData.forceSaveAs);
+};
+
 WebInspector.isConsoleFocused = function()
 {
     return this.quickConsole.prompt.focused;

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_LogViewController.js (185103 => 185104)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_LogViewController.js	2015-06-02 05:39:11 UTC (rev 185103)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_LogViewController.js	2015-06-02 05:46:23 UTC (rev 185104)
@@ -60,6 +60,8 @@
         this._promptFindKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "F", this._handleFindShortcut.bind(this), this._prompt.element);
         this._promptFindNextKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "G", this._handleFindNextShortcut.bind(this), this._prompt.element);
         this._promptFindPreviousKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "G", this._handleFindPreviousShortcut.bind(this), this._prompt.element);
+        this._promptSaveKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this), this._prompt.element);
+        this._promptSaveAsKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._saveAs.bind(this), this._prompt.element);
 
         this.startNewSession();
     }
@@ -260,6 +262,16 @@
         this.delegate.highlightPreviousSearchMatch();
     }
 
+    _save()
+    {
+        this.delegate.save();
+    }
+
+    _saveAs()
+    {
+        this.delegate.saveAs();
+    }
+
     _appendConsoleMessageView(messageView, repeatCountWasInterrupted)
     {
         var wasScrolledToBottom = this.isScrolledToBottom();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js (185103 => 185104)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2015-06-02 05:39:11 UTC (rev 185103)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2015-06-02 05:46:23 UTC (rev 185104)
@@ -317,32 +317,13 @@
         this.goForward();
     },
 
-    _saveDataToFile: function(saveData, forceSaveAs)
-    {
-        console.assert(saveData);
-        if (!saveData)
-            return;
-
-        if (typeof saveData.customSaveHandler === "function") {
-            saveData.customSaveHandler(forceSaveAs);
-            return;
-        }
-
-        console.assert(saveData.url);
-        console.assert(typeof saveData.content === "string");
-        if (!saveData.url || typeof saveData.content !== "string")
-            return;
-
-        InspectorFrontendHost.save(saveData.url, saveData.content, false, forceSaveAs || saveData.forceSaveAs);
-    },
-
     _save: function(event)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSave)
             return;
 
-        this._saveDataToFile(currentContentView.saveData);
+        WebInspector.saveDataToFile(currentContentView.saveData);
     },
 
     _saveAs: function(event)
@@ -351,7 +332,7 @@
         if (!currentContentView || !currentContentView.supportsSave)
             return;
 
-        this._saveDataToFile(currentContentView.saveData, true);
+        WebInspector.saveDataToFile(currentContentView.saveData, true);
     },
 
     _showFindBanner: function(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (185103 => 185104)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2015-06-02 05:39:11 UTC (rev 185103)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2015-06-02 05:46:23 UTC (rev 185104)
@@ -229,9 +229,34 @@
 
     focusSearchBar: function()
     {
+        if (!this.visible)
+            return;
+
         this._searchBar.focus();
     },
 
+    save: function()
+    {
+        if (!this.visible)
+            return;
+
+        if (WebInspector.isShowingSplitConsole())
+            return;
+
+        WebInspector.saveDataToFile(this.saveData);
+    },
+
+    saveAs: function()
+    {
+        if (!this.visible)
+            return;
+
+        if (WebInspector.isShowingSplitConsole())
+            return;
+
+        WebInspector.saveDataToFile(this.saveData, true);
+    },
+
     highlightPreviousSearchMatch: function()
     {
         if (!this.searchInProgress || isEmptyObject(this._searchMatches))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to