Web Inspector: Zooming of docked Web Inspector affects the webpage, but reset to...
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 May 2016 19:47:03 +0000 (19:47 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 May 2016 19:47:03 +0000 (19:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157234
rdar://problem/26027177

Always prevent default for the zoom keyboard shortcuts to avoid passing the event back to
Safari to handle and add explicit beeps when max/min is hit.

Reviewed by Brian Burg.

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded): Removed setting implicitlyPreventsDefault on zoom keyboard shortcuts.
(WebInspector._increaseZoom): Add explicit beep and remove preventDefault call.
(WebInspector._decreaseZoom): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200332 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js

index 5ce84db..420b5ce 100644 (file)
@@ -1,3 +1,19 @@
+2016-05-02  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: Zooming of docked Web Inspector affects the webpage, but reset to 0 does not
+        https://bugs.webkit.org/show_bug.cgi?id=157234
+        rdar://problem/26027177
+
+        Always prevent default for the zoom keyboard shortcuts to avoid passing the event back to
+        Safari to handle and add explicit beeps when max/min is hit.
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.contentLoaded): Removed setting implicitlyPreventsDefault on zoom keyboard shortcuts.
+        (WebInspector._increaseZoom): Add explicit beep and remove preventDefault call.
+        (WebInspector._decreaseZoom): Ditto.
+
 2016-05-01  Dan Bernstein  <mitz@apple.com>
 
         WebInspectorUI.framework/Versions/A/Resources/Images/Legacy is empty
index a533e9c..abbc937 100644 (file)
@@ -263,8 +263,6 @@ WebInspector.contentLoaded = function()
 
     this._increaseZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Plus, this._increaseZoom.bind(this));
     this._decreaseZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Minus, this._decreaseZoom.bind(this));
-    this._increaseZoomKeyboardShortcut.implicitlyPreventsDefault = this._decreaseZoomKeyboardShortcut.implicitlyPreventsDefault = false;
-
     this._resetZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "0", this._resetZoom.bind(this));
 
     this._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, `${i}`, this._showTabAtIndex.bind(this, i)));
@@ -1960,12 +1958,13 @@ WebInspector._increaseZoom = function(event)
     const epsilon = 0.0001;
     const maximumZoom = 2.4;
     let currentZoom = this._zoomFactor();
-    if (currentZoom + epsilon >= maximumZoom)
+    if (currentZoom + epsilon >= maximumZoom) {
+        InspectorFrontendHost.beep();
         return;
+    }
 
     let newZoom = Math.min(maximumZoom, currentZoom + 0.2);
     this._setZoomFactor(newZoom);
-    event.preventDefault();
 };
 
 WebInspector._decreaseZoom = function(event)
@@ -1973,12 +1972,13 @@ WebInspector._decreaseZoom = function(event)
     const epsilon = 0.0001;
     const minimumZoom = 0.6;
     let currentZoom = this._zoomFactor();
-    if (currentZoom - epsilon <= minimumZoom)
+    if (currentZoom - epsilon <= minimumZoom) {
+        InspectorFrontendHost.beep();
         return;
+    }
 
     let newZoom = Math.max(minimumZoom, currentZoom - 0.2);
     this._setZoomFactor(newZoom);
-    event.preventDefault();
 };
 
 WebInspector._resetZoom = function(event)