Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: eb01eca78d82335d2372d2add5ce5e4304b71930 https://github.com/WebKit/WebKit/commit/eb01eca78d82335d2372d2add5ce5e4304b71930 Author: Glen Whitney <g...@studioinfinity.org> Date: 2024-04-29 (Mon, 29 Apr 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] Correct scaling for DPI. https://bugs.webkit.org/show_bug.cgi?id=247980 Reviewed by Michael Catanzaro. Move the scaling factor formerly in WebKitWebView.cpp (responsive to the xft-dpi setting) into WebKitWebViewBase.cpp, and split it into two scaling factors. The first, a page scaling factor, uses screenDPI to ensure that a length specified by a CSS unit of 1in will appear on the screen as one physical inch. The second, a text scaling factor, ensures that text specified as 96px in size will have a height on-screen as specified by fontDPI (which is primarily driven by the xft-dpi setting), in terms of the number of screen pixels taken up. The two scaling factors are refreshed when any one of the inputs for computing them changes: the GDK_SCALE factor, the xft-dpi setting, or the screenDPI of the device it is displayed on (say by being dragged to a different monitor). Throughout, at the default zoom level, a CSS 1in dimension is kept at one physical inch. The scale factors are kept internal to WebKitWebViewBase (which helps keep GTK dependencies grouped and reduces the total code in WebKitWebView enclosed in `#ifdef PLATFORM(GTK)`) but made available to WebKitWebView so that its external interfaces can maintain zoom level 1 as the default zoom level, and zoom in and out from there. So indeed, if a user of WebKitWebView asks for a zoom level of 1.5, a length specified in CSS as 1in will then occupy one and a half physical inches on screen. * 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/278128@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes