Title: [131184] trunk/Source/WebCore
Revision
131184
Author
[email protected]
Date
2012-10-12 06:51:57 -0700 (Fri, 12 Oct 2012)

Log Message

Web Inspector: use hard-coded zoom factors instead of 1.2 powers.
https://bugs.webkit.org/show_bug.cgi?id=99173

Reviewed by Vsevolod Vlasov.

Overwise we step too fast.

* inspector/front-end/inspector.js:
(WebInspector._zoomIn):
(WebInspector._zoomOut):
(WebInspector):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131183 => 131184)


--- trunk/Source/WebCore/ChangeLog	2012-10-12 13:11:36 UTC (rev 131183)
+++ trunk/Source/WebCore/ChangeLog	2012-10-12 13:51:57 UTC (rev 131184)
@@ -1,3 +1,17 @@
+2012-10-12  Pavel Feldman  <[email protected]>
+
+        Web Inspector: use hard-coded zoom factors instead of 1.2 powers.
+        https://bugs.webkit.org/show_bug.cgi?id=99173
+
+        Reviewed by Vsevolod Vlasov.
+
+        Overwise we step too fast.
+
+        * inspector/front-end/inspector.js:
+        (WebInspector._zoomIn):
+        (WebInspector._zoomOut):
+        (WebInspector):
+
 2012-10-12  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: move delete watch _expression_ farther from the expand triangle

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (131183 => 131184)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-10-12 13:11:36 UTC (rev 131183)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-10-12 13:51:57 UTC (rev 131184)
@@ -233,13 +233,13 @@
 
     _zoomIn: function()
     {
-        ++this._zoomLevel;
+        this._zoomLevel = Math.min(this._zoomLevel + 1, WebInspector.Zoom.Table.length - WebInspector.Zoom.DefaultOffset - 1);
         this._requestZoom();
     },
 
     _zoomOut: function()
     {
-        --this._zoomLevel;
+        this._zoomLevel = Math.max(this._zoomLevel - 1, -WebInspector.Zoom.DefaultOffset);
         this._requestZoom();
     },
 
@@ -252,7 +252,11 @@
     _requestZoom: function()
     {
         WebInspector.settings.zoomLevel.set(this._zoomLevel);
-        InspectorFrontendHost.setZoomFactor(Math.pow(1.2, this._zoomLevel));
+        // For backwards compatibility, zoomLevel takes integers (with 0 being default zoom).
+        var index = this._zoomLevel + WebInspector.Zoom.DefaultOffset;
+        index = Math.min(WebInspector.Zoom.Table.length - 1, index);
+        index = Math.max(0, index);
+        InspectorFrontendHost.setZoomFactor(WebInspector.Zoom.Table[index]);
     },
 
     toggleSearchingForNode: function()
@@ -962,3 +966,8 @@
 }
 
 WebInspector.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
+
+WebInspector.Zoom = {
+    Table: [0.25, 0.33, 0.5, 0.66, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5],
+    DefaultOffset: 6
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to