Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
webkit2gtk3.18632
webkit-font-scaling.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File webkit-font-scaling.patch of Package webkit2gtk3.18632
Index: webkitgtk-2.30.4/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp =================================================================== --- webkitgtk-2.30.4.orig/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp +++ webkitgtk-2.30.4/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp @@ -81,7 +81,6 @@ struct _WebKitSettingsPrivate { CString mediaContentTypesRequiringHardwareSupport; bool allowModalDialogs { false }; bool zoomTextOnly { false }; - double screenDpi { 96 }; #if PLATFORM(GTK) bool enableBackForwardNavigationGestures { false }; #endif @@ -176,7 +175,6 @@ enum { static void webKitSettingsDispose(GObject* object) { - WebCore::setScreenDPIObserverHandler(nullptr, object); G_OBJECT_CLASS(webkit_settings_parent_class)->dispose(object); } @@ -191,23 +189,6 @@ static void webKitSettingsConstructed(GO bool mediaStreamEnabled = prefs->mediaStreamEnabled(); prefs->setMediaDevicesEnabled(mediaStreamEnabled); prefs->setPeerConnectionEnabled(mediaStreamEnabled); - - settings->priv->screenDpi = WebCore::screenDPI(); - WebCore::setScreenDPIObserverHandler([settings]() { - auto newScreenDpi = WebCore::screenDPI(); - if (newScreenDpi == settings->priv->screenDpi) - return; - - auto scalingFactor = newScreenDpi / settings->priv->screenDpi; - auto fontSize = settings->priv->preferences->defaultFontSize(); - auto monospaceFontSize = settings->priv->preferences->defaultFixedFontSize(); - settings->priv->screenDpi = newScreenDpi; - - g_object_freeze_notify(G_OBJECT(settings)); - webkit_settings_set_default_font_size(settings, std::round(fontSize * scalingFactor)); - webkit_settings_set_default_monospace_font_size(settings, std::round(monospaceFontSize * scalingFactor)); - g_object_thaw_notify(G_OBJECT(settings)); - }, object); } static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec) Index: webkitgtk-2.30.4/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp =================================================================== --- webkitgtk-2.30.4.orig/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp +++ webkitgtk-2.30.4/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp @@ -73,6 +73,7 @@ #include <WebCore/CertificateInfo.h> #include <WebCore/GUniquePtrSoup.h> #include <WebCore/JSDOMExceptionHandling.h> +#include <WebCore/PlatformScreen.h> #include <WebCore/RefPtrCairo.h> #include <WebCore/URLSoup.h> #include <glib/gi18n-lib.h> @@ -306,6 +307,8 @@ struct _WebKitWebViewPrivate { GRefPtr<WebKitWebsiteDataManager> websiteDataManager; GRefPtr<WebKitWebsitePolicies> websitePolicies; + + double textScaleFactor; }; static guint signals[LAST_SIGNAL] = { 0, }; @@ -793,6 +796,15 @@ static void webkitWebViewConstructed(GOb priv->backForwardList = adoptGRef(webkitBackForwardListCreate(&getPage(webView).backForwardList())); priv->windowProperties = adoptGRef(webkitWindowPropertiesCreate()); + + priv->textScaleFactor = WebCore::screenDPI() / 96.; + getPage(webView).setTextZoomFactor(priv->textScaleFactor); + WebCore::setScreenDPIObserverHandler([webView] { + auto& page = getPage(webView); + auto zoomFactor = page.textZoomFactor() / webView->priv->textScaleFactor; + webView->priv->textScaleFactor = WebCore::screenDPI() / 96.; + page.setTextZoomFactor(zoomFactor * webView->priv->textScaleFactor); + }, webView); } static void webkitWebViewSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec) @@ -956,6 +968,8 @@ static void webkitWebViewDispose(GObject webView->priv->view->close(); #endif + WebCore::setScreenDPIObserverHandler(nullptr, webView); + G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); } @@ -3600,7 +3614,7 @@ void webkit_web_view_set_zoom_level(WebK auto& page = getPage(webView); page.scalePage(1.0, IntPoint()); // Reset page scale when zoom level is changed if (webkit_settings_get_zoom_text_only(webView->priv->settings.get())) - page.setTextZoomFactor(zoomLevel); + page.setTextZoomFactor(zoomLevel * webView->priv->textScaleFactor); else page.setPageZoomFactor(zoomLevel); g_object_notify(G_OBJECT(webView), "zoom-level"); @@ -3621,7 +3635,7 @@ gdouble webkit_web_view_get_zoom_level(W auto& page = getPage(webView); gboolean zoomTextOnly = webkit_settings_get_zoom_text_only(webView->priv->settings.get()); - return zoomTextOnly ? page.textZoomFactor() : page.pageZoomFactor(); + return zoomTextOnly ? page.textZoomFactor() / webView->priv->textScaleFactor : page.pageZoomFactor(); } /**
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor