- Revision
- 238575
- Author
- [email protected]
- Date
- 2018-11-27 13:50:03 -0800 (Tue, 27 Nov 2018)
Log Message
Composited and tiled layers fail to update on scrolling in WebView
https://bugs.webkit.org/show_bug.cgi?id=191821
rdar://problem/46009272
Reviewed by Zalan Bujtas.
Source/WebCore:
We relied on AppKit calling -[NSView viewWillDraw] on scrolling to trigger compositing
layer flushes which are necessary to update backing store attachment, and tile coverage
for tiled layers. However, we no longer get these reliably in WebView, so explicitly trigger
flushes if necessary from FrameView::scrollOffsetChangedViaPlatformWidgetImpl().
didChangeVisibleRect() is the same code path used by iOS UIWebView for the same purpose.
Tests: compositing/backing/backing-store-attachment-scroll.html
compositing/tiling/tile-coverage-on-scroll.html
* page/FrameView.cpp:
(WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateCoverage):
LayoutTests:
Tests for backing store attachment, and tile coverage before and after scrolling.
* compositing/backing/backing-store-attachment-scroll-expected.txt: Added.
* compositing/backing/backing-store-attachment-scroll.html: Added.
* compositing/tiling/tile-coverage-on-scroll-expected.txt: Added.
* compositing/tiling/tile-coverage-on-scroll.html: Added.
* platform/mac-wk1/compositing/tiling/tile-coverage-on-scroll-expected.txt: Added. Root isn't tiled on WK1, so different result.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (238574 => 238575)
--- trunk/LayoutTests/ChangeLog 2018-11-27 21:48:47 UTC (rev 238574)
+++ trunk/LayoutTests/ChangeLog 2018-11-27 21:50:03 UTC (rev 238575)
@@ -1,3 +1,19 @@
+2018-11-27 Simon Fraser <[email protected]>
+
+ Composited and tiled layers fail to update on scrolling in WebView
+ https://bugs.webkit.org/show_bug.cgi?id=191821
+ rdar://problem/46009272
+
+ Reviewed by Zalan Bujtas.
+
+ Tests for backing store attachment, and tile coverage before and after scrolling.
+
+ * compositing/backing/backing-store-attachment-scroll-expected.txt: Added.
+ * compositing/backing/backing-store-attachment-scroll.html: Added.
+ * compositing/tiling/tile-coverage-on-scroll-expected.txt: Added.
+ * compositing/tiling/tile-coverage-on-scroll.html: Added.
+ * platform/mac-wk1/compositing/tiling/tile-coverage-on-scroll-expected.txt: Added. Root isn't tiled on WK1, so different result.
+
2018-11-27 Daniel Bates <[email protected]>
Fix test timeout following <https://trac.webkit.org/changeset/238545>
Added: trunk/LayoutTests/compositing/backing/backing-store-attachment-scroll-expected.txt (0 => 238575)
--- trunk/LayoutTests/compositing/backing/backing-store-attachment-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/backing/backing-store-attachment-scroll-expected.txt 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,71 @@
+Before
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 2916.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 2916.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 3
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ (GraphicsLayer
+ (position 8.00 1308.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ (GraphicsLayer
+ (position 8.00 2608.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ )
+ )
+ )
+)
+
+
+After
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 2916.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 2916.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 3
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ (GraphicsLayer
+ (position 8.00 1308.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ (GraphicsLayer
+ (position 8.00 2608.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ )
+ )
+ )
+)
+First layer.
+Second layer.
+Third layer.
Added: trunk/LayoutTests/compositing/backing/backing-store-attachment-scroll.html (0 => 238575)
--- trunk/LayoutTests/compositing/backing/backing-store-attachment-scroll.html (rev 0)
+++ trunk/LayoutTests/compositing/backing/backing-store-attachment-scroll.html 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.layerized {
+ transform: translateZ(0);
+ width: 300px;
+ height: 300px;
+}
+.vspace {
+ height: 1000px;
+}
+
+#out {
+ position: absolute;
+}
+</style>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+window._onload_ = function() {
+ if (!window.testRunner)
+ return;
+
+ let beforeScrollLayers = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+
+ requestAnimationFrame(() => {
+
+ window.scrollTo(0, 3000);
+
+ let uiScript = `(function() {
+ uiController.doAfterNextStablePresentationUpdate(function() {
+ uiController.uiScriptComplete();
+ });
+ })()`
+
+ testRunner.runUIScript(uiScript, () => {
+ let afterLayers = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+ let out = document.getElementById('out');
+ out.textContent = `Before\n${beforeScrollLayers}\n\nAfter\n${afterLayers}`
+ testRunner.notifyDone();
+ });
+ });
+};
+</script>
+</head>
+<body>
+<pre id="out"></pre>
+ <div class="layerized">First layer.</div>
+ <div class="vspace"></div>
+ <div class="layerized">Second layer.</div>
+ <div class="vspace"></div>
+ <div class="layerized">Third layer.</div>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/tiling/tile-coverage-on-scroll-expected.txt (0 => 238575)
--- trunk/LayoutTests/compositing/tiling/tile-coverage-on-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tile-coverage-on-scroll-expected.txt 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,59 @@
+Before
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 5016.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 5016.00)
+ (contentsOpaque 1)
+ (tile cache coverage 0, 0 785 x 1024)
+ (tile size 785 x 512)
+ (top left tile 0, 0 tiles grid 1 x 2)
+ (in window 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 5000.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 100 x 1024)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 1 x 2)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+
+
+After
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 5016.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 5016.00)
+ (contentsOpaque 1)
+ (tile cache coverage 0, 2560 785 x 1536)
+ (tile size 785 x 512)
+ (top left tile 0, 5 tiles grid 1 x 3)
+ (in window 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 5000.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 2560 100 x 1536)
+ (tile size 512 x 512)
+ (top left tile 0, 5 tiles grid 1 x 3)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+Tall tiled layer
Added: trunk/LayoutTests/compositing/tiling/tile-coverage-on-scroll.html (0 => 238575)
--- trunk/LayoutTests/compositing/tiling/tile-coverage-on-scroll.html (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tile-coverage-on-scroll.html 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.layerized {
+ transform: translateZ(0);
+ width: 100px;
+ height: 5000px;
+ background-color: silver;
+}
+
+#out {
+ position: absolute;
+}
+</style>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+window._onload_ = function() {
+ if (!window.testRunner)
+ return;
+
+ let beforeScrollLayers = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+
+ requestAnimationFrame(() => {
+ window.scrollTo(0, 3000);
+
+ let uiScript = `(function() {
+ uiController.doAfterNextStablePresentationUpdate(function() {
+ uiController.uiScriptComplete();
+ });
+ })()`
+
+ testRunner.runUIScript(uiScript, () => {
+ let afterLayers = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+ let out = document.getElementById('out');
+ out.textContent = `Before\n${beforeScrollLayers}\n\nAfter\n${afterLayers}`
+ testRunner.notifyDone();
+ });
+ });
+};
+</script>
+</head>
+<body>
+<pre id="out"></pre>
+ <div class="layerized">Tall tiled layer</div>
+</body>
+</html>
Added: trunk/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-scroll-expected.txt (0 => 238575)
--- trunk/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-scroll-expected.txt 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,71 @@
+Before
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 2916.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 2916.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 3
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ (GraphicsLayer
+ (position 8.00 1308.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ (GraphicsLayer
+ (position 8.00 2608.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ )
+ )
+ )
+)
+
+
+After
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 2916.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 2916.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 3
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ (GraphicsLayer
+ (position 8.00 1308.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 0)
+ )
+ (GraphicsLayer
+ (position 8.00 2608.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ )
+ )
+ )
+)
+First layer.
+Second layer.
+Third layer.
Added: trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tile-coverage-on-scroll-expected.txt (0 => 238575)
--- trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tile-coverage-on-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tile-coverage-on-scroll-expected.txt 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,59 @@
+Before
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 5016.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 5016.00)
+ (contentsOpaque 1)
+ (tile cache coverage 0, 0 800 x 1024)
+ (tile size 800 x 512)
+ (top left tile 0, 0 tiles grid 1 x 2)
+ (in window 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 5000.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 100 x 1024)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 1 x 2)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+
+
+After
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 5016.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 5016.00)
+ (contentsOpaque 1)
+ (tile cache coverage 0, 2560 800 x 1536)
+ (tile size 800 x 512)
+ (top left tile 0, 5 tiles grid 1 x 3)
+ (in window 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 5000.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 2560 100 x 1536)
+ (tile size 512 x 512)
+ (top left tile 0, 5 tiles grid 1 x 3)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+Tall tiled layer
Added: trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tile-coverage-on-scroll-expected.txt (0 => 238575)
--- trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tile-coverage-on-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tile-coverage-on-scroll-expected.txt 2018-11-27 21:50:03 UTC (rev 238575)
@@ -0,0 +1,51 @@
+Before
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 5016.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 5016.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 5000.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 100 x 1024)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 1 x 2)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+
+
+After
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 5016.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 5016.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 5000.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 2560 100 x 1536)
+ (tile size 512 x 512)
+ (top left tile 0, 5 tiles grid 1 x 3)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+Tall tiled layer
Modified: trunk/Source/WebCore/ChangeLog (238574 => 238575)
--- trunk/Source/WebCore/ChangeLog 2018-11-27 21:48:47 UTC (rev 238574)
+++ trunk/Source/WebCore/ChangeLog 2018-11-27 21:50:03 UTC (rev 238575)
@@ -1,3 +1,25 @@
+2018-11-27 Simon Fraser <[email protected]>
+
+ Composited and tiled layers fail to update on scrolling in WebView
+ https://bugs.webkit.org/show_bug.cgi?id=191821
+ rdar://problem/46009272
+
+ Reviewed by Zalan Bujtas.
+
+ We relied on AppKit calling -[NSView viewWillDraw] on scrolling to trigger compositing
+ layer flushes which are necessary to update backing store attachment, and tile coverage
+ for tiled layers. However, we no longer get these reliably in WebView, so explicitly trigger
+ flushes if necessary from FrameView::scrollOffsetChangedViaPlatformWidgetImpl().
+ didChangeVisibleRect() is the same code path used by iOS UIWebView for the same purpose.
+
+ Tests: compositing/backing/backing-store-attachment-scroll.html
+ compositing/tiling/tile-coverage-on-scroll.html
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::updateCoverage):
+
2018-11-27 Timothy Hatcher <[email protected]>
Web Inspector: Add support for forcing color scheme appearance in DOM tree.
Modified: trunk/Source/WebCore/page/FrameView.cpp (238574 => 238575)
--- trunk/Source/WebCore/page/FrameView.cpp 2018-11-27 21:48:47 UTC (rev 238574)
+++ trunk/Source/WebCore/page/FrameView.cpp 2018-11-27 21:50:03 UTC (rev 238575)
@@ -2464,6 +2464,11 @@
updateCompositingLayersAfterScrolling();
repaintSlowRepaintObjects();
scrollPositionChanged(scrollPositionFromOffset(oldOffset), scrollPositionFromOffset(newOffset));
+
+ if (auto* renderView = this->renderView()) {
+ if (renderView->usesCompositing())
+ renderView->compositor().didChangeVisibleRect();
+ }
}
// These scroll positions are affected by zooming.
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (238574 => 238575)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2018-11-27 21:48:47 UTC (rev 238574)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2018-11-27 21:50:03 UTC (rev 238575)
@@ -2400,7 +2400,8 @@
return "has transform animation with unknown extent";
};
LOG_WITH_STREAM(Compositing, stream << "GraphicsLayerCA " << this << " id " << primaryLayerID() << " setBackingStoreAttached: " << requiresBacking << " (" << reasonForBacking() << ")");
- }
+ } else
+ LOG_WITH_STREAM(Compositing, stream << "GraphicsLayerCA " << this << " id " << primaryLayerID() << " setBackingStoreAttached: " << requiresBacking);
#endif
m_layer->setBackingStoreAttached(requiresBacking);