Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
When navigating back to a page, compositing layers may not use accele…
…rated drawing https://bugs.webkit.org/show_bug.cgi?id=178749 rdar://problem/35158946 Reviewed by Dean Jackson. Source/WebCore: There were two issues with setting GraphicsLayerCA's "acceleratesDrawing" state which occurred on back navigation, related to the ordering of style recalcs and layout. First, at style recalc time, we created a RenderLayerCompositor but hadn't yet called its cacheAcceleratedCompositingFlags(), so any layers created during style update didn't get accelerated drawing. Fix by making cacheAcceleratedCompositingFlags() internal to RenderLayerCompositor and calling it from willRecalcStyle() and updateCompositingLayers(). Secondly, GraphicsLayerCA::commitLayerChangesBeforeSublayers() needs to updateAcceleratesDrawing() before updating tiles, so that new tiles fetch the right acceleratesDrawing state from the TileController. Test: compositing/accelerated-layers-after-back.html * page/FrameView.cpp: (WebCore::FrameView::updateCompositingLayersAfterLayout): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::willRecalcStyle): (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout): (WebCore::RenderLayerCompositor::updateCompositingLayers): * rendering/RenderLayerCompositor.h: Source/WebKit: Avoid assertions when a test enables accelerated drawing (which we can't support in the iOS simulator). * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::ensureBackingStore): Tools: Fix WTR and DRT to parse "useAcceleratedDrawing" out of "webkit-test-runner" options and use it to set the state of the web view. * DumpRenderTree/TestOptions.h: * DumpRenderTree/TestOptions.mm: (TestOptions::TestOptions): * DumpRenderTree/mac/DumpRenderTree.mm: (setWebPreferencesForTestOptions): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): (WTR::updateTestOptionsFromTestHeader): * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::hasSameInitializationOptions const): LayoutTests: Moved iframes/resources/page-cache-helper.html up to compositing/resources/go-back.html. * compositing/accelerated-layers-after-back-expected.txt: Added. * compositing/accelerated-layers-after-back.html: Added. * compositing/iframes/page-cache-layer-tree.html: * compositing/page-cache-back-crash.html: * compositing/resources/go-back.html: Renamed from LayoutTests/compositing/iframes/resources/page-cache-helper.html. * platform/ios/compositing/accelerated-layers-after-back-expected.txt: Added. Canonical link: https://commits.webkit.org/195066@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
21 changed files
with
286 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,45 @@ | ||
This layer should use 'acceleratesDrawing' after going back to this page. | ||
|
||
Before: | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(acceleratesDrawing 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 18.00 10.00) | ||
(bounds 222.00 222.00) | ||
(drawsContent 1) | ||
(acceleratesDrawing 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
After: | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 785.00 653.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 785.00 653.00) | ||
(contentsOpaque 1) | ||
(acceleratesDrawing 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 18.00 10.00) | ||
(bounds 222.00 222.00) | ||
(drawsContent 1) | ||
(acceleratesDrawing 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ useAcceleratedDrawing=true ] --> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
position: relative; | ||
height: 200px; | ||
width: 200px; | ||
margin: 10px; | ||
padding: 10px; | ||
border: 1px solid black; | ||
will-change: transform; | ||
} | ||
</style> | ||
<script> | ||
var jsTestIsAsync = true; | ||
|
||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
window.testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1); | ||
} | ||
|
||
function doOnFirstLoad() | ||
{ | ||
if (window.internals) | ||
document.getElementById('layers-before-navigate').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_ACCELERATES_DRAWING); | ||
|
||
setTimeout(function() { | ||
window.location.href = 'resources/go-back.html'; | ||
}, 0); | ||
} | ||
|
||
function doAfterBack() | ||
{ | ||
if (window.internals) | ||
document.getElementById('layers-after-back').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_ACCELERATES_DRAWING); | ||
|
||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
|
||
window.addEventListener("pageshow", function(event) { | ||
if (event.persisted) | ||
setTimeout(doAfterBack, 0); | ||
}, false); | ||
|
||
function doTest() | ||
{ | ||
doOnFirstLoad(); | ||
} | ||
|
||
window.addEventListener('load', doTest, false); | ||
</script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<p>This layer should use 'acceleratesDrawing' after going back to this page.</p> | ||
</div> | ||
<h2>Before:</h2> | ||
<pre id="layers-before-navigate"></pre> | ||
<h2>After:</h2> | ||
<pre id="layers-after-back"></pre> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -9,7 +9,7 @@ | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
} | ||
|
||
function doTest() | ||
{ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,45 @@ | ||
This layer should use 'acceleratesDrawing' after going back to this page. | ||
|
||
Before: | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(acceleratesDrawing 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 18.00 10.00) | ||
(bounds 222.00 222.00) | ||
(drawsContent 1) | ||
(acceleratesDrawing 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
After: | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 638.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 638.00) | ||
(contentsOpaque 1) | ||
(acceleratesDrawing 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 18.00 10.00) | ||
(bounds 222.00 222.00) | ||
(drawsContent 1) | ||
(acceleratesDrawing 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.