Skip to content
Snippets Groups Projects
  • Emilio Cobos Álvarez's avatar
    ee23efc9
    Bug 1773813 - Incorporate OS zoom factor in window sizing calculations. r=tnikkel · ee23efc9
    Emilio Cobos Álvarez authored
    In bug 1773342 I made OS text scale factor behave like a full zoom
    factor which applies to all pages (including the browser chrome). That's
    generally straight forward but it makes some callsites that use unzoomed
    CSS coordinates misbehave (or behave correctly accidentally actually in
    some other cases).
    
    The main fix here is making
    nsIBaseWindow::UnscaledDevicePixelsPerCSSPixel() and
    nsIScreen::GetDefaultCSSScaleFactor() account for OS zoom as necessary.
    However, I also went through the relevant code and cleaned it up to use
    typed units and operations when possible.
    
    The setup means:
    
     * nsIWidget::GetDefaultScale() doesn't account for OS full zoom.
     * nsIBaseWindow and nsIScreen does.
    
    These are the places where this should matter and stuff can get
    confused, but this works surprisingly well for all callers (except one
    nsDeviceContext one which we use only for PuppetWidget and we can
    remove by falling back to 1.0 like all other widgets until the update
    comes).
    
    Differential Revision: https://phabricator.services.mozilla.com/D149033
    ee23efc9
    History
    Bug 1773813 - Incorporate OS zoom factor in window sizing calculations. r=tnikkel
    Emilio Cobos Álvarez authored
    In bug 1773342 I made OS text scale factor behave like a full zoom
    factor which applies to all pages (including the browser chrome). That's
    generally straight forward but it makes some callsites that use unzoomed
    CSS coordinates misbehave (or behave correctly accidentally actually in
    some other cases).
    
    The main fix here is making
    nsIBaseWindow::UnscaledDevicePixelsPerCSSPixel() and
    nsIScreen::GetDefaultCSSScaleFactor() account for OS zoom as necessary.
    However, I also went through the relevant code and cleaned it up to use
    typed units and operations when possible.
    
    The setup means:
    
     * nsIWidget::GetDefaultScale() doesn't account for OS full zoom.
     * nsIBaseWindow and nsIScreen does.
    
    These are the places where this should matter and stuff can get
    confused, but this works surprisingly well for all callers (except one
    nsDeviceContext one which we use only for PuppetWidget and we can
    remove by falling back to 1.0 like all other widgets until the update
    comes).
    
    Differential Revision: https://phabricator.services.mozilla.com/D149033