Recommended way for addon to implement global zoom

Is there a recommended way to do a global zoom (rather then the default site specific zoom)? I offer global zoom in an addon of mine but I dont like the way I did it - I held a global value and on focus of any tab I set the zoom level.

I was thinking:

  1. User enables global zoom

  2. My addon finds all the site specific settings and saves this to file

  3. My addon then ensure siteSpecific pref is enabled. Then it tricks firefox to thinking that all sites are the same domain

  4. If user disables global zoom then:

  5. I resorted the saved site specific prefs saved in step 2

My plan to trick it to thinking all sites are same site: I don’t know how, but my plan is to trick nsIContentPrefService2 into returning a value for a dummy site I set for the name browser.content.full-zoom.

1 Like

I used DXR and re-thought it out. It’s much better then my old method where I had monkey patched functions in FullZoom module. The only negative to the new approach is this line:

https://github.com/Noitidart/GlobalZoom/blob/master/bootstrap.js#L53-L57

On zoom change I have to tap into Services.wm.getMostRecentWindow(null).ZoomManager.zoom; to get the new zoom level.

The other kind of negative, is that sites are not updating in the background, as I haven’t tricked the manager into thinking everything is the same domain. If anyone has any ideas on how to do this in an e10s way that would be awesome.

Hello @noitidart :slight_smile: Do you have anything to share about your project. Did you release an add-on since the few years back you created this discussion?

For those interested in Zoom. I suggest to use Zoom Page WE as inspiration

It does what you need. It is for Firefox. It’s the most advanced and stable add-on for anything related to zoom.

So maybe some of it’s Libre/Open Source code could be recycled for your project.