Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(webkit): preserve compositing mode in WPE web process (#2508)

Yury Semikhatsky6f048438c10d
diff --git a/browser_patches/webkit/BUILD_NUMBER b/browser_patches/webkit/BUILD_NUMBER
index e5d76887a3..9c113c6f75 100644
--- a/browser_patches/webkit/BUILD_NUMBER
+++ b/browser_patches/webkit/BUILD_NUMBER
@@ -1 +1 @@
-1274
+1275
diff --git a/browser_patches/webkit/patches/bootstrap.diff b/browser_patches/webkit/patches/bootstrap.diff
index 7e32019e97..e3e6a7ac86 100644
--- a/browser_patches/webkit/patches/bootstrap.diff
+++ b/browser_patches/webkit/patches/bootstrap.diff
@@ -14861,7 +14861,7 @@ index 4ada29373feb20a60b50c54d6d9cd95d3f781b24..f4f73c9aa61e9f4cfb2d6da296960040
void WebFrameLoaderClient::didRestoreFromBackForwardCache()
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
-index 564126e14e22882e7896fcff3e6d32f722eec47b..71fbdd4d4cb720a1ce5b34ababac61915241d2f2 100644
+index 564126e14e22882e7896fcff3e6d32f722eec47b..8d3adaf201eed5e8f0176ccd31e8123619f40e87 100644
--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
@@ -37,6 +37,7 @@
@@ -14872,28 +14872,30 @@ index 564126e14e22882e7896fcff3e6d32f722eec47b..71fbdd4d4cb720a1ce5b34ababac6191
#include <WebCore/Page.h>
#include <WebCore/PageOverlayController.h>
#include <WebCore/Settings.h>
-@@ -247,12 +248,20 @@ void DrawingAreaCoordinatedGraphics::updatePreferences(const WebPreferencesStore
+@@ -122,6 +123,14 @@ void DrawingAreaCoordinatedGraphics::scroll(const IntRect& scrollRect, const Int
+ ASSERT(m_scrollRect.isEmpty());
+ ASSERT(m_scrollOffset.isEmpty());
+ ASSERT(m_dirtyRegion.isEmpty());
++// Playwright begin
++ if (m_webPage.mainFrameView() && m_webPage.mainFrameView()->useFixedLayout()) {
++ IntRect visibleRect;
++ visibleRect.move(-scrollDelta.width(), -scrollDelta.height());
++ m_layerTreeHost->scrollNonCompositedContents(visibleRect);
++ return;
++ }
++// Playwright end
+ m_layerTreeHost->scrollNonCompositedContents(scrollRect);
+ return;
+ }
+@@ -247,6 +256,7 @@ void DrawingAreaCoordinatedGraphics::updatePreferences(const WebPreferencesStore
settings.setAcceleratedCompositingEnabled(false);
}
#endif
+
-+#if USE(LIBWPE)
-+ settings.setAcceleratedCompositingEnabled(false);
-+ settings.setForceCompositingMode(false);
-+ settings.setAcceleratedCompositingForFixedPositionEnabled(false);
-+ m_alwaysUseCompositing = false;
-+#else
settings.setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()));
// Fixed position elements need to be composited and create stacking contexts
// in order to be scrolled by the ScrollingCoordinator.
- settings.setAcceleratedCompositingForFixedPositionEnabled(settings.acceleratedCompositingEnabled());
-
- m_alwaysUseCompositing = settings.acceleratedCompositingEnabled() && settings.forceCompositingMode();
-+#endif
-
- // If async scrolling is disabled, we have to force-disable async frame and overflow scrolling
- // to keep the non-async scrolling on those elements working.
-@@ -716,6 +725,11 @@ void DrawingAreaCoordinatedGraphics::display()
+@@ -716,6 +726,11 @@ void DrawingAreaCoordinatedGraphics::display()
return;
}
@@ -14905,6 +14907,23 @@ index 564126e14e22882e7896fcff3e6d32f722eec47b..71fbdd4d4cb720a1ce5b34ababac6191
send(Messages::DrawingAreaProxy::Update(m_backingStoreStateID, updateInfo));
m_isWaitingForDidUpdate = true;
}
+diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
+index 8685e23d0d468601c459954775fe6f565b0ce7ac..124851cacc6a6a2901099e8c8157334cfa254d96 100644
+--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
++++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
+@@ -166,8 +166,11 @@ void LayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
+ void LayerTreeHost::scrollNonCompositedContents(const IntRect& rect)
+ {
+ auto* frameView = m_webPage.mainFrameView();
+- if (!frameView || !frameView->delegatesScrolling())
++// Playwright begin
++ if (!frameView) {
+ return;
++ }
++// Playwright end
+
+ m_viewportController.didScroll(rect.location());
+ if (m_isDiscardable)
diff --git a/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp b/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp
index b2d54a627b94583bda3518c4e7c3364481b605a4..d407e32b6a7b8b27925c49391e86d42c9b3dfa8b 100644
--- a/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp