Closed Bug 1689254 Opened 4 years ago Closed 2 months ago

Lazily initialize zoom UI

Categories

(Firefox :: Menus, task, P3)

task

Tracking

()

RESOLVED FIXED
139 Branch
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")

Keywords: perf:startup
Whiteboard: [fxperf:p3]
Assignee: nobody → Louismascari

Hey there, I'm a new contributor and will be working on this bug, thanks.

Mentor: emmamalysz
Attachment #9411608 - Attachment is obsolete: true
Assignee: Louismascari → nobody
Assignee: nobody → jasonjabarjones

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.

Flags: needinfo?(mconley)

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?

Flags: needinfo?(mconley) → needinfo?(jasonjabarjones)

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.

Flags: needinfo?(jasonjabarjones) → needinfo?(mconley)

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.

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?

(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.

Flags: needinfo?(mconley)

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.

Flags: needinfo?(mconley)

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
Flags: needinfo?(mconley)
Attachment #9472522 - Attachment is obsolete: true
See Also: → 1956009
Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cd0dc019dbf0 Lazily initialize individual zoom UI components r=mconley,tabbrowser-reviewers
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
QA Whiteboard: [qa-triage-done-c140/b139]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: