-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cocoa] Small canvases, which aren't supposed to get compositing laye…
…rs, get compositing layers if they have a 3D-but-could-be-2D transform https://bugs.webkit.org/show_bug.cgi?id=259297 rdar://112439265 Reviewed by Simon Fraser. We already have existing code which will avoid compositing small canvases. However, if the small canvas has a 3D-but-could-be-2D transform, we'll composite it regardless. This patch extends the current logic to not composite small canvases in this case. This patch causes a 41% - 48% progression on the Images subtest in MotionMark. Layers have cost, y'all. * LayoutTests/compositing/canvas/accelerated-small-canvas-compositing-expected.txt * LayoutTests/compositing/canvas/accelerated-small-canvas-compositing.html * Source/WebCore/rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForTransform const): This patch doesn't modify m_compositingPolicy, because that's global for the whole RenderLayerCompositor. We only want to change the policy in this specific case. Canonical link: https://commits.webkit.org/266135@main
- Loading branch information
Showing
5 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
LayoutTests/compositing/canvas/accelerated-small-canvas-compositing-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Tests whether an accelerated canvas creates a compositing layer. | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 68.00) | ||
(bounds 15.00 15.00) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
40 changes: 40 additions & 0 deletions
40
LayoutTests/compositing/canvas/accelerated-small-canvas-compositing.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html><html> | ||
<head> | ||
<style> | ||
canvas { | ||
transform: translateZ(0px); | ||
} | ||
div { | ||
will-change: transform; | ||
width: 15px; | ||
height: 15px; | ||
} | ||
</style> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function doTest() { | ||
var c = document.getElementById('cvs_img2'); | ||
var ctx = c.getContext('2d'); | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0,0,c.width, c.height); | ||
|
||
if (window.testRunner) { | ||
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document); | ||
testRunner.notifyDone(); | ||
} | ||
} | ||
|
||
window.addEventListener('load', doTest, false); | ||
</script> | ||
</head> | ||
<body> | ||
<p>Tests whether an accelerated canvas creates a compositing layer.</p> | ||
<canvas id="cvs_img2" width="10" height="10"></canvas> | ||
<div></div> | ||
<pre id="layers">Layer tree goes here in DRT</pre> | ||
</body> | ||
</html> |
24 changes: 24 additions & 0 deletions
24
...utTests/platform/gtk/compositing/canvas/accelerated-small-canvas-compositing-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Tests whether an accelerated canvas creates a compositing layer. | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 2 | ||
(GraphicsLayer | ||
(position 8.00 54.00) | ||
(bounds 10.00 10.00) | ||
(drawsContent 1) | ||
) | ||
(GraphicsLayer | ||
(position 8.00 68.00) | ||
(bounds 15.00 15.00) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
19 changes: 19 additions & 0 deletions
19
...utTests/platform/ios/compositing/canvas/accelerated-small-canvas-compositing-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Tests whether an accelerated canvas creates a compositing layer. | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 72.00) | ||
(bounds 15.00 15.00) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
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