Title: [192790] trunk/Source/WebInspectorUI
Revision
192790
Author
[email protected]
Date
2015-11-29 16:56:22 -0800 (Sun, 29 Nov 2015)

Log Message

Web Inspector: Add context menu item to Reload the Inspector
https://bugs.webkit.org/show_bug.cgi?id=141742

Reviewed by Timothy Hatcher.

Add a global context menu and global shortcut (Cmd-Opt-Shift-R) to
reload the Web Inspector frontend without closing the browser.

This should make it possible to more quickly fix typos, small nits,
etc. without having to relaunch. It might also make state
restoration bugs more visible in engineering builds, since there
is hardly any delay between seeing the old and reloaded frontends.

Note that this functionality reloads scripts from the configuration's
build directory, so you still need to "build" WebInspectorUI to ensure
that any changed files are properly minified and staged.

* UserInterface/Base/Main.js:
(WebInspector.unlocalizedString):

    Added. Make it obvious when strings are intentionally not localized.

(WebInspector._contextMenuRequested):

    If the "Show Debug UI" setting is available and true, add
    a global "Reload Web Inspector" menu item to every context
    menu. Otherwise, don't eagerly create a context menu.
* UserInterface/Debug/Bootstrap.js: Add Cmd-Opt-Shift-R shortcut.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (192789 => 192790)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-11-30 00:39:08 UTC (rev 192789)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-11-30 00:56:22 UTC (rev 192790)
@@ -1,5 +1,36 @@
 2015-11-29  Brian Burg  <[email protected]>
 
+        Web Inspector: Add context menu item to Reload the Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=141742
+
+        Reviewed by Timothy Hatcher.
+
+        Add a global context menu and global shortcut (Cmd-Opt-Shift-R) to
+        reload the Web Inspector frontend without closing the browser.
+
+        This should make it possible to more quickly fix typos, small nits,
+        etc. without having to relaunch. It might also make state
+        restoration bugs more visible in engineering builds, since there
+        is hardly any delay between seeing the old and reloaded frontends.
+
+        Note that this functionality reloads scripts from the configuration's
+        build directory, so you still need to "build" WebInspectorUI to ensure
+        that any changed files are properly minified and staged.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.unlocalizedString):
+
+            Added. Make it obvious when strings are intentionally not localized.
+
+        (WebInspector._contextMenuRequested):
+
+            If the "Show Debug UI" setting is available and true, add
+            a global "Reload Web Inspector" menu item to every context
+            menu. Otherwise, don't eagerly create a context menu.
+        * UserInterface/Debug/Bootstrap.js: Add Cmd-Opt-Shift-R shortcut.
+
+2015-11-29  Brian Burg  <[email protected]>
+
         Web Inspector: allow multiple UI components to add menu items upon getting a "contextmenu" event
         https://bugs.webkit.org/show_bug.cgi?id=151629
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (192789 => 192790)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-11-30 00:39:08 UTC (rev 192789)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-11-30 00:56:22 UTC (rev 192790)
@@ -883,6 +883,14 @@
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
+WebInspector.unlocalizedString = function(string)
+{
+    // Intentionally do nothing, since this is for engineering builds
+    // (such as in Debug UI) or in text that is standardized in English.
+    // For example, CSS property names and values are never localized.
+    return string;
+}
+
 WebInspector.UIString = function(string, vararg)
 {
     if (WebInspector.dontLocalizeUserInterface)
@@ -1328,8 +1336,21 @@
 
 WebInspector._contextMenuRequested = function(event)
 {
-    const _onlyExisting_ = true;
-    let proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event, onlyExisting);
+    let proposedContextMenu;
+
+    // This is setting is only defined in engineering builds.
+    let showDebugUI = WebInspector.showDebugUISetting && WebInspector.showDebugUISetting.value;
+    if (showDebugUI) {
+        proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        proposedContextMenu.appendSeparator();
+        proposedContextMenu.appendItem(WebInspector.unlocalizedString("Reload Web Inspector"), () => {
+            window.location.reload();
+        });
+    } else {
+        const _onlyExisting_ = true;
+        proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event, onlyExisting);
+    }
+
     if (proposedContextMenu)
         proposedContextMenu.show();
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js (192789 => 192790)


--- trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js	2015-11-30 00:39:08 UTC (rev 192789)
+++ trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js	2015-11-30 00:56:22 UTC (rev 192790)
@@ -26,10 +26,17 @@
 // This function is invoked after the inspector has loaded.
 WebInspector.runBootstrapOperations = function() {
     WebInspector.showDebugUISetting = new WebInspector.Setting("show-debug-ui", false);
+
+    // Toggle Debug UI setting.
     new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "D", () => {
         WebInspector.showDebugUISetting.value = !WebInspector.showDebugUISetting.value;
     });
 
+    // Reload the Web Inspector.
+    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "R", () => {
+        window.location.reload();
+    });
+
     let toolTip = "Enable dump inspector messages to console";
     let activatedToolTip = "Disable dump inspector messages to console";
     let debugInspectorToolbarButton = new WebInspector.ActivateButtonToolbarItem("debug-inspector", toolTip, activatedToolTip, null, "Images/Console.svg");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to