[webkit-changes] [WebKit/WebKit] 571358: [GTK] Better scaling for DPI.

Glen Whitney noreply at github.com
Sat May 18 15:13:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5713584438d253c13cb10966d7bac9cef1f9082f
      https://github.com/WebKit/WebKit/commit/5713584438d253c13cb10966d7bac9cef1f9082f
  Author: Glen Whitney <glen at studioinfinity.org>
  Date:   2024-05-18 (Sat, 18 May 2024)

  Changed paths:
    M Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
    M Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

  Log Message:
  -----------
  [GTK] Better scaling for DPI.
https://bugs.webkit.org/show_bug.cgi?id=247980

Reviewed by Michael Catanzaro.

Revises the web page rendering to scale all page elements with respect
to the fontDPI. In essence, this prioritizes the consistency that a
CSS 1em length for a 96px font should be identical to a CSS 1in length,
over compliance with the standard that a CSS 1px dimension should be the
integer multiple of a device pixel that best approximates a "reference
pixel" subtending .0213 degrees at the expected viewing distance (1/96th
of an inch at 28 inches).

The implementation moves the text scaling factor formerly in
WebKitWebView.cpp (responsive to the xft-dpi setting) into
WebKitWebViewBase.cpp, and changes it into a page scaling factor. The
page scaling factor is refreshed when any possible input for computing
it changes.

This PR differs from the previous one submitted in resolution of 247980
in that it employs a much simpler formula for scaling that should both
affect fewer instances of WebKitGTK running in practice, and should
also resolve https://bugs.webkit.org/show_bug.cgi?id=250138

* Source/WebCore/platform/gtk/PlatformScreenGtk.cpp:
(WebCore::fontDPI):
* Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed):
(webkitWebViewDispose):
(webkit_web_view_set_zoom_level):
(webkit_web_view_get_zoom_level):
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
(refreshInternalScaling):
(webkitWebViewBaseUpdateDisplayID):
(webkitWebViewBaseDispose):
(webkitWebViewBaseGetScaleFactors):
(deviceScaleFactorChanged):
(webkitWebViewBaseCreateWebPage):
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h:

Canonical link: https://commits.webkit.org/278962@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list