Title: [199396] trunk/Source/WebInspectorUI
- Revision
- 199396
- Author
- [email protected]
- Date
- 2016-04-12 16:57:35 -0700 (Tue, 12 Apr 2016)
Log Message
Web Inspector: save inspector's zoom factor as a persistent setting across sessions
https://bugs.webkit.org/show_bug.cgi?id=156522
<rdar://problem/25635774>
Reviewed by Timothy Hatcher.
* UserInterface/Base/Main.js:
(WebInspector.loaded):
Initialize the setting and immediately set the zoom before the frontend page loads.
(WebInspector._increaseZoom):
(WebInspector._decreaseZoom):
(WebInspector._resetZoom):
Use the internal get/set method which updates the WebInspector.Setting.
(WebInspector._setZoomFactor):
Added. Round-trip through the frontend host method in case it further clamps the value.
(WebInspector._zoomFactor):
Added. Just return the setting, since there's no other way for zoom to have changed.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (199395 => 199396)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-04-12 22:48:43 UTC (rev 199395)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-04-12 23:57:35 UTC (rev 199396)
@@ -1,3 +1,26 @@
+2016-04-12 Brian Burg <[email protected]>
+
+ Web Inspector: save inspector's zoom factor as a persistent setting across sessions
+ https://bugs.webkit.org/show_bug.cgi?id=156522
+ <rdar://problem/25635774>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector.loaded):
+ Initialize the setting and immediately set the zoom before the frontend page loads.
+
+ (WebInspector._increaseZoom):
+ (WebInspector._decreaseZoom):
+ (WebInspector._resetZoom):
+ Use the internal get/set method which updates the WebInspector.Setting.
+
+ (WebInspector._setZoomFactor):
+ Added. Round-trip through the frontend host method in case it further clamps the value.
+
+ (WebInspector._zoomFactor):
+ Added. Just return the setting, since there's no other way for zoom to have changed.
+
2016-04-12 Joseph Pecoraro <[email protected]>
Web Inspector: Show the normal Native icon for all Internal objects in Heap Snapshots
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (199395 => 199396)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2016-04-12 22:48:43 UTC (rev 199395)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2016-04-12 23:57:35 UTC (rev 199396)
@@ -170,6 +170,9 @@
if (this.showPaintRectsSetting.value && window.PageAgent && PageAgent.setShowPaintRects)
PageAgent.setShowPaintRects(true);
+ this._zoomFactorSetting = new WebInspector.Setting("zoom-factor", 1);
+ this._setZoomFactor(this._zoomFactorSetting.value);
+
this.mouseCoords = {
x: 0,
y: 0
@@ -1638,7 +1641,7 @@
let dimension = Math.max(0, window[windowProperty] - delta);
// If zoomed in/out, there be greater/fewer document pixels shown, but the inspector's
// width or height should be the same in device pixels regardless of the document zoom.
- dimension *= InspectorFrontendHost.zoomFactor();
+ dimension *= this._zoomFactor();
if (this._dockSide === "bottom")
InspectorFrontendHost.setAttachedWindowHeight(dimension);
@@ -1958,12 +1961,12 @@
{
const epsilon = 0.0001;
const maximumZoom = 2.4;
- let currentZoom = InspectorFrontendHost.zoomFactor();
+ let currentZoom = this._zoomFactor();
if (currentZoom + epsilon >= maximumZoom)
return;
let newZoom = Math.min(maximumZoom, currentZoom + 0.2);
- InspectorFrontendHost.setZoomFactor(newZoom);
+ this._setZoomFactor(newZoom);
event.preventDefault();
};
@@ -1971,20 +1974,32 @@
{
const epsilon = 0.0001;
const minimumZoom = 0.6;
- let currentZoom = InspectorFrontendHost.zoomFactor();
+ let currentZoom = this._zoomFactor();
if (currentZoom - epsilon <= minimumZoom)
return;
let newZoom = Math.max(minimumZoom, currentZoom - 0.2);
- InspectorFrontendHost.setZoomFactor(newZoom);
+ this._setZoomFactor(newZoom);
event.preventDefault();
};
WebInspector._resetZoom = function(event)
{
- InspectorFrontendHost.setZoomFactor(1);
+ this._setZoomFactor(1);
};
+WebInspector._zoomFactor = function()
+{
+ return this._zoomFactorSetting.value;
+}
+
+WebInspector._setZoomFactor = function(factor)
+{
+ InspectorFrontendHost.setZoomFactor(factor);
+ // Round-trip through the frontend host API in case the requested factor is not used.
+ this._zoomFactorSetting.value = InspectorFrontendHost.zoomFactor();
+}
+
WebInspector._showTabAtIndex = function(i, event)
{
if (i <= WebInspector.tabBar.tabBarItems.length)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes