Lazily initialize zoom UI
Categories
(Firefox :: Menus, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox139 | --- | fixed |
People
(Reporter: emmamalysz, Assigned: jasonjabarjones)
References
Details
(Keywords: perf:startup)
Attachments
(1 file, 2 obsolete files)
We now lazily initialize the app menu, so PanelMultiView.getViewNode
returns the node from within the template if the panel hasn't been opened yet.
This means appMenuZoomReset
will not be null, so we will never return early here: https://searchfox.org/mozilla-central/rev/b9384b091e901b3283ce24b6610e80699d79fd06/browser/modules/ZoomUI.jsm#132-140, and unfortunately, we end up updating the zoom UI on startup.
We should access the node directly from the document instead like:
let appMenuZoomReset = win.document.getElementById("appMenu-zoomReset-button");
. When Bug 1688700 lands, we should also add || win.document.getElementById("appMenu-zoomReset-button2")
Updated•1 year ago
|
Updated•11 months ago
|
Comment 1•11 months ago
|
||
Hey there, I'm a new contributor and will be working on this bug, thanks.
Comment 2•11 months ago
|
||
Updated•11 months ago
|
Updated•11 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Assignee | ||
Comment 3•3 months ago
|
||
Hi! New contributor here looking for some guidance on this bug.
Accessing the node directly via win.document.getElementById("appMenu-zoomReset-button2");
allows the early return, but loses the initial text label on startup. Closing and reopening the browser at a set zoom level other than default/100% has the same behavior and loses the urlbar button, but the appMenu reset button is clickable (albeit still missing its label). Overall, it seems a refresh of the zoom UI is needed even on startup.
Comment 4•3 months ago
|
||
Hm... so I guess the other part of this is that after we've lazily inserted the panel contents, and the panel appears, that we go ahead and call updateZoomUI.
Hey Jason, could you try adding this call under [here]:https://searchfox.org/mozilla-central/rev/f07a6b1e84a609fbf9746f67be9edd43b3ed3362/browser/components/customizableui/content/panelUI.js#663
updateZoomUI(gBrowser.selectedBrowser);
and see if that addresses those issues?
Assignee | ||
Comment 5•3 months ago
|
||
Assignee | ||
Comment 6•3 months ago
|
||
Hey Mike, thanks for taking a look. Opening the panel now refreshes the Zoom UI as expected. We are only missing the zoom reset button in the URL bar on initial startup if the browser is opened with a non-default zoom level.
Assignee | ||
Comment 7•3 months ago
|
||
Poking around a bit more, the early return also causes the zoom control widget (customized toolbar) to lose its text label until updateZoomUI
can be called again. In contrast to the appmenu zoom controls, the widget label is missing regardless of starting up @ default zoom or non-default zoom.
Assignee | ||
Comment 8•3 months ago
|
||
Correction, the toolbar widget zoom and appmenu zoom behave similarly. Is it prudent to duplicate some of code within updateZoomUI
and target these components individually to refresh on startup?
Comment 9•3 months ago
|
||
(In reply to Jason Jones from comment #8)
Correction, the toolbar widget zoom and appmenu zoom behave similarly. Is it prudent to duplicate some of code within
updateZoomUI
and target these components individually to refresh on startup?
Yes, it sounds like, for now, we need to change updateZoomUI
to update each individual component (URL bar indicator, toolbar item, and appmenu controls) individually, and only skip updating the last one if the menu hasn't ever been opened.
Assignee | ||
Comment 10•2 months ago
|
||
Mike, do you know which tests are relevant to run here? My current approach updates the URL bar indicator and toolbar item on startup and skips the appmenu controls. Opening the panel calls updateZoomUI
again, updating the appmenu controls after that element is loaded in.
Comment 11•2 months ago
|
||
Hi Jason,
All of the tests under browser/base/content/test/zoom are relevant, I think.
These also seem worth running:
- browser/components/customizableui/test/browser_934951_zoom_in_toolbar.js
- browser/components/customizableui/test/browser_947914_button_zoomIn.js
- browser/components/customizableui/test/browser_947914_button_zoomOut.js
- browser/components/customizableui/test/browser_947914_button_zoomReset.js
- browser/components/customizableui/test/browser_customization_context_menus.js
- browser/components/extensions/test/browser/browser_ext_devtools_panel_zoom.js
- browser/components/extensions/test/browser/browser_ext_tabs_zoom.js
- browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js
- browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js
- browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js
- browser/components/tabbrowser/test/browser/tabs/browser_preloadedBrowser_zoom.js
- browser/modules/test/browser/browser_urlBar_zoom.js
Assignee | ||
Comment 12•2 months ago
|
||
Updated•2 months ago
|
Comment 13•2 months ago
|
||
Comment 14•2 months ago
|
||
bugherder |
Updated•1 month ago
|
Description
•