<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[280077] trunk/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/280077">280077</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-07-20 04:08:00 -0700 (Tue, 20 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Propagate GtkSettings to web process
https://bugs.webkit.org/show_bug.cgi?id=227854

Patch by Alexander Mikhaylenko <alexm@gnome.org> on 2021-07-20
Reviewed by Carlos Garcia Campos.

There's a number of properties in GtkSettings that web process uses:

- gtk-cursor-blink
- gtk-cursor-blink-time
- gtk-font-name
- gtk-primary-button-warps-slider
- gtk-theme-name
- gtk-xft-antialias
- gtk-xft-dpi
- gtk-xft-hinting
- gtk-xft-hintstyle
- gtk-xft-rgba

While we do propagate gtk-theme-name, we don't do it for any of the other settings.
This means that they can only be fetched from XSettings/GSettings/settings portal
by GTK itself, but if the app changes them or if they are changed from inspector,
web processes won't see that.

Introduce GtkSettingsManager as a specific place that listens to preferences
changes and notifies the web process, where GtkSettingsManagerProxy updates
GtkSettings on that side. Keep the dark mode preference separate since there's
existing cross-platform infrastructure for it.

Apply settings after reinitializing as well, it was only done after initialization
so failed with PSON.

* PlatformGTK.cmake:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/gtk/GtkSettingsState.cpp: Added.
(WebKit::GtkSettingsState::encode const):
(WebKit::GtkSettingsState::decode):
* Shared/gtk/GtkSettingsState.h: Added.
* Shared/gtk/NativeWebTouchEventGtk.cpp:
* SourcesGTK.txt:
* UIProcess/API/gtk/PageClientImpl.cpp:
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSetToplevelOnScreenWindow):
(webkitWebViewBaseRoot):
(webkitWebViewBaseUnroot):
(webkitWebViewBaseConstructed):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/gtk/GtkSettingsManager.cpp: Added.
(WebKit::GtkSettingsManager::singleton):
(WebKit::GtkSettingsManager::themeName const):
(WebKit::GtkSettingsManager::fontName const):
(WebKit::GtkSettingsManager::xftAntialias const):
(WebKit::GtkSettingsManager::xftHinting const):
(WebKit::GtkSettingsManager::xftHintStyle const):
(WebKit::GtkSettingsManager::xftRGBA const):
(WebKit::GtkSettingsManager::xftDPI const):
(WebKit::GtkSettingsManager::cursorBlink const):
(WebKit::GtkSettingsManager::cursorBlinkTime const):
(WebKit::GtkSettingsManager::primaryButtonWarpsSlider const):
(WebKit::GtkSettingsManager::settingsDidChange):
(WebKit::GtkSettingsManager::GtkSettingsManager):
* UIProcess/gtk/GtkSettingsManager.h: Added.
(WebKit::GtkSettingsManager::settingsState const):
* UIProcess/gtk/WebPageProxyGtk.cpp:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
(WebKit::WebPage::reinitializeWebPage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
* WebProcess/gtk/GtkSettingsManagerProxy.cpp: Added.
(WebKit::GtkSettingsManagerProxy::singleton):
(WebKit::GtkSettingsManagerProxy::GtkSettingsManagerProxy):
(WebKit::GtkSettingsManagerProxy::settingsDidChange):
(WebKit::GtkSettingsManagerProxy::applySettings):
* WebProcess/gtk/GtkSettingsManagerProxy.h: Added.
* WebProcess/gtk/GtkSettingsManagerProxy.messages.in: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitPlatformGTKcmake">trunk/Source/WebKit/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKitSharedWebPageCreationParameterscpp">trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebPageCreationParametersh">trunk/Source/WebKit/Shared/WebPageCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKitSharedgtkNativeWebTouchEventGtkcpp">trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp</a></li>
<li><a href="#trunkSourceWebKitSourcesGTKtxt">trunk/Source/WebKit/SourcesGTK.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkPageClientImplcpp">trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkPageClientImplh">trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessPageClienth">trunk/Source/WebKit/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxyh">trunk/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessgtkWebPageProxyGtkcpp">trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagecpp">trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPageh">trunk/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagemessagesin">trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPagegtkWebPageGtkcpp">trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitSharedgtkGtkSettingsStatecpp">trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedgtkGtkSettingsStateh">trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessgtkGtkSettingsManagercpp">trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessgtkGtkSettingsManagerh">trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessgtkGtkSettingsManagerProxycpp">trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessgtkGtkSettingsManagerProxyh">trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessgtkGtkSettingsManagerProxymessagesin">trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/ChangeLog       2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2021-07-20  Alexander Mikhaylenko  <alexm@gnome.org>
+
+        [GTK] Propagate GtkSettings to web process
+        https://bugs.webkit.org/show_bug.cgi?id=227854
+
+        Reviewed by Carlos Garcia Campos.
+
+        There's a number of properties in GtkSettings that web process uses:
+
+        - gtk-cursor-blink
+        - gtk-cursor-blink-time
+        - gtk-font-name
+        - gtk-primary-button-warps-slider
+        - gtk-theme-name
+        - gtk-xft-antialias
+        - gtk-xft-dpi
+        - gtk-xft-hinting
+        - gtk-xft-hintstyle
+        - gtk-xft-rgba
+
+        While we do propagate gtk-theme-name, we don't do it for any of the other settings.
+        This means that they can only be fetched from XSettings/GSettings/settings portal
+        by GTK itself, but if the app changes them or if they are changed from inspector,
+        web processes won't see that.
+
+        Introduce GtkSettingsManager as a specific place that listens to preferences
+        changes and notifies the web process, where GtkSettingsManagerProxy updates
+        GtkSettings on that side. Keep the dark mode preference separate since there's
+        existing cross-platform infrastructure for it.
+
+        Apply settings after reinitializing as well, it was only done after initialization
+        so failed with PSON.
+
+        * PlatformGTK.cmake:
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * Shared/gtk/GtkSettingsState.cpp: Added.
+        (WebKit::GtkSettingsState::encode const):
+        (WebKit::GtkSettingsState::decode):
+        * Shared/gtk/GtkSettingsState.h: Added.
+        * Shared/gtk/NativeWebTouchEventGtk.cpp:
+        * SourcesGTK.txt:
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        * UIProcess/API/gtk/PageClientImpl.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseSetToplevelOnScreenWindow):
+        (webkitWebViewBaseRoot):
+        (webkitWebViewBaseUnroot):
+        (webkitWebViewBaseConstructed):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/gtk/GtkSettingsManager.cpp: Added.
+        (WebKit::GtkSettingsManager::singleton):
+        (WebKit::GtkSettingsManager::themeName const):
+        (WebKit::GtkSettingsManager::fontName const):
+        (WebKit::GtkSettingsManager::xftAntialias const):
+        (WebKit::GtkSettingsManager::xftHinting const):
+        (WebKit::GtkSettingsManager::xftHintStyle const):
+        (WebKit::GtkSettingsManager::xftRGBA const):
+        (WebKit::GtkSettingsManager::xftDPI const):
+        (WebKit::GtkSettingsManager::cursorBlink const):
+        (WebKit::GtkSettingsManager::cursorBlinkTime const):
+        (WebKit::GtkSettingsManager::primaryButtonWarpsSlider const):
+        (WebKit::GtkSettingsManager::settingsDidChange):
+        (WebKit::GtkSettingsManager::GtkSettingsManager):
+        * UIProcess/gtk/GtkSettingsManager.h: Added.
+        (WebKit::GtkSettingsManager::settingsState const):
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_appHighlightsVisible):
+        (WebKit::WebPage::reinitializeWebPage):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+        * WebProcess/gtk/GtkSettingsManagerProxy.cpp: Added.
+        (WebKit::GtkSettingsManagerProxy::singleton):
+        (WebKit::GtkSettingsManagerProxy::GtkSettingsManagerProxy):
+        (WebKit::GtkSettingsManagerProxy::settingsDidChange):
+        (WebKit::GtkSettingsManagerProxy::applySettings):
+        * WebProcess/gtk/GtkSettingsManagerProxy.h: Added.
+        * WebProcess/gtk/GtkSettingsManagerProxy.messages.in: Added.
+
</ins><span class="cx"> 2021-07-20  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GTK][WPE] Fix compilation when ATK is not used
</span></span></pre></div>
<a id="trunkSourceWebKitPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/PlatformGTK.cmake (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/PlatformGTK.cmake    2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/PlatformGTK.cmake       2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> list(APPEND WebKit_MESSAGES_IN_FILES
</span><span class="cx">     UIProcess/ViewGestureController
</span><span class="cx"> 
</span><ins>+    WebProcess/gtk/GtkSettingsManagerProxy
</ins><span class="cx">     WebProcess/WebPage/ViewGestureGeometryCollector
</span><span class="cx"> )
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPageCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp    2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx">     encoder << canUseCredentialStorage;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    encoder << themeName;
</del><ins>+    encoder << gtkSettings;
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx">     encoder << httpsUpgradeEnabled;
</span><span class="lines">@@ -591,7 +591,7 @@
</span><span class="cx">         return std::nullopt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    if (!decoder.decode(parameters.themeName))
</del><ins>+    if (!decoder.decode(parameters.gtkSettings))
</ins><span class="cx">         return std::nullopt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPageCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h   2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h      2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -55,6 +55,10 @@
</span><span class="cx"> #include <WebCore/ApplicationManifest.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(GTK)
+#include "GtkSettingsState.h"
+#endif
+
</ins><span class="cx"> namespace IPC {
</span><span class="cx"> class Decoder;
</span><span class="cx"> class Encoder;
</span><span class="lines">@@ -248,7 +252,7 @@
</span><span class="cx">     WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    String themeName;
</del><ins>+    GtkSettingsState gtkSettings;
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx">     bool httpsUpgradeEnabled { true };
</span></span></pre></div>
<a id="trunkSourceWebKitSharedgtkGtkSettingsStatecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp                              (rev 0)
+++ trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp 2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GtkSettingsState.h"
+
+#include "ArgumentCoders.h"
+
+namespace WebKit {
+
+void GtkSettingsState::encode(IPC::Encoder& encoder) const
+{
+    encoder << themeName;
+    encoder << fontName;
+    encoder << xftAntialias;
+    encoder << xftHinting;
+    encoder << xftHintStyle;
+    encoder << xftRGBA;
+    encoder << xftDPI;
+    encoder << cursorBlink;
+    encoder << cursorBlinkTime;
+    encoder << primaryButtonWarpsSlider;
+}
+
+std::optional<GtkSettingsState> GtkSettingsState::decode(IPC::Decoder& decoder)
+{
+    GtkSettingsState state;
+
+    if (!decoder.decode(state.themeName))
+        return std::nullopt;
+
+    if (!decoder.decode(state.fontName))
+        return std::nullopt;
+
+    if (!decoder.decode(state.xftAntialias))
+        return std::nullopt;
+
+    if (!decoder.decode(state.xftHinting))
+        return std::nullopt;
+
+    if (!decoder.decode(state.xftHintStyle))
+        return std::nullopt;
+
+    if (!decoder.decode(state.xftRGBA))
+        return std::nullopt;
+
+    if (!decoder.decode(state.xftDPI))
+        return std::nullopt;
+
+    if (!decoder.decode(state.cursorBlink))
+        return std::nullopt;
+
+    if (!decoder.decode(state.cursorBlinkTime))
+        return std::nullopt;
+
+    if (!decoder.decode(state.primaryButtonWarpsSlider))
+        return std::nullopt;
+
+    return state;
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKitSharedgtkGtkSettingsStateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h                                (rev 0)
+++ trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h   2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebKit {
+
+struct GtkSettingsState {
+    GtkSettingsState() = default;
+
+    void encode(IPC::Encoder&) const;
+    static std::optional<GtkSettingsState> decode(IPC::Decoder&);
+
+    std::optional<String> themeName;
+    std::optional<String> fontName;
+    std::optional<int> xftAntialias;
+    std::optional<int> xftHinting;
+    std::optional<String> xftHintStyle;
+    std::optional<String> xftRGBA;
+    std::optional<int> xftDPI;
+    std::optional<bool> cursorBlink;
+    std::optional<int> cursorBlinkTime;
+    std::optional<bool> primaryButtonWarpsSlider;
+};
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKitSharedgtkNativeWebTouchEventGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp        2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp   2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="cx"> 
</span><ins>+#include <WebCore/GtkVersioning.h>
</ins><span class="cx"> #include "WebEventFactory.h"
</span><span class="cx"> #include <gdk/gdk.h>
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSourcesGTKtxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesGTK.txt (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesGTK.txt       2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/SourcesGTK.txt  2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> Shared/glib/WebContextMenuItemGlib.cpp
</span><span class="cx"> 
</span><span class="cx"> Shared/gtk/ArgumentCodersGtk.cpp
</span><ins>+Shared/gtk/GtkSettingsState.cpp
</ins><span class="cx"> Shared/gtk/NativeWebKeyboardEventGtk.cpp
</span><span class="cx"> Shared/gtk/NativeWebMouseEventGtk.cpp
</span><span class="cx"> Shared/gtk/NativeWebTouchEventGtk.cpp
</span><span class="lines">@@ -253,6 +254,7 @@
</span><span class="cx"> UIProcess/gtk/ClipboardGtk3.cpp @no-unify
</span><span class="cx"> UIProcess/gtk/ClipboardGtk4.cpp @no-unify
</span><span class="cx"> UIProcess/gtk/WebDateTimePickerGtk.cpp
</span><ins>+UIProcess/gtk/GtkSettingsManager.cpp
</ins><span class="cx"> UIProcess/gtk/HardwareAccelerationManager.cpp
</span><span class="cx"> UIProcess/gtk/KeyBindingTranslator.cpp
</span><span class="cx"> UIProcess/gtk/PointerLockManager.cpp @no-unify
</span><span class="lines">@@ -439,5 +441,6 @@
</span><span class="cx"> 
</span><span class="cx"> WebProcess/glib/WebProcessGLib.cpp
</span><span class="cx"> 
</span><ins>+WebProcess/gtk/GtkSettingsManagerProxy.cpp
</ins><span class="cx"> WebProcess/gtk/WaylandCompositorDisplay.cpp
</span><span class="cx"> WebProcess/gtk/WebProcessMainGtk.cpp
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkPageClientImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp    2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -594,23 +594,6 @@
</span><span class="cx">         webkitWebViewDidChangePageID(WEBKIT_WEB_VIEW(m_viewWidget));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String PageClientImpl::themeName() const
-{
-    if (auto* themeNameEnv = g_getenv("GTK_THEME")) {
-        String name = String::fromUTF8(themeNameEnv);
-        if (name.endsWith("-dark") || name.endsWith("-Dark") || name.endsWith(":dark"))
-            return name.substring(0, name.length() - 5);
-        return name;
-    }
-
-    GUniqueOutPtr<char> themeNameSetting;
-    g_object_get(gtk_widget_get_settings(m_viewWidget), "gtk-theme-name", &themeNameSetting.outPtr(), nullptr);
-    String name = String::fromUTF8(themeNameSetting.get());
-    if (name.endsWith("-dark") || name.endsWith("-Dark"))
-        return name.substring(0, name.length() - 5);
-    return name;
-}
-
</del><span class="cx"> void PageClientImpl::makeViewBlank(bool makeBlank)
</span><span class="cx"> {
</span><span class="cx">     webkitWebViewBaseMakeBlank(WEBKIT_WEB_VIEW_BASE(m_viewWidget), makeBlank);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h   2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h      2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -176,8 +176,6 @@
</span><span class="cx"> 
</span><span class="cx">     void didChangeWebPageID() const override;
</span><span class="cx"> 
</span><del>-    String themeName() const override;
-
</del><span class="cx">     void makeViewBlank(bool) override;
</span><span class="cx"> 
</span><span class="cx">     // Members of PageClientImpl class
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp      2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -298,8 +298,6 @@
</span><span class="cx">     unsigned long toplevelWindowStateEventID { 0 };
</span><span class="cx"> #endif
</span><span class="cx">     unsigned long toplevelWindowRealizedID { 0 };
</span><del>-    unsigned long themeChangedID { 0 };
-    unsigned long applicationPreferDarkThemeID { 0 };
</del><span class="cx"> 
</span><span class="cx">     // View State.
</span><span class="cx">     OptionSet<ActivityState::Flag> activityState;
</span><span class="lines">@@ -401,16 +399,6 @@
</span><span class="cx">     return FALSE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void themeChanged(WebKitWebViewBase* webViewBase)
-{
-    webViewBase->priv->pageProxy->themeDidChange();
-}
-
-static void applicationPreferDarkThemeChanged(WebKitWebViewBase* webViewBase)
-{
-    webViewBase->priv->pageProxy->effectiveAppearanceDidChange();
-}
-
</del><span class="cx"> static void toplevelWindowRealized(WebKitWebViewBase* webViewBase)
</span><span class="cx"> {
</span><span class="cx">     gtk_widget_realize(GTK_WIDGET(webViewBase));
</span><span class="lines">@@ -444,17 +432,6 @@
</span><span class="cx">         g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelWindowRealizedID);
</span><span class="cx">         priv->toplevelWindowRealizedID = 0;
</span><span class="cx">     }
</span><del>-    if (priv->themeChangedID || priv->applicationPreferDarkThemeID) {
-        auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
-        if (priv->themeChangedID) {
-            g_signal_handler_disconnect(settings, priv->themeChangedID);
-            priv->themeChangedID = 0;
-        }
-        if (priv->applicationPreferDarkThemeID) {
-            g_signal_handler_disconnect(settings, priv->applicationPreferDarkThemeID);
-            priv->applicationPreferDarkThemeID = 0;
-        }
-    }
</del><span class="cx"> 
</span><span class="cx">     priv->toplevelOnScreenWindow = window;
</span><span class="cx"> 
</span><span class="lines">@@ -483,12 +460,6 @@
</span><span class="cx">     priv->toplevelWindowStateEventID =
</span><span class="cx">         g_signal_connect(priv->toplevelOnScreenWindow, "window-state-event", G_CALLBACK(toplevelWindowStateEvent), webViewBase);
</span><span class="cx"> 
</span><del>-    auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
-    priv->themeChangedID =
-        g_signal_connect_swapped(settings, "notify::gtk-theme-name", G_CALLBACK(themeChanged), webViewBase);
-    priv->applicationPreferDarkThemeID =
-        g_signal_connect_swapped(settings, "notify::gtk-application-prefer-dark-theme", G_CALLBACK(applicationPreferDarkThemeChanged), webViewBase);
-
</del><span class="cx">     if (gtk_widget_get_realized(GTK_WIDGET(window)))
</span><span class="cx">         gtk_widget_realize(GTK_WIDGET(webViewBase));
</span><span class="cx">     else
</span><span class="lines">@@ -1782,16 +1753,6 @@
</span><span class="cx">     }
</span><span class="cx">     priv->toplevelWindowUnrealizedID =
</span><span class="cx">         g_signal_connect_swapped(priv->toplevelOnScreenWindow, "unrealize", G_CALLBACK(toplevelWindowUnrealized), widget);
</span><del>-
-    auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
-    priv->themeChangedID =
-        g_signal_connect_swapped(settings, "notify::gtk-theme-name", G_CALLBACK(+[](WebKitWebViewBase* webViewBase) {
-            webViewBase->priv->pageProxy->themeDidChange();
-        }), widget);
-    priv->applicationPreferDarkThemeID =
-        g_signal_connect_swapped(settings, "notify::gtk-application-prefer-dark-theme", G_CALLBACK(+[](WebKitWebViewBase* webViewBase) {
-            webViewBase->priv->pageProxy->effectiveAppearanceDidChange();
-        }), widget);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewBaseUnroot(GtkWidget* widget)
</span><span class="lines">@@ -1805,9 +1766,6 @@
</span><span class="cx">     g_clear_signal_handler(&priv->toplevelWindowUnrealizedID, priv->toplevelOnScreenWindow);
</span><span class="cx">     if (gtk_widget_get_realized(GTK_WIDGET(priv->toplevelOnScreenWindow)))
</span><span class="cx">         g_clear_signal_handler(&priv->toplevelWindowStateChangedID, gtk_native_get_surface(GTK_NATIVE(priv->toplevelOnScreenWindow)));
</span><del>-    auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
-    g_clear_signal_handler(&priv->themeChangedID, settings);
-    g_clear_signal_handler(&priv->applicationPreferDarkThemeID, settings);
</del><span class="cx">     priv->toplevelOnScreenWindow = nullptr;
</span><span class="cx"> 
</span><span class="cx">     OptionSet<ActivityState::Flag> flagsToUpdate;
</span><span class="lines">@@ -2155,6 +2113,13 @@
</span><span class="cx">     gtk_gesture_group(gesture, priv->touchGestureGroup);
</span><span class="cx">     gtk_gesture_single_set_touch_only(GTK_GESTURE_SINGLE(gesture), TRUE);
</span><span class="cx">     g_signal_connect_object(gesture, "swipe", G_CALLBACK(webkitWebViewBaseTouchSwipe), viewWidget, G_CONNECT_SWAPPED);
</span><ins>+
+    auto* settings = gtk_settings_get_default();
+    auto callback = +[](WebKitWebViewBase* webViewBase) {
+        webViewBase->priv->pageProxy->effectiveAppearanceDidChange();
+    };
+    g_signal_connect_object(settings, "notify::gtk-theme-name", G_CALLBACK(callback), viewWidget, G_CONNECT_SWAPPED);
+    g_signal_connect_object(settings, "notify::gtk-application-prefer-dark-theme", G_CALLBACK(callback), viewWidget, G_CONNECT_SWAPPED);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/PageClient.h (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/PageClient.h       2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/PageClient.h  2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -625,10 +625,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void didChangeWebPageID() const { }
</span><span class="cx"> 
</span><del>-#if PLATFORM(GTK)
-    virtual String themeName() const = 0;
-#endif
-
</del><span class="cx"> #if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
</span><span class="cx">     virtual bool canHandleContextMenuTranslation() const = 0;
</span><span class="cx">     virtual void handleContextMenuTranslation(const WebCore::TranslationContextMenuInfo&) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -244,6 +244,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><ins>+#include "GtkSettingsManager.h"
</ins><span class="cx"> #include <WebCore/SelectionData.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -8232,7 +8233,7 @@
</span><span class="cx">     parameters.canUseCredentialStorage = m_canUseCredentialStorage;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    parameters.themeName = pageClient().themeName();
</del><ins>+    parameters.gtkSettings = GtkSettingsManager::singleton().settingsState();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.h     2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h        2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -965,7 +965,6 @@
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     PlatformViewWidget viewWidget();
</span><span class="cx">     bool makeGLContextCurrent();
</span><del>-    void themeDidChange();
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     const std::optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessgtkGtkSettingsManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp                         (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp    2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,199 @@
</span><ins>+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GtkSettingsManager.h"
+
+#include "GtkSettingsManagerProxyMessages.h"
+#include "WebProcessPool.h"
+
+namespace WebKit {
+using namespace WebCore;
+
+GtkSettingsManager& GtkSettingsManager::singleton()
+{
+    static NeverDestroyed<GtkSettingsManager> manager;
+    return manager;
+}
+
+String GtkSettingsManager::themeName() const
+{
+    if (auto* themeNameEnv = g_getenv("GTK_THEME")) {
+        String name = String::fromUTF8(themeNameEnv);
+        if (name.endsWith("-dark") || name.endsWith("-Dark") || name.endsWith(":dark"))
+            return name.substring(0, name.length() - 5);
+        return name;
+    }
+
+    GUniqueOutPtr<char> themeNameSetting;
+    g_object_get(m_settings, "gtk-theme-name", &themeNameSetting.outPtr(), nullptr);
+    String name = String::fromUTF8(themeNameSetting.get());
+    if (name.endsWith("-dark") || name.endsWith("-Dark"))
+        return name.substring(0, name.length() - 5);
+    return name;
+}
+
+String GtkSettingsManager::fontName() const
+{
+    GUniqueOutPtr<char> fontNameSetting;
+    g_object_get(m_settings, "gtk-font-name", &fontNameSetting.outPtr(), nullptr);
+    return String::fromUTF8(fontNameSetting.get());
+}
+
+int GtkSettingsManager::xftAntialias() const
+{
+    int antialiasSetting;
+    g_object_get(m_settings, "gtk-xft-antialias", &antialiasSetting, nullptr);
+    return antialiasSetting;
+}
+
+int GtkSettingsManager::xftHinting() const
+{
+    int hintingSetting;
+    g_object_get(m_settings, "gtk-xft-hinting", &hintingSetting, nullptr);
+    return hintingSetting;
+}
+
+String GtkSettingsManager::xftHintStyle() const
+{
+    GUniqueOutPtr<char> hintStyleSetting;
+    g_object_get(m_settings, "gtk-xft-hintstyle", &hintStyleSetting.outPtr(), nullptr);
+    return String::fromUTF8(hintStyleSetting.get());
+}
+
+String GtkSettingsManager::xftRGBA() const
+{
+    GUniqueOutPtr<char> rgbaSetting;
+    g_object_get(m_settings, "gtk-xft-rgba", &rgbaSetting.outPtr(), nullptr);
+    return String::fromUTF8(rgbaSetting.get());
+}
+
+int GtkSettingsManager::xftDPI() const
+{
+    int dpiSetting;
+    g_object_get(m_settings, "gtk-xft-dpi", &dpiSetting, nullptr);
+    return dpiSetting;
+}
+
+bool GtkSettingsManager::cursorBlink() const
+{
+    gboolean cursorBlinkSetting;
+    g_object_get(m_settings, "gtk-cursor-blink", &cursorBlinkSetting, nullptr);
+    return cursorBlinkSetting ? true : false;
+}
+
+int GtkSettingsManager::cursorBlinkTime() const
+{
+    int cursorBlinkTimeSetting;
+    g_object_get(m_settings, "gtk-cursor-blink-time", &cursorBlinkTimeSetting, nullptr);
+    return cursorBlinkTimeSetting;
+}
+
+bool GtkSettingsManager::primaryButtonWarpsSlider() const
+{
+    gboolean buttonSetting;
+    g_object_get(m_settings, "gtk-primary-button-warps-slider", &buttonSetting, nullptr);
+    return buttonSetting ? true : false;
+}
+
+void GtkSettingsManager::settingsDidChange()
+{
+    GtkSettingsState state;
+
+    auto themeName = this->themeName();
+    if (m_settingsState.themeName != themeName)
+        m_settingsState.themeName = state.themeName = themeName;
+
+    auto fontName = this->fontName();
+    if (m_settingsState.fontName != fontName)
+        m_settingsState.fontName = state.fontName = fontName;
+
+    auto xftAntialias = this->xftAntialias();
+    if (m_settingsState.xftAntialias != xftAntialias)
+        m_settingsState.xftAntialias = state.xftAntialias = xftAntialias;
+
+    auto xftHinting = this->xftHinting();
+    if (m_settingsState.xftHinting != xftHinting)
+        m_settingsState.xftHinting = state.xftHinting = xftHinting;
+
+    auto xftHintStyle = this->xftHintStyle();
+    if (m_settingsState.xftHintStyle != xftHintStyle)
+        m_settingsState.xftHintStyle = state.xftHintStyle = xftHintStyle;
+
+    auto xftRGBA = this->xftRGBA();
+    if (m_settingsState.xftRGBA != xftRGBA)
+        m_settingsState.xftRGBA = state.xftRGBA = xftRGBA;
+
+    auto xftDPI = this->xftDPI();
+    if (m_settingsState.xftDPI != xftDPI)
+        m_settingsState.xftDPI = state.xftDPI = xftDPI;
+
+    auto cursorBlink = this->cursorBlink();
+    if (m_settingsState.cursorBlink != cursorBlink)
+        m_settingsState.cursorBlink = state.cursorBlink = cursorBlink;
+
+    auto cursorBlinkTime = this->cursorBlinkTime();
+    if (m_settingsState.cursorBlinkTime != cursorBlinkTime)
+        m_settingsState.cursorBlinkTime = state.cursorBlinkTime = cursorBlinkTime;
+
+    auto primaryButtonWarpsSlider = this->primaryButtonWarpsSlider();
+    if (m_settingsState.primaryButtonWarpsSlider != primaryButtonWarpsSlider)
+        m_settingsState.primaryButtonWarpsSlider = state.primaryButtonWarpsSlider = primaryButtonWarpsSlider;
+
+    for (auto& processPool : WebProcessPool::allProcessPools())
+        processPool->sendToAllProcesses(Messages::GtkSettingsManagerProxy::SettingsDidChange(state));
+}
+
+GtkSettingsManager::GtkSettingsManager()
+    : m_settings(gtk_settings_get_default())
+{
+    auto settingsChangedCallback = +[](GtkSettingsManager* settingsManager) {
+        settingsManager->settingsDidChange();
+    };
+
+    m_settingsState.themeName = themeName();
+    m_settingsState.fontName = fontName();
+    m_settingsState.xftAntialias = xftAntialias();
+    m_settingsState.xftHinting = xftHinting();
+    m_settingsState.xftHintStyle = xftHintStyle();
+    m_settingsState.xftRGBA = xftRGBA();
+    m_settingsState.xftDPI = xftDPI();
+    m_settingsState.cursorBlink = cursorBlink();
+    m_settingsState.cursorBlinkTime = cursorBlinkTime();
+    m_settingsState.primaryButtonWarpsSlider = primaryButtonWarpsSlider();
+
+    g_signal_connect_swapped(m_settings, "notify::gtk-theme-name", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-font-name", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-xft-antialias", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-xft-dpi", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-xft-hinting", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-xft-hintstyle", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-xft-rgba", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-cursor-blink", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-cursor-blink-time", G_CALLBACK(settingsChangedCallback), this);
+    g_signal_connect_swapped(m_settings, "notify::gtk-primary-button-warps-slider", G_CALLBACK(settingsChangedCallback), this);
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessgtkGtkSettingsManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h                           (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h      2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GtkSettingsState.h"
+#include <gtk/gtk.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+class GtkSettingsManager {
+    WTF_MAKE_NONCOPYABLE(GtkSettingsManager);
+    friend NeverDestroyed<GtkSettingsManager>;
+public:
+    static GtkSettingsManager& singleton();
+
+    const GtkSettingsState& settingsState() const { return m_settingsState; }
+private:
+    GtkSettingsManager();
+
+    void settingsDidChange();
+
+    String themeName() const;
+    String fontName() const;
+    int xftAntialias() const;
+    int xftHinting() const;
+    String xftHintStyle() const;
+    String xftRGBA() const;
+    int xftDPI() const;
+    bool cursorBlink() const;
+    int cursorBlinkTime() const;
+    bool primaryButtonWarpsSlider() const;
+
+    GtkSettings* m_settings;
+    GtkSettingsState m_settingsState;
+};
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessgtkWebPageProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp    2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp       2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -97,13 +97,4 @@
</span><span class="cx">     sendMessageToWebViewWithReply(WTFMove(message), [](UserMessage&&) { });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::themeDidChange()
-{
-    if (!hasRunningProcess())
-        return;
-
-    send(Messages::WebPage::ThemeDidChange(pageClient().themeName()));
-    effectiveAppearanceDidChange();
-}
-
</del><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp       2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp  2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -310,6 +310,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><ins>+#include "GtkSettingsManagerProxy.h"
</ins><span class="cx"> #include "WebPrintOperationGtk.h"
</span><span class="cx"> #include <WebCore/SelectionData.h>
</span><span class="cx"> #include <gtk/gtk.h>
</span><span class="lines">@@ -734,7 +735,7 @@
</span><span class="cx">     setPaginationLineGridEnabled(parameters.paginationLineGridEnabled);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    themeDidChange(WTFMove(parameters.themeName));
</del><ins>+    GtkSettingsManagerProxy::singleton().applySettings(WTFMove(parameters.gtkSettings));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     effectiveAppearanceDidChange(parameters.useDarkAppearance, parameters.useElevatedUserInterfaceLevel);
</span><span class="lines">@@ -969,6 +970,10 @@
</span><span class="cx">     if (m_layerHostingMode != parameters.layerHostingMode)
</span><span class="cx">         setLayerHostingMode(parameters.layerHostingMode);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(GTK)
+    GtkSettingsManagerProxy::singleton().applySettings(WTFMove(parameters.gtkSettings));
+#endif
+
</ins><span class="cx">     platformReinitialize();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h    2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -896,8 +896,6 @@
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     void collapseSelectionInFrame(WebCore::FrameIdentifier);
</span><span class="cx">     void showEmojiPicker(WebCore::Frame&);
</span><del>-
-    void themeDidChange(String&&);
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void didApplyStyle();
</span><span class="lines">@@ -2340,10 +2338,6 @@
</span><span class="cx">     String m_processDisplayName;
</span><span class="cx">     WebCore::AllowsContentJavaScript m_allowsContentJavaScriptFromMostRecentNavigation { WebCore::AllowsContentJavaScript::Yes };
</span><span class="cx"> 
</span><del>-#if PLATFORM(GTK)
-    String m_themeName;
-#endif
-    
</del><span class="cx"> #if ENABLE(APP_BOUND_DOMAINS)
</span><span class="cx">     bool m_limitsNavigationsToAppBoundDomains { false };
</span><span class="cx">     bool m_navigationHasOccured { false };
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in       2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in  2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -515,10 +515,6 @@
</span><span class="cx"> 
</span><span class="cx">     EffectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
</span><span class="cx"> 
</span><del>-#if PLATFORM(GTK)
-    ThemeDidChange(String themeName)
-#endif
-
</del><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     RequestActiveNowPlayingSessionInfo() -> (bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier) Async
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPagegtkWebPageGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (280076 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp        2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp   2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -45,7 +45,6 @@
</span><span class="cx"> #include <WebCore/PlatformKeyboardEvent.h>
</span><span class="cx"> #include <WebCore/PlatformScreen.h>
</span><span class="cx"> #include <WebCore/PointerCharacteristics.h>
</span><del>-#include <WebCore/RenderTheme.h>
</del><span class="cx"> #include <WebCore/Settings.h>
</span><span class="cx"> #include <WebCore/SharedBuffer.h>
</span><span class="cx"> #include <WebCore/WindowsKeyboardCodes.h>
</span><span class="lines">@@ -178,15 +177,4 @@
</span><span class="cx">     sendWithAsyncReply(Messages::WebPageProxy::ShowEmojiPicker(frame.view()->contentsToRootView(frame.selection().absoluteCaretBounds())), WTFMove(completionHandler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::themeDidChange(String&& themeName)
-{
-    if (m_themeName == themeName)
-        return;
-
-    m_themeName = WTFMove(themeName);
-    g_object_set(gtk_settings_get_default(), "gtk-theme-name", m_themeName.utf8().data(), nullptr);
-    RenderTheme::singleton().platformColorsDidChange();
-    Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
-}
-
</del><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessgtkGtkSettingsManagerProxycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp                           (rev 0)
+++ trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp      2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GtkSettingsManagerProxy.h"
+
+#include "GtkSettingsManagerProxyMessages.h"
+#include <WebCore/Page.h>
+#include <WebCore/RenderTheme.h>
+
+namespace WebKit {
+using namespace WebCore;
+
+GtkSettingsManagerProxy& GtkSettingsManagerProxy::singleton()
+{
+    static NeverDestroyed<GtkSettingsManagerProxy> manager;
+    return manager;
+}
+
+GtkSettingsManagerProxy::GtkSettingsManagerProxy()
+    : m_settings(gtk_settings_get_default())
+{
+    WebProcess::singleton().addMessageReceiver(Messages::GtkSettingsManagerProxy::messageReceiverName(), *this);
+}
+
+void GtkSettingsManagerProxy::settingsDidChange(GtkSettingsState&& state)
+{
+    applySettings(WTFMove(state));
+}
+
+void GtkSettingsManagerProxy::applySettings(GtkSettingsState&& state)
+{
+    if (state.themeName) {
+        g_object_set(m_settings, "gtk-theme-name", state.fontName->utf8().data(), nullptr);
+        RenderTheme::singleton().platformColorsDidChange();
+        Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
+    }
+
+    if (state.fontName)
+        g_object_set(m_settings, "gtk-font-name", state.fontName->utf8().data(), nullptr);
+
+    if (state.xftAntialias)
+        g_object_set(m_settings, "gtk-xft-antialias", *state.xftAntialias, nullptr);
+
+    if (state.xftHinting)
+        g_object_set(m_settings, "gtk-xft-hinting", *state.xftHinting, nullptr);
+
+    if (state.xftHintStyle)
+        g_object_set(m_settings, "gtk-xft-hintstyle", state.xftHintStyle->utf8().data(), nullptr);
+
+    if (state.xftRGBA)
+        g_object_set(m_settings, "gtk-xft-rgba", state.xftRGBA->utf8().data(), nullptr);
+
+    if (state.xftDPI)
+        g_object_set(m_settings, "gtk-xft-dpi", *state.xftDPI, nullptr);
+
+    if (state.cursorBlink)
+        g_object_set(m_settings, "gtk-cursor-blink", *state.cursorBlink, nullptr);
+
+    if (state.cursorBlinkTime)
+        g_object_set(m_settings, "gtk-cursor-blink-time", *state.cursorBlinkTime, nullptr);
+
+    if (state.primaryButtonWarpsSlider)
+        g_object_set(m_settings, "gtk-primary-button-warps-slider", *state.primaryButtonWarpsSlider, nullptr);
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKitWebProcessgtkGtkSettingsManagerProxyh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h                             (rev 0)
+++ trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h        2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GtkSettingsState.h"
+#include "MessageReceiver.h"
+#include <gtk/gtk.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+class GtkSettingsManagerProxy : private IPC::MessageReceiver {
+    WTF_MAKE_NONCOPYABLE(GtkSettingsManagerProxy);
+    friend NeverDestroyed<GtkSettingsManagerProxy>;
+public:
+    static GtkSettingsManagerProxy& singleton();
+
+    void applySettings(GtkSettingsState&&);
+private:
+    GtkSettingsManagerProxy();
+
+    // IPC::MessageReceiver.
+    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
+
+    void settingsDidChange(GtkSettingsState&&);
+
+    GtkSettings* m_settings;
+};
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKitWebProcessgtkGtkSettingsManagerProxymessagesin"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in (0 => 280077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in                           (rev 0)
+++ trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in      2021-07-20 11:08:00 UTC (rev 280077)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+# Copyright (C) 2021 Purism SPC
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> GtkSettingsManagerProxy NotRefCounted {
+    SettingsDidChange(struct WebKit::GtkSettingsState settingsState)
+}
</ins></span></pre>
</div>
</div>

</body>
</html>