Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Don't always make backing store for -webkit-backface-visibility:hidden
https://bugs.webkit.org/show_bug.cgi?id=132420 Reviewed by Sam Weinig. Source/WebCore: Previously, -webkit-backface-visibility:hidden unconditionally created compositing layers with backing store. This results in high memory use on pages with this style applied to many elements (a cargo-cult "optimization"). Fix by only having -webkit-backface-visibility:hidden create compositing layers if some ancestor has a 3D transform. That's the only scenario in which the element can be flipped around to reveal the back side, so the only time we need to do compositing for this property. In future, we could be smarter, and only consider 3D transforms in the current preserve-3d context. Tests: compositing/backing/backface-visibility-in-3dtransformed.html compositing/backing/backface-visibility-in-transformed.html compositing/backing/backface-visibility.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::updateLayerPositions): (WebCore::RenderLayer::hitTestLayer): * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingLayer): (WebCore::RenderLayerCompositor::requiresOwnBackingStore): (WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility): * rendering/RenderLayerCompositor.h: LayoutTests: Dump layers for elements with backface-visibility: hidden with various types of ancestors. * compositing/backing/backface-visibility-expected.txt: Added. * compositing/backing/backface-visibility-in-3dtransformed-expected.txt: Added. * compositing/backing/backface-visibility-in-3dtransformed.html: Added. * compositing/backing/backface-visibility-in-transformed-expected.txt: Added. * compositing/backing/backface-visibility-in-transformed.html: Added. * compositing/backing/backface-visibility.html: Added. * inspector-protocol/layers/layers-anonymous.html: Don't use backface-visibility for force a layer. Canonical link: https://commits.webkit.org/150473@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168119 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
15 changed files
with
252 additions
and
14 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
3 changes: 3 additions & 0 deletions
3
LayoutTests/compositing/backing/backface-visibility-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,3 @@ | ||
Should be no layers here. | ||
|
||
|
28 changes: 28 additions & 0 deletions
28
LayoutTests/compositing/backing/backface-visibility-in-3dtransformed-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,28 @@ | ||
Should be several layers here. | ||
|
||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 50.00) | ||
(bounds 122.00 122.00) | ||
(drawsContent 1) | ||
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 10.00 1.00]) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 11.00 11.00) | ||
(bounds 100.00 100.00) | ||
(contentsOpaque 1) | ||
(backfaceVisibility hidden) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
46 changes: 46 additions & 0 deletions
46
LayoutTests/compositing/backing/backface-visibility-in-3dtransformed.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,46 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
height: 100px; | ||
width: 100px; | ||
padding: 10px; | ||
border: 1px solid gray; | ||
} | ||
.box { | ||
width: 100px; | ||
height: 100px; | ||
background-color: silver; | ||
} | ||
|
||
.transformed { | ||
-webkit-transform: translateZ(10px); | ||
} | ||
.backface-hidden { | ||
-webkit-backface-visibility: hidden; | ||
} | ||
</style> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
function dumpLayers() | ||
{ | ||
var layersResult = document.getElementById('layers'); | ||
if (window.testRunner) | ||
layersResult.innerText = window.internals.layerTreeAsText(document); | ||
|
||
} | ||
window.addEventListener('load', dumpLayers, false) | ||
</script> | ||
</head> | ||
<body> | ||
<p>Should be several layers here.</p> | ||
<div class="transformed container"> | ||
<div class="backface-hidden box"></div> | ||
</div> | ||
<pre id="layers"></pre> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
LayoutTests/compositing/backing/backface-visibility-in-transformed-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,3 @@ | ||
Should be no layers here. | ||
|
||
|
46 changes: 46 additions & 0 deletions
46
LayoutTests/compositing/backing/backface-visibility-in-transformed.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,46 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
height: 100px; | ||
width: 100px; | ||
padding: 10px; | ||
border: 1px solid gray; | ||
} | ||
.box { | ||
width: 100px; | ||
height: 100px; | ||
background-color: silver; | ||
} | ||
|
||
.transformed { | ||
-webkit-transform: translate(10px, 10px); | ||
} | ||
.backface-hidden { | ||
-webkit-backface-visibility: hidden; | ||
} | ||
</style> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
function dumpLayers() | ||
{ | ||
var layersResult = document.getElementById('layers'); | ||
if (window.testRunner) | ||
layersResult.innerText = window.internals.layerTreeAsText(document); | ||
|
||
} | ||
window.addEventListener('load', dumpLayers, false) | ||
</script> | ||
</head> | ||
<body> | ||
<p>Should be no layers here.</p> | ||
<div class="transformed container"> | ||
<div class="backface-hidden box"></div> | ||
</div> | ||
<pre id="layers"></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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
.box { | ||
width: 100px; | ||
height: 100px; | ||
background-color: silver; | ||
} | ||
|
||
.backface-hidden { | ||
-webkit-backface-visibility: hidden; | ||
} | ||
</style> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
function dumpLayers() | ||
{ | ||
var layersResult = document.getElementById('layers'); | ||
if (window.testRunner) | ||
layersResult.innerText = window.internals.layerTreeAsText(document); | ||
|
||
} | ||
window.addEventListener('load', dumpLayers, false) | ||
</script> | ||
</head> | ||
<body> | ||
<p>Should be no layers here.</p> | ||
<div class="backface-hidden box"></div> | ||
<pre id="layers"></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
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