Title: [277258] trunk/Source/WebKit
Revision
277258
Author
[email protected]
Date
2021-05-10 02:13:54 -0700 (Mon, 10 May 2021)

Log Message

[GTK] Use always async scrolling in accelerated compositing mode
https://bugs.webkit.org/show_bug.cgi?id=225512

Reviewed by Fujii Hironori.

We currently use async scrolling only when the hardware acceleration policy is set for always, but not when
entering accelerating compositing mode in ondemand policy. Since the GTK port still supports the non accelerated
compositing mode we need to add and remove the scrolling tree when entering and leaving the accelerated
compositing mode.

* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_set_hardware_acceleration_policy): Always enable async scrolling when accelerated compositing
is enabled.
* UIProcess/gtk/WebPreferencesGtk.cpp:
(WebKit::WebPreferences::platformInitializeStore): Ditto.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics): Remove the scrolling tree if the
drawing area is destroyed in accelerated compositing mode.
(WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Add the scrolling tree.
(WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode): Remove the scrolling tree.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage): Do not add the scrolling tree from here for the GTK port.
(WebKit::WebPage::close): Do not remove the scrolling tree from here for the GTK port.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (277257 => 277258)


--- trunk/Source/WebKit/ChangeLog	2021-05-10 07:16:13 UTC (rev 277257)
+++ trunk/Source/WebKit/ChangeLog	2021-05-10 09:13:54 UTC (rev 277258)
@@ -1,3 +1,29 @@
+2021-05-10  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Use always async scrolling in accelerated compositing mode
+        https://bugs.webkit.org/show_bug.cgi?id=225512
+
+        Reviewed by Fujii Hironori.
+
+        We currently use async scrolling only when the hardware acceleration policy is set for always, but not when
+        entering accelerating compositing mode in ondemand policy. Since the GTK port still supports the non accelerated
+        compositing mode we need to add and remove the scrolling tree when entering and leaving the accelerated
+        compositing mode.
+
+        * UIProcess/API/glib/WebKitSettings.cpp:
+        (webkit_settings_set_hardware_acceleration_policy): Always enable async scrolling when accelerated compositing
+        is enabled.
+        * UIProcess/gtk/WebPreferencesGtk.cpp:
+        (WebKit::WebPreferences::platformInitializeStore): Ditto.
+        * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
+        (WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics): Remove the scrolling tree if the
+        drawing area is destroyed in accelerated compositing mode.
+        (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Add the scrolling tree.
+        (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode): Remove the scrolling tree.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage): Do not add the scrolling tree from here for the GTK port.
+        (WebKit::WebPage::close): Do not remove the scrolling tree from here for the GTK port.
+
 2021-05-10  Youenn Fablet  <[email protected]>
 
         Use IPC::Semaphore instead of sending an IPC message for every captured audio sample

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp (277257 => 277258)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp	2021-05-10 07:16:13 UTC (rev 277257)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp	2021-05-10 09:13:54 UTC (rev 277258)
@@ -3617,11 +3617,11 @@
             return;
         if (!priv->preferences->acceleratedCompositingEnabled()) {
             priv->preferences->setAcceleratedCompositingEnabled(true);
+            priv->preferences->setThreadedScrollingEnabled(true);
             changed = true;
         }
         if (!priv->preferences->forceCompositingMode()) {
             priv->preferences->setForceCompositingMode(true);
-            priv->preferences->setThreadedScrollingEnabled(true);
             changed = true;
         }
         break;
@@ -3630,12 +3630,12 @@
             return;
         if (priv->preferences->acceleratedCompositingEnabled()) {
             priv->preferences->setAcceleratedCompositingEnabled(false);
+            priv->preferences->setThreadedScrollingEnabled(false);
             changed = true;
         }
 
         if (priv->preferences->forceCompositingMode()) {
             priv->preferences->setForceCompositingMode(false);
-            priv->preferences->setThreadedScrollingEnabled(false);
             changed = true;
         }
         break;
@@ -3642,12 +3642,12 @@
     case WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND:
         if (!priv->preferences->acceleratedCompositingEnabled() && HardwareAccelerationManager::singleton().canUseHardwareAcceleration()) {
             priv->preferences->setAcceleratedCompositingEnabled(true);
+            priv->preferences->setThreadedScrollingEnabled(true);
             changed = true;
         }
 
         if (priv->preferences->forceCompositingMode() && !HardwareAccelerationManager::singleton().forceHardwareAcceleration()) {
             priv->preferences->setForceCompositingMode(false);
-            priv->preferences->setThreadedScrollingEnabled(false);
             changed = true;
         }
         break;

Modified: trunk/Source/WebKit/UIProcess/gtk/WebPreferencesGtk.cpp (277257 => 277258)


--- trunk/Source/WebKit/UIProcess/gtk/WebPreferencesGtk.cpp	2021-05-10 07:16:13 UTC (rev 277257)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPreferencesGtk.cpp	2021-05-10 09:13:54 UTC (rev 277258)
@@ -46,7 +46,7 @@
 
     setAcceleratedCompositingEnabled(compositingState.acceleratedCompositingEnabled);
     setForceCompositingMode(compositingState.forceCompositingMode);
-    setThreadedScrollingEnabled(compositingState.forceCompositingMode);
+    setThreadedScrollingEnabled(compositingState.acceleratedCompositingEnabled);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (277257 => 277258)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp	2021-05-10 07:16:13 UTC (rev 277257)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp	2021-05-10 09:13:54 UTC (rev 277258)
@@ -29,6 +29,7 @@
 #include "DrawingAreaCoordinatedGraphics.h"
 
 #include "DrawingAreaProxyMessages.h"
+#include "EventDispatcher.h"
 #include "LayerTreeHost.h"
 #include "ShareableBitmap.h"
 #include "UpdateInfo.h"
@@ -80,7 +81,13 @@
 #endif
 }
 
-DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics() = default;
+DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics()
+{
+#if PLATFORM(GTK)
+    if (m_supportsAsyncScrolling && m_layerTreeHost)
+        WebProcess::singleton().eventDispatcher().removeScrollingTreeForPage(&m_webPage);
+#endif
+}
 
 void DrawingAreaCoordinatedGraphics::setNeedsDisplay()
 {
@@ -579,6 +586,9 @@
 void DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
 {
 #if PLATFORM(GTK)
+    if (m_supportsAsyncScrolling)
+        WebProcess::singleton().eventDispatcher().addScrollingTreeForPage(&m_webPage);
+
     if (!m_alwaysUseCompositing) {
         m_webPage.corePage()->settings().setForceCompositingMode(true);
         m_alwaysUseCompositing = true;
@@ -640,6 +650,11 @@
     m_exitCompositingTimer.stop();
     m_wantsToExitAcceleratedCompositingMode = false;
 
+#if PLATFORM(GTK)
+    if (m_supportsAsyncScrolling)
+        WebProcess::singleton().eventDispatcher().removeScrollingTreeForPage(&m_webPage);
+#endif
+
     ASSERT(m_layerTreeHost);
     m_previousLayerTreeHost = WTFMove(m_layerTreeHost);
     m_previousLayerTreeHost->setIsDiscardable(true);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (277257 => 277258)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-05-10 07:16:13 UTC (rev 277257)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-05-10 09:13:54 UTC (rev 277258)
@@ -781,7 +781,7 @@
     webPageCounter.increment();
 #endif
 
-#if ENABLE(SCROLLING_THREAD)
+#if ENABLE(SCROLLING_THREAD) && !PLATFORM(GTK)
     if (m_useAsyncScrolling)
         webProcess.eventDispatcher().addScrollingTreeForPage(this);
 #endif
@@ -1562,7 +1562,8 @@
         m_remoteObjectRegistry->close();
     ASSERT(!m_remoteObjectRegistry);
 #endif
-#if ENABLE(SCROLLING_THREAD)
+
+#if ENABLE(SCROLLING_THREAD) && !PLATFORM(GTK)
     if (m_useAsyncScrolling)
         webProcess.eventDispatcher().removeScrollingTreeForPage(this);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to