Tab zoom level is not preserved when switching to and from a browser toolbox tab opened from the about:debugging page
Categories
(DevTools :: about:debugging, defect)
Tracking
(firefox107 fixed)
Tracking | Status | |
---|---|---|
firefox107 | --- | fixed |
People
(Reporter: scunnane, Assigned: jdescottes)
References
Details
Attachments
(1 file)
STR
- Put a
debugger
statement into an XPCShell test and run the test with$ ./mach xpcshell-test path/to/test/file --jsdebugger
- In Firefox, visit about:debugging and click on localhost:6000 in the left sidebar. Then scroll down and click "Inspect" to open the browser toolbox
- In the new browser toolbox tab, press ctrl-+ 5 times to zoom the UI to 150%
- Click on another open tab
- Click back on the browser toolbox tab
Expected
The browser toolbox tab preserves the 150% zoom level when I click away from and back to that tab.
Actual
The browser toolbox tab's zoom level reverts to 100% when I click away from the browser toolbox tab and then back to it. If I then try to bump the zoom level back up to 150%, I don't start from 100% zoom, I start from 150% zoom. (So the first time I press ctrl-+ after clicking back to the browser toolbox tab, the UI zooms from 100% to 160%.)
Note: this behavior happens regardless of whether I increase the zoom level to above 100% or reduce it to below 100%.
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Can reproduce on macos as well, thanks for filing! Not a recent regression. Maybe the devtools toolbox zoom handling conflicts with the default one from firefox?
Assignee | ||
Comment 2•2 years ago
•
|
||
devtools toolbox zoom handling conflicts with the default one from firefox?
I think that's it. If you zoom from the "View > Zoom" menu, then the zoom will persist when changing tabs.
The devtools zoom is handled at https://searchfox.org/mozilla-central/source/devtools/client/shared/zoom-keys.js
We basically override all the default zoom shortcuts and perform the following:
const zoomIn = function(event) {
setZoom(zoomValue + 0.1);
event.preventDefault();
};
const zoomOut = function(event) {
setZoom(zoomValue - 0.1);
event.preventDefault();
};
const zoomReset = function(event) {
setZoom(1);
event.preventDefault();
};
const setZoom = function(newValue) {
// cap zoom value
zoomValue = Math.max(newValue, MIN_ZOOM);
zoomValue = Math.min(zoomValue, MAX_ZOOM);
// Prevent the floating-point error. (e.g. 1.1 + 0.1 = 1.2000000000000002)
zoomValue = Math.round(zoomValue * 10) / 10;
bc.fullZoom = zoomValue;
Services.prefs.setCharPref(ZOOM_PREF, zoomValue);
};
Considering that we call event.preventDefault();
, maybe we prevent the browser to correctly persist the zoom somewhere.
Edit: yes we prevent the event to reach https://searchfox.org/mozilla-central/rev/b1e5f2c7c96be36974262551978d54f457db2cae/browser/base/content/browser-fullZoom.js#564-587 which should persist the zoom value.
We might just disable those shortcuts when the toolbox is in a "page" host.
Assignee | ||
Comment 3•2 years ago
|
||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
bugherder |
Description
•