Web Inspector: Adjust font size of Developer Tools using Command,+ or Command,-
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 17:42:21 +0000 (17:42 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 17:42:21 +0000 (17:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149590

Patch by João Oliveira <hello@jxs.pt> on 2015-09-30
Reviewed by Joseph Pecoraro.

Patch by João Oliveira and Brian Burg.

Source/WebCore:

Expose the frontend page's zoom factor so we can implement relative zoom.

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::zoomFactor): Added.
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
* page/Frame.h:
(WebCore::Frame::pageZoomFactor):

Source/WebInspectorUI:

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded): Add global keyboard shortcuts for zoom in and zoom out.

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js

index 62e2c77..30dd8de 100644 (file)
@@ -1,3 +1,21 @@
+2015-09-30  João Oliveira  <hello@jxs.pt>
+
+        Web Inspector: Adjust font size of Developer Tools using Command,+ or Command,-
+        https://bugs.webkit.org/show_bug.cgi?id=149590
+
+        Reviewed by Joseph Pecoraro.
+
+        Patch by João Oliveira and Brian Burg.
+
+        Expose the frontend page's zoom factor so we can implement relative zoom.
+
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::zoomFactor): Added.
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        * page/Frame.h:
+        (WebCore::Frame::pageZoomFactor):
+
 2015-10-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Websites with invalid auth header keep loading forever
index 4861d07..23fbd1b 100644 (file)
@@ -174,15 +174,20 @@ void InspectorFrontendHost::bringToFront()
         m_client->bringToFront();
 }
 
+void InspectorFrontendHost::inspectedURLChanged(const String& newURL)
+{
+    if (m_client)
+        m_client->inspectedURLChanged(newURL);
+}
+
 void InspectorFrontendHost::setZoomFactor(float zoom)
 {
     m_frontendPage->mainFrame().setPageAndTextZoomFactors(zoom, 1);
 }
 
-void InspectorFrontendHost::inspectedURLChanged(const String& newURL)
+float InspectorFrontendHost::zoomFactor()
 {
-    if (m_client)
-        m_client->inspectedURLChanged(newURL);
+    return m_frontendPage->mainFrame().pageZoomFactor();
 }
 
 void InspectorFrontendHost::setAttachedWindowHeight(unsigned height)
index 5ef83c7..b19925b 100644 (file)
@@ -57,9 +57,11 @@ public:
     void requestSetDockSide(const String&);
     void closeWindow();
     void bringToFront();
-    void setZoomFactor(float);
     void inspectedURLChanged(const String&);
 
+    void setZoomFactor(float);
+    float zoomFactor();
+
     void setAttachedWindowHeight(unsigned);
     void setAttachedWindowWidth(unsigned);
     void setToolbarHeight(unsigned);
index 919cd7d..d5c654a 100644 (file)
     void loaded();
     void closeWindow();
     void bringToFront();
-    void setZoomFactor(unrestricted float zoom);
     void inspectedURLChanged(DOMString newURL);
 
+    void setZoomFactor(unrestricted float zoom);
+    float zoomFactor();
+
     void requestSetDockSide(DOMString side);
 
     void setAttachedWindowHeight(unsigned long height);
index 205ad9b..e057cc2 100644 (file)
@@ -1,3 +1,15 @@
+2015-09-30  João Oliveira  <hello@jxs.pt>
+
+        Web Inspector: Adjust font size of Developer Tools using Command,+ or Command,-
+        https://bugs.webkit.org/show_bug.cgi?id=149590
+
+        Reviewed by Joseph Pecoraro.
+
+        Patch by João Oliveira and Brian Burg.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.contentLoaded): Add global keyboard shortcuts for zoom in and zoom out.
+
 2015-10-01  Andres Gomez  <agomez@igalia.com>
 
         [GTK] Web Inspector: Add GTK+ icons for the numerical input and slider based Visual editors for CSS properties
index c53b8a3..d07b877 100644 (file)
@@ -245,6 +245,9 @@ WebInspector.contentLoaded = function()
     this.navigationSidebarKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "0", this.toggleNavigationSidebar.bind(this));
     this.detailsSidebarKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Option, "0", this.toggleDetailsSidebar.bind(this));
 
+    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.tabBrowser = new WebInspector.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
     this.tabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
 
@@ -1808,6 +1811,18 @@ WebInspector._copy = function(event)
     event.preventDefault();
 };
 
+WebInspector._increaseZoom = function(event) {
+    let currentZoom = InspectorFrontendHost.zoomFactor();
+    InspectorFrontendHost.setZoomFactor(currentZoom * 1.2);
+    event.preventDefault();
+};
+
+WebInspector._decreaseZoom = function(event) {
+    let currentZoom = InspectorFrontendHost.zoomFactor();
+    InspectorFrontendHost.setZoomFactor(currentZoom * 0.8);
+    event.preventDefault();
+};
+
 WebInspector._generateDisclosureTriangleImages = function()
 {
     var specifications = {};