Diff
Modified: trunk/LayoutTests/ChangeLog (213465 => 213466)
--- trunk/LayoutTests/ChangeLog 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/LayoutTests/ChangeLog 2017-03-06 21:45:38 UTC (rev 213466)
@@ -1,3 +1,33 @@
+2017-03-06 Simon Fraser <[email protected]>
+
+ Only use layer backing store which supports subpixel antialiased text if we know subpixel antialiased will be painted into it
+ https://bugs.webkit.org/show_bug.cgi?id=169191
+
+ Reviewed by Zalan Bujtas.
+
+ Test lots of layer configs for subpixel antialiased text support. Only Mac results show the
+ "(supports subpixel antialiased text 1)" flag on layers now, since the patch makes this
+ dependent on platform support.
+
+ * compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt: Added.
+ * compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html: Added.
+ * compositing/contents-format/subpixel-antialiased-text-configs-expected.txt: Added.
+ * compositing/contents-format/subpixel-antialiased-text-configs.html: Added.
+ * compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt:
+ * compositing/contents-format/subpixel-antialiased-text-enabled.html:
+ * compositing/contents-format/subpixel-antialiased-text-images-expected.txt: Added.
+ * compositing/contents-format/subpixel-antialiased-text-images.html: Added.
+ * compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt: Added.
+ * compositing/contents-format/subpixel-antialiased-text-visibility.html: Added.
+ * compositing/resources/circle-with-text.svg: Added.
+ * compositing/resources/circle.svg: Added.
+ * platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt:
+ * platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt: Added.
+ * platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt: Added.
+ * platform/mac/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt: Copied from LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt.
+ * platform/mac/compositing/contents-format/subpixel-antialiased-text-images-expected.txt: Added.
+ * platform/mac/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt: Added.
+
2017-03-06 Myles C. Maxfield <[email protected]>
Expand font-weight and font-stretch to take any number
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,118 @@
+
+Text here
+
+Antialiased text
+
+Smoothed text
+
+Antialised text
+Smoothed text
+
+Child composited layer
+
+Smoothed text
+
+Antialiased text
+
+Antialiased text
+
+Smoothed text
+
+Exceeds depth test antialiased
+
+Exceeds depth test smoothed
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 12
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 12.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 60.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 12.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 20.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 182.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 20.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 352.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,138 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 150px;
+ width: 150px;
+ float: left;
+ position: relative;
+ border: 1px solid black;
+ padding: 20px;
+ margin: 10px;
+ box-sizing: border-box;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
+ }
+
+ .box {
+ position: relative;
+ height: 40px;
+ width: 100px;
+ background-color: rgba(0, 0, 128, 0.5);
+ }
+
+ p {
+ line-height: 20px;
+ }
+
+ .composited {
+ will-change: transform;
+ }
+
+ .antialiased {
+ -webkit-font-smoothing: antialiased;
+ }
+
+ .smoothed {
+ -webkit-font-smoothing: subpixel-antialiased;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ if (window.internals) {
+ internals.setFontSmoothingEnabled(true);
+ internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+ }
+
+ function doTest()
+ {
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<div class="composited container">
+</div>
+
+<div class="composited container">
+ <span> </span> <p class="smoothed"> </p>
+</div>
+
+<div class="composited container">
+
+</div>
+
+<div class="composited container">
+ <p>Text here</p>
+</div>
+
+<div class="composited container antialiased">
+ <p>Antialiased text</p>
+</div>
+
+<div class="composited container smoothed">
+ <p>Smoothed text</p>
+</div>
+
+<div class="composited container">
+ <div class="antialiased">Antialised text</div>
+ <div class="smoothed" style="position: relative;">
+ <p>Smoothed text</p>
+ </div>
+</div>
+
+<div class="composited container">
+ <div class="composited">
+ <p>Child composited layer</p>
+ </div>
+</div>
+
+<div class="composited container">
+ <div class="composited">
+ <p class="smoothed">Smoothed text</p>
+ </div>
+ <p class="antialiased">Antialiased text</p>
+</div>
+
+<div class="composited container">
+ <div class="composited">
+ <p class="antialiased">Antialiased text</p>
+ </div>
+ <p class="smoothed">Smoothed text</p>
+</div>
+
+<div class="composited container">
+ <div style="position-relative">
+ <div style="position-relative">
+ <div style="position-relative">
+ <div style="position-relative">
+ <p class="antialiased">Exceeds depth test antialiased</p>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="composited container">
+ <div style="position-relative">
+ <div style="position-relative">
+ <div style="position-relative">
+ <div style="position-relative">
+ <p class="smoothed">Exceeds depth test smoothed</p>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<pre id="layers"></pre>
+
+</body>
+</html>
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,103 @@
+ Solid background
+Text here
+
+Text here
+
+Negative z-index child
+And more content
+Child layer
+
+Child composited layer
+
+Child composited layer
+
+Text here.
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 11
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 12.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 79.00)
+ (bounds 100.00 40.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 352.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 60.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 12.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 60.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 182.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs.html (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs.html (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-configs.html 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 150px;
+ width: 150px;
+ float: left;
+ position: relative;
+ border: 1px solid black;
+ padding: 20px;
+ margin: 10px;
+ box-sizing: border-box;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
+ }
+
+ .box {
+ position: relative;
+ height: 40px;
+ width: 100px;
+ background-color: rgba(0, 0, 128, 0.5);
+ }
+
+ p {
+ line-height: 20px;
+ }
+
+ .composited {
+ will-change: transform;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ if (window.internals) {
+ internals.setFontSmoothingEnabled(true);
+ internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+ }
+
+ function doTest()
+ {
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<div class="composited container">
+</div>
+
+<div class="composited container">
+ <span> </span> <p> </p>
+</div>
+
+<div class="composited container">
+
+</div>
+
+<div class="composited container" style="background-color: silver;">
+ Solid background
+</div>
+
+<div class="composited container">
+ <p>Text here</p>
+</div>
+
+<div class="composited container">
+ <p>Text here</p>
+ <div class="composited box">
+ Negative z-index child
+ </div>
+ And more content
+</div>
+
+<div class="composited container">
+ <div style="position: relative;">
+ <p>Child layer</p>
+ </div>
+</div>
+
+<div class="composited container">
+ <div class="composited">
+ <p>Child composited layer</p>
+ </div>
+</div>
+
+<div class="composited container">
+ <div class="composited">
+ <p>Child composited layer</p>
+ </div>
+ Text here.
+</div>
+
+<div class="composited container">
+ <input type="text" style="width: 90%" value="input">
+</div>
+
+<div class="composited container">
+ <select style="width: 90%">
+ <option>First option</option>
+ <option>Second option</option>
+ </select>
+</div>
+
+<pre id="layers"></pre>
+
+</body>
+</html>
Modified: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt (213465 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -1,5 +1,6 @@
Normal layer
Tiled layer
+Become-tiled layer
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 5018.00 2018.00)
@@ -7,17 +8,14 @@
(GraphicsLayer
(bounds 5018.00 2018.00)
(contentsOpaque 1)
- (supports subpixel antialiased text 1)
(tile cache coverage 0, 0 1024 x 1024)
(tile size 512 x 512)
(top left tile 0, 0 tiles grid 2 x 2)
(in window 1)
- (children 2
+ (children 3
(GraphicsLayer
(position 18.00 10.00)
(bounds 100.00 100.00)
- (contentsOpaque 1)
- (supports subpixel antialiased text 1)
(drawsContent 1)
)
(GraphicsLayer
@@ -24,8 +22,6 @@
(position 18.00 120.00)
(bounds 5000.00 100.00)
(usingTiledLayer 1)
- (contentsOpaque 1)
- (supports subpixel antialiased text 1)
(drawsContent 1)
(tile cache coverage 0, 0 1024 x 100)
(tile size 512 x 512)
@@ -32,6 +28,16 @@
(top left tile 0, 0 tiles grid 2 x 1)
(in window 1)
)
+ (GraphicsLayer
+ (position 18.00 230.00)
+ (bounds 5000.00 100.00)
+ (usingTiledLayer 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 1024 x 100)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 2 x 1)
+ (in window 1)
+ )
)
)
)
Modified: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled.html (213465 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled.html 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled.html 2017-03-06 21:45:38 UTC (rev 213466)
@@ -5,12 +5,13 @@
<style>
body {
height: 2000px;
+ -webkit-font-smoothing: subpixel-antialiased;
}
.box {
height: 100px;
width: 100px;
- background-color: blue;
+ background-color: rgba(0, 0, 128, 0.6);
margin: 10px;
}
@@ -17,6 +18,10 @@
.composited {
transform: translateZ(0);
}
+
+ p {
+ line-height: 20px;
+ }
.tiled {
width: 5000px;
@@ -30,20 +35,27 @@
function doAfterReload()
{
- if (window.internals)
- document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+ setTimeout(function() {
+ document.getElementById('become-tiled').classList.add('tiled');
+ setTimeout(function() {
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
- delete window.localStorage.stage;
+ delete window.localStorage.stage;
- if (window.testRunner)
- testRunner.notifyDone();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }, 0);
}
function doOnFirstLoad()
{
window.localStorage.stage = 1;
- if (window.internals)
+ if (window.internals) {
+ internals.setFontSmoothingEnabled(true);
internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+ }
// Reload so that the setting affects page tiles.
location.reload();
@@ -69,6 +81,10 @@
Tiled layer
</div>
+<div id="become-tiled" class="composited box">
+ Become-tiled layer
+</div>
+
<pre id="layers"></pre>
</body>
</html>
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-images-expected.txt (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-images-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-images-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,61 @@
+ Image and some text
+Image and some text child layer
+
+Image and some text with z-index
+
+Image and some text child composited
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 7
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 12.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 101.00)
+ (bounds 108.00 60.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-images.html (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-images.html (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-images.html 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 150px;
+ width: 150px;
+ float: left;
+ position: relative;
+ border: 1px solid black;
+ padding: 20px;
+ margin: 10px;
+ box-sizing: border-box;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
+ }
+
+ .box {
+ position: relative;
+ height: 40px;
+ width: 100px;
+ background-color: rgba(0, 0, 128, 0.5);
+ }
+
+ p, div {
+ line-height: 20px;
+ }
+
+ div > div {
+ width: 100%;
+ }
+
+ .composited {
+ will-change: transform;
+ }
+
+ img {
+ width: 95%;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ if (window.internals) {
+ internals.setFontSmoothingEnabled(true);
+ internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+ }
+
+ function doTest()
+ {
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<div class="composited container image">
+ <img src=""
+</div>
+
+<div class="composited container mixed">
+ <img src=""
+ <span>Image and some text</span>
+</div>
+
+<div class="composited container svg-image">
+ <img src=""
+</div>
+
+<div class="composited container text-svg">
+ <img src=""
+</div>
+
+<div class="composited container mixed">
+ <img src=""
+ <div style="position: relative;">Image and some text child layer</div>
+</div>
+
+<div class="composited container mixed">
+ <img src=""
+ <div style="position: relative; z-index: 0">Image and some text with z-index</div>
+</div>
+
+<div class="composited container mixed">
+ <img src=""
+ <div class="composited">Image and some text child composited</div>
+</div>
+
+<pre id="layers"></pre>
+
+</body>
+</html>
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,42 @@
+Visibility hidden ancestor with visible child
+
+
+
+Only visible text is antialiased
+
+This text is antialiased. There is a hidden smoothed child
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 4
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-visibility.html (0 => 213466)
--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-visibility.html (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-visibility.html 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 150px;
+ width: 150px;
+ float: left;
+ position: relative;
+ border: 1px solid black;
+ padding: 20px;
+ margin: 10px;
+ box-sizing: border-box;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
+ }
+
+ .box {
+ position: relative;
+ height: 40px;
+ width: 100px;
+ background-color: rgba(0, 0, 128, 0.5);
+ }
+
+ p {
+ line-height: 20px;
+ }
+
+ .composited {
+ will-change: transform;
+ }
+
+ .antialiased {
+ -webkit-font-smoothing: antialiased;
+ }
+
+ .smoothed {
+ -webkit-font-smoothing: subpixel-antialiased;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ if (window.internals) {
+ internals.setFontSmoothingEnabled(true);
+ internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+ }
+
+ function doTest()
+ {
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<div class="composited container" style="visibility:hidden">
+ This text is hidden.
+ <div style="position: relative; visibility: visible;">
+ <p>Visibility hidden ancestor with visible child</p>
+ </div>
+</div>
+
+<div class="composited container">
+ <div style="position: relative; visibility: hidden;">
+ <p>Hidden child with text</p>
+ </div>
+</div>
+
+<div class="composited container" style="visibility:hidden">
+ <p class="smoothed">This text is hidden.</p>
+ <div style="position: relative; visibility: visible;">
+ <p class="antialiased">Only visible text is antialiased</p>
+ </div>
+</div>
+
+<div class="composited container">
+ <p class="antialiased">This text is antialiased. There is a hidden smoothed child</p>
+ <div style="position: relative; visibility: hidden;">
+ <p class="smoothed">This smoothed text is hidden</p>
+ </div>
+</div>
+
+<pre id="layers"></pre>
+
+</body>
+</html>
Added: trunk/LayoutTests/compositing/resources/circle-with-text.svg (0 => 213466)
--- trunk/LayoutTests/compositing/resources/circle-with-text.svg (rev 0)
+++ trunk/LayoutTests/compositing/resources/circle-with-text.svg 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+ <circle cx="50%" cy="50%" r="80" style="fill:blue;" />
+ <text x="20%" y="50%" fill="white">Here is some text</text>
+</svg>
Added: trunk/LayoutTests/compositing/resources/circle.svg (0 => 213466)
--- trunk/LayoutTests/compositing/resources/circle.svg (rev 0)
+++ trunk/LayoutTests/compositing/resources/circle.svg 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'>
+ <circle cx="50%" cy="50%" r="80" style="fill:blue;" />
+</svg>
Added: trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt (0 => 213466)
--- trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,127 @@
+
+Text here
+
+Antialiased text
+
+Smoothed text
+
+Antialised text
+Smoothed text
+
+Child composited layer
+
+Smoothed text
+
+Antialiased text
+
+Antialiased text
+
+Smoothed text
+
+Exceeds depth test antialiased
+
+Exceeds depth test smoothed
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 12
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 12.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 60.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 12.00 357.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 20.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 182.00 357.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 20.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 352.00 357.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 357.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt (0 => 213466)
--- trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,114 @@
+ Solid background
+Text here
+
+Text here
+
+Negative z-index child
+And more content
+Child layer
+
+Child composited layer
+
+Child composited layer
+
+Text here.
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 11
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 12.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 79.00)
+ (bounds 100.00 40.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 352.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 60.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 12.00 357.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 43.00)
+ (bounds 108.00 60.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 182.00 357.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 357.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Copied: trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt (from rev 213465, trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt) (0 => 213466)
--- trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,48 @@
+Normal layer
+Tiled layer
+Become-tiled layer
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 5018.00 2018.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 5018.00 2018.00)
+ (contentsOpaque 1)
+ (tile cache coverage 0, 0 1024 x 1024)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 2 x 2)
+ (in window 1)
+ (children 3
+ (GraphicsLayer
+ (position 18.00 10.00)
+ (bounds 100.00 100.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 18.00 120.00)
+ (bounds 5000.00 100.00)
+ (usingTiledLayer 1)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 1024 x 100)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 2 x 1)
+ (in window 1)
+ )
+ (GraphicsLayer
+ (position 18.00 230.00)
+ (bounds 5000.00 100.00)
+ (usingTiledLayer 1)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 1024 x 100)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 2 x 1)
+ (in window 1)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-images-expected.txt (0 => 213466)
--- trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-images-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-images-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,67 @@
+ Image and some text
+Image and some text child layer
+
+Image and some text with z-index
+
+Image and some text child composited
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 7
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 12.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 187.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 187.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 27.00 101.00)
+ (bounds 108.00 60.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt (0 => 213466)
--- trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-visibility-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -0,0 +1,43 @@
+Visibility hidden ancestor with visible child
+
+
+
+Only visible text is antialiased
+
+This text is antialiased. There is a hidden smoothed child
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 4
+ (GraphicsLayer
+ (position 12.00 17.00)
+ (bounds 162.00 162.00)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 182.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 352.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 522.00 17.00)
+ (bounds 162.00 162.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Modified: trunk/LayoutTests/platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt (213465 => 213466)
--- trunk/LayoutTests/platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt 2017-03-06 21:45:38 UTC (rev 213466)
@@ -1,5 +1,6 @@
Normal layer
Tiled layer
+Become-tiled layer
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 5018.00 2018.00)
@@ -7,12 +8,10 @@
(GraphicsLayer
(bounds 5018.00 2018.00)
(contentsOpaque 1)
- (supports subpixel antialiased text 1)
- (children 2
+ (children 3
(GraphicsLayer
(position 18.00 10.00)
(bounds 100.00 100.00)
- (contentsOpaque 1)
(supports subpixel antialiased text 1)
(drawsContent 1)
)
@@ -20,7 +19,6 @@
(position 18.00 120.00)
(bounds 5000.00 100.00)
(usingTiledLayer 1)
- (contentsOpaque 1)
(supports subpixel antialiased text 1)
(drawsContent 1)
(tile cache coverage 0, 0 1024 x 100)
@@ -28,6 +26,17 @@
(top left tile 0, 0 tiles grid 2 x 1)
(in window 1)
)
+ (GraphicsLayer
+ (position 18.00 230.00)
+ (bounds 5000.00 100.00)
+ (usingTiledLayer 1)
+ (supports subpixel antialiased text 1)
+ (drawsContent 1)
+ (tile cache coverage 0, 0 1024 x 100)
+ (tile size 512 x 512)
+ (top left tile 0, 0 tiles grid 2 x 1)
+ (in window 1)
+ )
)
)
)
Modified: trunk/Source/WebCore/ChangeLog (213465 => 213466)
--- trunk/Source/WebCore/ChangeLog 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/ChangeLog 2017-03-06 21:45:38 UTC (rev 213466)
@@ -1,3 +1,92 @@
+2017-03-06 Simon Fraser <[email protected]>
+
+ Only use layer backing store which supports subpixel antialiased text if we know subpixel antialiased will be painted into it
+ https://bugs.webkit.org/show_bug.cgi?id=169191
+
+ Reviewed by Zalan Bujtas.
+
+ Instead of unconditionally calling setSupportsSubpixelAntialiasedText() on GraphicsLayers created
+ by RenderLayerBacking, only do so when we know (or suspect) that a layer contains smoothed text.
+
+ This is done by enhancing RenderLayer::isVisuallyNonEmpty() and RenderLayer::hasNonEmptyChildRenderers()
+ to take a PaintedContentRequest parameter, which allows the caller to specify what qualities of
+ the layer contents it is interested in. Most of the time, this is just any painted content, but on
+ platforms where GraphicsLayer::supportsSubpixelAntialiasedLayerText() returns true, the query also
+ asks about whether the layer will contain subpixel-antialiased text. In this case, it can't early
+ return as soon as painted content is found; it must keep iterating renderers while all the query
+ requests are unsatisfied, or until it hits depth or sibling limits. If a limit is hit, we take the
+ same path of assuming there is subpixel-antialiased text (via the "Undetermined" state).
+
+ RenderLayerBacking also makes use of PaintedContentRequest during its non-composited child layer walk.
+
+ To offset the additional cost of this tree walking, RenderLayerBacking now caches information about its
+ painted content for the duration of a single update via PaintedContentsInfo, so we no longer call
+ isDirectlyCompositedImage() and isSimpleContainerCompositingLayer() multiple times per backing per update.
+ The traversal code here too now has to continue until all necessary states in the request have been computed.
+
+ Add some functions to RenderImage so that we know if it's showing the alt text or has a non-bitmap image
+ (which may contain text).
+
+ Subpixel-antialiased ("smoothed") text is disabled by DRT and WTR by default, so we need Internals API to enable it.
+
+ Platforms now express their support for subpixel-antialiased text via GraphicsLayer::supportsSubpixelAntialiasedLayerText()
+ which only returns true on Mac.
+
+ Tests: compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html
+ compositing/contents-format/subpixel-antialiased-text-configs.html
+ compositing/contents-format/subpixel-antialiased-text-images.html
+ compositing/contents-format/subpixel-antialiased-text-visibility.html
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::supportsSubpixelAntialiasedLayerText):
+ * platform/graphics/GraphicsLayer.h:
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayer::supportsSubpixelAntialiasedLayerText):
+ (WebCore::GraphicsLayerCA::changeLayerTypeTo):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::isShowingMissingOrImageError):
+ (WebCore::RenderImage::isShowingAltText):
+ (WebCore::RenderImage::hasNonBitmapImage):
+ * rendering/RenderImage.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::PaintedContentsInfo::PaintedContentsInfo):
+ (WebCore::PaintedContentsInfo::setWantsSubpixelAntialiasedTextState):
+ (WebCore::PaintedContentsInfo::paintsBoxDecorations):
+ (WebCore::PaintedContentsInfo::paintsContent):
+ (WebCore::PaintedContentsInfo::paintsSubpixelAntialiasedText):
+ (WebCore::PaintedContentsInfo::isSimpleContainer):
+ (WebCore::PaintedContentsInfo::isDirectlyCompositedImage):
+ (WebCore::PaintedContentsInfo::paintsBoxDecorationsDetermination):
+ (WebCore::PaintedContentsInfo::paintsContentDetermination):
+ (WebCore::PaintedContentsInfo::paintsSubpixelAntialiasedTextDetermination):
+ (WebCore::PaintedContentsInfo::contentsTypeDetermination):
+ (WebCore::RenderLayerBacking::createGraphicsLayer):
+ (WebCore::RenderLayerBacking::updateConfiguration):
+ (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
+ (WebCore::RenderLayerBacking::updateAfterDescendants):
+ (WebCore::RenderLayerBacking::updateDirectlyCompositedBoxDecorations):
+ (WebCore::RenderLayerBacking::updateDrawsContent):
+ (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):
+ (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage):
+ (WebCore::RenderLayerBacking::paintsContent):
+ (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
+ (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
+ (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
+ (WebCore::RenderLayerBacking::containsPaintedContent):
+ (WebCore::RenderLayerBacking::contentChanged):
+ (WebCore::RenderLayerBacking::updateImageContents):
+ (WebCore::RenderLayerBacking::paintsChildRenderers): Deleted.
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::logLayerInfo):
+ * testing/Internals.cpp:
+ (WebCore::Internals::setFontSmoothingEnabled):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2017-03-06 Myles C. Maxfield <[email protected]>
Expand font-weight and font-stretch to take any number
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (213465 => 213466)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -95,6 +95,11 @@
return false;
#endif
}
+
+bool GraphicsLayer::supportsSubpixelAntialiasedLayerText()
+{
+ return false;
+}
#endif
#if !USE(COORDINATED_GRAPHICS)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (213465 => 213466)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2017-03-06 21:45:38 UTC (rev 213466)
@@ -554,6 +554,7 @@
static bool supportsBackgroundColorContent();
static bool supportsLayerType(Type);
static bool supportsContentsTiling();
+ static bool supportsSubpixelAntialiasedLayerText();
void updateDebugIndicators();
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (213465 => 213466)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -317,6 +317,15 @@
return true;
}
+bool GraphicsLayer::supportsSubpixelAntialiasedLayerText()
+{
+#if PLATFORM(MAC)
+ return true;
+#else
+ return false;
+#endif
+}
+
std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
{
std::unique_ptr<GraphicsLayer> graphicsLayer;
@@ -3616,6 +3625,7 @@
| BackgroundColorChanged
| ContentsScaleChanged
| AcceleratesDrawingChanged
+ | SupportsSubpixelAntialiasedTextChanged
| FiltersChanged
| BackdropFiltersChanged
| MaskLayerChanged
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -349,6 +349,25 @@
}
}
+bool RenderImage::isShowingMissingOrImageError() const
+{
+ return !imageResource().hasImage() || imageResource().errorOccurred();
+}
+
+bool RenderImage::isShowingAltText() const
+{
+ return isShowingMissingOrImageError() && !m_altText.isEmpty();
+}
+
+bool RenderImage::hasNonBitmapImage() const
+{
+ if (!imageResource().hasImage())
+ return false;
+
+ Image* image = cachedImage()->imageForRenderer(this);
+ return image && !is<BitmapImage>(image);
+}
+
void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutSize contentSize = this->contentSize();
Modified: trunk/Source/WebCore/rendering/RenderImage.h (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderImage.h 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderImage.h 2017-03-06 21:45:38 UTC (rev 213466)
@@ -69,7 +69,12 @@
float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
void setHasShadowControls(bool hasShadowControls) { m_hasShadowControls = hasShadowControls; }
+
+ bool isShowingMissingOrImageError() const;
+ bool isShowingAltText() const;
+ bool hasNonBitmapImage() const;
+
protected:
bool needsPreferredWidthsRecalculation() const final;
RenderBox* embeddedContentBox() const final;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -89,6 +89,7 @@
#include "RenderFlexibleBox.h"
#include "RenderFlowThread.h"
#include "RenderGeometryMap.h"
+#include "RenderImage.h"
#include "RenderInline.h"
#include "RenderIterator.h"
#include "RenderLayerBacking.h"
@@ -6579,19 +6580,29 @@
return renderer.hasVisibleBoxDecorations() || renderer.style().hasOutline();
}
+static bool styleHasSmoothingTextMode(const RenderStyle& style)
+{
+ FontSmoothingMode smoothingMode = style.fontDescription().fontSmoothing();
+ return smoothingMode == AutoSmoothing || smoothingMode == SubpixelAntialiased;
+}
+
// Constrain the depth and breadth of the search for performance.
static const int maxDescendentDepth = 3;
static const int maxSiblingCount = 20;
-static bool hasPaintingNonLayerDescendants(const RenderElement& renderer, int depth)
+static void determineNonLayerDescendantsPaintedContent(const RenderElement& renderer, int depth, RenderLayer::PaintedContentRequest& request)
{
- if (depth > maxDescendentDepth)
- return true;
+ if (depth > maxDescendentDepth) {
+ request.makeStatesUndetermined();
+ return;
+ }
int siblingCount = 0;
for (const auto& child : childrenOfType<RenderObject>(renderer)) {
- if (++siblingCount > maxSiblingCount)
- return true;
+ if (++siblingCount > maxSiblingCount) {
+ request.makeStatesUndetermined();
+ return;
+ }
if (is<RenderText>(child)) {
const auto& renderText = downcast<RenderText>(child);
@@ -6599,10 +6610,17 @@
continue;
if (renderer.style().userSelect() != SELECT_NONE)
- return true;
+ request.setHasPaintedContent();
- if (!renderText.text()->containsOnlyWhitespace())
- return true;
+ if (!renderText.text()->containsOnlyWhitespace()) {
+ request.setHasPaintedContent();
+
+ if (request.needToDetermineSubpixelAntialiasedTextState() && styleHasSmoothingTextMode(child.style()))
+ request.setHasSubpixelAntialiasedText();
+ }
+
+ if (request.isSatisfied())
+ return;
}
if (!is<RenderElement>(child))
@@ -6613,22 +6631,36 @@
if (is<RenderLayerModelObject>(renderElementChild) && downcast<RenderLayerModelObject>(renderElementChild).hasSelfPaintingLayer())
continue;
- if (hasVisibleBoxDecorationsOrBackground(renderElementChild))
- return true;
+ if (hasVisibleBoxDecorationsOrBackground(renderElementChild)) {
+ request.setHasPaintedContent();
+ if (request.isSatisfied())
+ return;
+ }
- if (is<RenderReplaced>(renderElementChild))
- return true;
+ if (is<RenderReplaced>(renderElementChild)) {
+ request.setHasPaintedContent();
- if (hasPaintingNonLayerDescendants(renderElementChild, depth + 1))
- return true;
+ if (is<RenderImage>(renderElementChild) && request.needToDetermineSubpixelAntialiasedTextState()) {
+ auto& imageRenderer = downcast<RenderImage>(renderElementChild);
+ // May draw text if showing alt text, or image is an SVG image or PDF image.
+ if ((imageRenderer.isShowingAltText() || imageRenderer.hasNonBitmapImage()) && styleHasSmoothingTextMode(child.style()))
+ request.setHasSubpixelAntialiasedText();
+ }
+
+ if (request.isSatisfied())
+ return;
+ }
+
+ determineNonLayerDescendantsPaintedContent(renderElementChild, depth + 1, request);
+ if (request.isSatisfied())
+ return;
}
-
- return false;
}
-bool RenderLayer::hasNonEmptyChildRenderers() const
+bool RenderLayer::hasNonEmptyChildRenderers(PaintedContentRequest& request) const
{
- return hasPaintingNonLayerDescendants(renderer(), 0);
+ determineNonLayerDescendantsPaintedContent(renderer(), 0, request);
+ return request.probablyHasPaintedContent();
}
bool RenderLayer::hasVisibleBoxDecorationsOrBackground() const
@@ -6644,7 +6676,7 @@
return hasVisibleBoxDecorationsOrBackground() || hasOverflowControls();
}
-bool RenderLayer::isVisuallyNonEmpty() const
+bool RenderLayer::isVisuallyNonEmpty(PaintedContentRequest* request) const
{
ASSERT(!m_visibleDescendantStatusDirty);
@@ -6651,16 +6683,22 @@
if (!hasVisibleContent() || !renderer().style().opacity())
return false;
- if (renderer().isRenderReplaced() || hasOverflowControls())
+ if (renderer().isRenderReplaced() || hasOverflowControls()) {
+ if (request)
+ request->setHasPaintedContent();
return true;
+ }
- if (hasVisibleBoxDecorationsOrBackground())
+ if (hasVisibleBoxDecorationsOrBackground()) {
+ if (request)
+ request->setHasPaintedContent();
return true;
+ }
- if (hasNonEmptyChildRenderers())
- return true;
-
- return false;
+ PaintedContentRequest localRequest;
+ if (!request)
+ request = &localRequest;
+ return hasNonEmptyChildRenderers(*request);
}
void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle)
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2017-03-06 21:45:38 UTC (rev 213466)
@@ -109,6 +109,14 @@
};
typedef unsigned LayerScrollCoordinationRoles;
+enum class RequestState {
+ Unknown,
+ DontCare,
+ False,
+ True,
+ Undetermined
+};
+
class RenderLayer final : public ScrollableArea {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -388,10 +396,36 @@
bool hasVisibleBoxDecorationsOrBackground() const;
bool hasVisibleBoxDecorations() const;
+
+ struct PaintedContentRequest {
+ void makeStatesUndetermined()
+ {
+ if (hasPaintedContent == RequestState::Unknown)
+ hasPaintedContent = RequestState::Undetermined;
+
+ if (hasSubpixelAntialiasedText == RequestState::Unknown)
+ hasSubpixelAntialiasedText = RequestState::Undetermined;
+ }
+
+ void setHasPaintedContent() { hasPaintedContent = RequestState::True; }
+ void setHasSubpixelAntialiasedText() { hasSubpixelAntialiasedText = RequestState::True; }
+
+ bool needToDeterminePaintedContentState() const { return hasPaintedContent == RequestState::Unknown; }
+ bool needToDetermineSubpixelAntialiasedTextState() const { return hasSubpixelAntialiasedText == RequestState::Unknown; }
+
+ bool probablyHasPaintedContent() const { return hasPaintedContent == RequestState::True || hasPaintedContent == RequestState::Undetermined; }
+ bool probablyHasSubpixelAntialiasedText() const { return hasSubpixelAntialiasedText == RequestState::True || hasSubpixelAntialiasedText == RequestState::Undetermined; }
+
+ bool isSatisfied() const { return hasPaintedContent != RequestState::Unknown && hasSubpixelAntialiasedText != RequestState::Unknown; }
+
+ RequestState hasPaintedContent { RequestState::Unknown };
+ RequestState hasSubpixelAntialiasedText { RequestState::DontCare };
+ };
+
// Returns true if this layer has visible content (ignoring any child layers).
- bool isVisuallyNonEmpty() const;
+ bool isVisuallyNonEmpty(PaintedContentRequest* = nullptr) const;
// True if this layer container renderers that paint.
- bool hasNonEmptyChildRenderers() const;
+ bool hasNonEmptyChildRenderers(PaintedContentRequest&) const;
// FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above.
// Part of the issue is with subtree relayout: we don't check if our ancestors have some descendant flags dirty, missing some updates.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -91,6 +91,118 @@
#endif
}
+// This acts as a cache of what we know about what is painting into this RenderLayerBacking.
+class PaintedContentsInfo {
+public:
+ enum class ContentsTypeDetermination {
+ Unknown,
+ SimpleContainer,
+ DirectlyCompositedImage,
+ Painted
+ };
+
+ PaintedContentsInfo(RenderLayerBacking& inBacking)
+ : m_backing(inBacking)
+ {
+ }
+
+ void setWantsSubpixelAntialiasedTextState(bool wantsSubpixelAntialiasedTextState)
+ {
+ m_subpixelAntialiasedText = wantsSubpixelAntialiasedTextState ? RequestState::Unknown : RequestState::DontCare;
+ }
+
+ RequestState paintsBoxDecorationsDetermination();
+ bool paintsBoxDecorations()
+ {
+ RequestState state = paintsBoxDecorationsDetermination();
+ return state == RequestState::True || state == RequestState::Undetermined;
+ }
+
+ RequestState paintsContentDetermination();
+ bool paintsContent()
+ {
+ RequestState state = paintsContentDetermination();
+ return state == RequestState::True || state == RequestState::Undetermined;
+ }
+
+ RequestState paintsSubpixelAntialiasedTextDetermination();
+ bool paintsSubpixelAntialiasedText()
+ {
+ RequestState state = paintsSubpixelAntialiasedTextDetermination();
+ return state == RequestState::True || state == RequestState::Undetermined;
+ }
+
+ ContentsTypeDetermination contentsTypeDetermination();
+ bool isSimpleContainer()
+ {
+ return contentsTypeDetermination() == ContentsTypeDetermination::SimpleContainer;
+ }
+
+ bool isDirectlyCompositedImage()
+ {
+ return contentsTypeDetermination() == ContentsTypeDetermination::DirectlyCompositedImage;
+ }
+
+ RenderLayerBacking& m_backing;
+ RequestState m_boxDecorations { RequestState::Unknown };
+ RequestState m_content { RequestState::Unknown };
+ RequestState m_subpixelAntialiasedText { RequestState::DontCare };
+
+ ContentsTypeDetermination m_contentsType { ContentsTypeDetermination::Unknown };
+};
+
+RequestState PaintedContentsInfo::paintsBoxDecorationsDetermination()
+{
+ if (m_boxDecorations != RequestState::Unknown)
+ return m_boxDecorations;
+
+ m_boxDecorations = m_backing.paintsBoxDecorations() ? RequestState::True : RequestState::False;
+ return m_boxDecorations;
+}
+
+RequestState PaintedContentsInfo::paintsContentDetermination()
+{
+ if (m_content != RequestState::Unknown && m_subpixelAntialiasedText != RequestState::Unknown)
+ return m_content;
+
+ RenderLayer::PaintedContentRequest contentRequest;
+ if (m_subpixelAntialiasedText == RequestState::Unknown)
+ contentRequest.hasSubpixelAntialiasedText = RequestState::Unknown;
+
+ m_content = m_backing.paintsContent(contentRequest) ? RequestState::True : RequestState::False;
+
+ if (m_subpixelAntialiasedText == RequestState::Unknown)
+ m_subpixelAntialiasedText = contentRequest.hasSubpixelAntialiasedText;
+
+ return m_content;
+}
+
+RequestState PaintedContentsInfo::paintsSubpixelAntialiasedTextDetermination()
+{
+ if (m_subpixelAntialiasedText != RequestState::Unknown)
+ return m_subpixelAntialiasedText;
+
+ paintsContentDetermination();
+
+ return m_subpixelAntialiasedText;
+}
+
+PaintedContentsInfo::ContentsTypeDetermination PaintedContentsInfo::contentsTypeDetermination()
+{
+ if (m_contentsType != ContentsTypeDetermination::Unknown)
+ return m_contentsType;
+
+ if (m_backing.isSimpleContainerCompositingLayer(*this))
+ m_contentsType = ContentsTypeDetermination::SimpleContainer;
+ else if (m_backing.isDirectlyCompositedImage())
+ m_contentsType = ContentsTypeDetermination::DirectlyCompositedImage;
+ else
+ m_contentsType = ContentsTypeDetermination::Painted;
+
+ return m_contentsType;
+}
+
+
RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
: m_owningLayer(layer)
{
@@ -142,7 +254,6 @@
#if PLATFORM(COCOA) && USE(CA)
graphicsLayer->setAcceleratesDrawing(compositor().acceleratedDrawingEnabled());
graphicsLayer->setUsesDisplayListDrawing(compositor().displayListDrawingEnabled());
- graphicsLayer->setSupportsSubpixelAntialiasedText(renderer().settings().subpixelAntialiasedLayerTextEnabled());
#endif
return graphicsLayer;
@@ -609,15 +720,16 @@
} else
m_graphicsLayer->setReplicatedByLayer(nullptr);
+ PaintedContentsInfo contentsInfo(*this);
+
if (!m_owningLayer.isRootLayer()) {
- bool isSimpleContainer = isSimpleContainerCompositingLayer();
bool didUpdateContentsRect = false;
- updateDirectlyCompositedBoxDecorations(isSimpleContainer, didUpdateContentsRect);
+ updateDirectlyCompositedBoxDecorations(contentsInfo, didUpdateContentsRect);
} else
updateRootLayerConfiguration();
- if (isDirectlyCompositedImage())
- updateImageContents();
+ if (contentsInfo.isDirectlyCompositedImage())
+ updateImageContents(contentsInfo);
if (is<RenderEmbeddedObject>(renderer()) && downcast<RenderEmbeddedObject>(renderer()).allowsAcceleratedCompositing()) {
PluginViewBase* pluginViewBase = downcast<PluginViewBase>(downcast<RenderWidget>(renderer()).widget());
@@ -784,7 +896,7 @@
auto* ancestorBackingLayer = compositedAncestor->backing();
LayoutRect parentGraphicsLayerRect;
if (m_owningLayer.isInsideFlowThread()) {
- /// FIXME: flows/columns need work.
+ // FIXME: flows/columns need work.
LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds();
ancestorCompositedBounds.setLocation(LayoutPoint());
adjustAncestorCompositingBoundsForFlowThread(ancestorCompositedBounds, compositedAncestor);
@@ -1092,17 +1204,18 @@
void RenderLayerBacking::updateAfterDescendants()
{
- bool isSimpleContainer = false;
+ // FIXME: this potentially duplicates work we did in updateConfiguration().
+ PaintedContentsInfo contentsInfo(*this);
+ contentsInfo.setWantsSubpixelAntialiasedTextState(GraphicsLayer::supportsSubpixelAntialiasedLayerText());
+
if (!m_owningLayer.isRootLayer()) {
bool didUpdateContentsRect = false;
- // FIXME: this duplicates work we did in updateConfiguration().
- isSimpleContainer = isSimpleContainerCompositingLayer();
- updateDirectlyCompositedBoxDecorations(isSimpleContainer, didUpdateContentsRect);
+ updateDirectlyCompositedBoxDecorations(contentsInfo, didUpdateContentsRect);
if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
resetContentsRect();
}
- updateDrawsContent(isSimpleContainer);
+ updateDrawsContent(contentsInfo);
m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || hasVisibleNonCompositedDescendants());
if (m_scrollingLayer) {
@@ -1181,7 +1294,7 @@
}
}
-void RenderLayerBacking::updateDirectlyCompositedBoxDecorations(bool isSimpleContainer, bool& didUpdateContentsRect)
+void RenderLayerBacking::updateDirectlyCompositedBoxDecorations(PaintedContentsInfo& contentsInfo, bool& didUpdateContentsRect)
{
if (!m_owningLayer.hasVisibleContent())
return;
@@ -1188,8 +1301,8 @@
// The order of operations here matters, since the last valid type of contents needs
// to also update the contentsRect.
- updateDirectlyCompositedBackgroundColor(isSimpleContainer, didUpdateContentsRect);
- updateDirectlyCompositedBackgroundImage(isSimpleContainer, didUpdateContentsRect);
+ updateDirectlyCompositedBackgroundColor(contentsInfo, didUpdateContentsRect);
+ updateDirectlyCompositedBackgroundImage(contentsInfo, didUpdateContentsRect);
}
void RenderLayerBacking::updateInternalHierarchy()
@@ -1258,10 +1371,13 @@
void RenderLayerBacking::updateDrawsContent()
{
- updateDrawsContent(isSimpleContainerCompositingLayer());
+ PaintedContentsInfo contentsInfo(*this);
+ contentsInfo.setWantsSubpixelAntialiasedTextState(GraphicsLayer::supportsSubpixelAntialiasedLayerText());
+
+ updateDrawsContent(contentsInfo);
}
-void RenderLayerBacking::updateDrawsContent(bool isSimpleContainer)
+void RenderLayerBacking::updateDrawsContent(PaintedContentsInfo& contentsInfo)
{
if (m_scrollingLayer) {
// We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
@@ -1271,17 +1387,25 @@
bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() && m_owningLayer.hasVisibleBoxDecorationsOrBackground();
m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
- bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && (renderer().hasBackground() || paintsChildRenderers());
+ bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && (renderer().hasBackground() || contentsInfo.paintsContent());
m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent);
return;
}
- bool hasPaintedContent = containsPaintedContent(isSimpleContainer);
+ bool hasPaintedContent = containsPaintedContent(contentsInfo);
+ m_paintsSubpixelAntialiasedText = renderer().settings().subpixelAntialiasedLayerTextEnabled() && contentsInfo.paintsSubpixelAntialiasedText();
+
// FIXME: we could refine this to only allocate backing for one of these layers if possible.
m_graphicsLayer->setDrawsContent(hasPaintedContent);
- if (m_foregroundLayer)
+ if (m_foregroundLayer) {
m_foregroundLayer->setDrawsContent(hasPaintedContent);
+ m_foregroundLayer->setSupportsSubpixelAntialiasedText(m_paintsSubpixelAntialiasedText);
+ // The text content is painted into the foreground layer.
+ // FIXME: this ignores SVG background images which may contain text.
+ m_graphicsLayer->setSupportsSubpixelAntialiasedText(false);
+ } else
+ m_graphicsLayer->setSupportsSubpixelAntialiasedText(m_paintsSubpixelAntialiasedText);
if (m_backgroundLayer)
m_backgroundLayer->setDrawsContent(hasPaintedContent);
@@ -1770,9 +1894,9 @@
return backgroundRenderer->style().visitedDependentColor(CSSPropertyBackgroundColor);
}
-void RenderLayerBacking::updateDirectlyCompositedBackgroundColor(bool isSimpleContainer, bool& didUpdateContentsRect)
+void RenderLayerBacking::updateDirectlyCompositedBackgroundColor(PaintedContentsInfo& contentsInfo, bool& didUpdateContentsRect)
{
- if (!isSimpleContainer || (is<RenderBox>(renderer()) && !downcast<RenderBox>(renderer()).paintsOwnBackground())) {
+ if (!contentsInfo.isSimpleContainer() || (is<RenderBox>(renderer()) && !downcast<RenderBox>(renderer()).paintsOwnBackground())) {
m_graphicsLayer->setContentsToSolidColor(Color());
return;
}
@@ -1787,16 +1911,16 @@
didUpdateContentsRect = true;
}
-void RenderLayerBacking::updateDirectlyCompositedBackgroundImage(bool isSimpleContainer, bool& didUpdateContentsRect)
+void RenderLayerBacking::updateDirectlyCompositedBackgroundImage(PaintedContentsInfo& contentsInfo, bool& didUpdateContentsRect)
{
if (!GraphicsLayer::supportsContentsTiling())
return;
- if (isDirectlyCompositedImage())
+ if (contentsInfo.isDirectlyCompositedImage())
return;
auto& style = renderer().style();
- if (!isSimpleContainer || !style.hasBackgroundImage()) {
+ if (!contentsInfo.isSimpleContainer() || !style.hasBackgroundImage()) {
m_graphicsLayer->setContentsToImage(0);
return;
}
@@ -1871,15 +1995,29 @@
return !supportsDirectlyCompositedBoxDecorations(renderer());
}
-bool RenderLayerBacking::paintsChildRenderers() const
+bool RenderLayerBacking::paintsContent(RenderLayer::PaintedContentRequest& request) const
{
- if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildRenderers())
- return true;
+ bool paintsContent = false;
- if (isPaintDestinationForDescendantLayers())
- return true;
+ if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildRenderers(request))
+ paintsContent = true;
- return false;
+ if (request.isSatisfied())
+ return paintsContent;
+
+ if (isPaintDestinationForDescendantLayers(request))
+ paintsContent = true;
+
+ if (request.isSatisfied())
+ return paintsContent;
+
+ if (request.hasPaintedContent == RequestState::Unknown)
+ request.hasPaintedContent = RequestState::False;
+
+ if (request.hasSubpixelAntialiasedText == RequestState::Unknown)
+ request.hasSubpixelAntialiasedText = RequestState::False;
+
+ return paintsContent;
}
static bool isRestartedPlugin(RenderObject& renderer)
@@ -1902,7 +2040,7 @@
// A "simple container layer" is a RenderLayer which has no visible content to render.
// It may have no children, or all its children may be themselves composited.
// This is a useful optimization, because it allows us to avoid allocating backing store.
-bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
+bool RenderLayerBacking::isSimpleContainerCompositingLayer(PaintedContentsInfo& contentsInfo) const
{
if (renderer().isRenderReplaced() && (!isCompositedPlugin(renderer()) || isRestartedPlugin(renderer())))
return false;
@@ -1910,7 +2048,7 @@
if (renderer().isTextControl())
return false;
- if (paintsBoxDecorations() || paintsChildRenderers())
+ if (contentsInfo.paintsBoxDecorations() || contentsInfo.paintsContent())
return false;
if (renderer().style().backgroundClip() == TextFillBox)
@@ -1948,6 +2086,7 @@
return true;
}
+// Returning true stops the traversal.
enum class LayerTraversal { Continue, Stop };
static LayerTraversal traverseVisibleNonCompositedDescendantLayers(RenderLayer& parent, std::function<LayerTraversal (const RenderLayer&)> layerFunc)
@@ -2008,12 +2147,12 @@
}
// Conservative test for having no rendered children.
-bool RenderLayerBacking::isPaintDestinationForDescendantLayers() const
+bool RenderLayerBacking::isPaintDestinationForDescendantLayers(RenderLayer::PaintedContentRequest& request) const
{
bool hasPaintingDescendant = false;
- traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasPaintingDescendant](const RenderLayer& layer) {
- hasPaintingDescendant = layer.isVisuallyNonEmpty();
- return hasPaintingDescendant ? LayerTraversal::Stop : LayerTraversal::Continue;
+ traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasPaintingDescendant, &request](const RenderLayer& layer) {
+ hasPaintingDescendant |= layer.isVisuallyNonEmpty(&request);
+ return (hasPaintingDescendant && request.isSatisfied()) ? LayerTraversal::Stop : LayerTraversal::Continue;
});
return hasPaintingDescendant;
@@ -2023,7 +2162,7 @@
{
bool hasVisibleDescendant = false;
traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasVisibleDescendant](const RenderLayer& layer) {
- hasVisibleDescendant = layer.hasVisibleContent();
+ hasVisibleDescendant |= layer.hasVisibleContent();
return hasVisibleDescendant ? LayerTraversal::Stop : LayerTraversal::Continue;
});
@@ -2030,12 +2169,12 @@
return hasVisibleDescendant;
}
-bool RenderLayerBacking::containsPaintedContent(bool isSimpleContainer) const
+bool RenderLayerBacking::containsPaintedContent(PaintedContentsInfo& contentsInfo) const
{
- if (isSimpleContainer || paintsIntoWindow() || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer.isReflection())
+ if (contentsInfo.isSimpleContainer() || paintsIntoWindow() || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer.isReflection())
return false;
- if (isDirectlyCompositedImage())
+ if (contentsInfo.isDirectlyCompositedImage())
return false;
// FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
@@ -2085,8 +2224,9 @@
void RenderLayerBacking::contentChanged(ContentChangeType changeType)
{
- if ((changeType == ImageChanged) && isDirectlyCompositedImage()) {
- updateImageContents();
+ PaintedContentsInfo contentsInfo(*this);
+ if ((changeType == ImageChanged) && contentsInfo.isDirectlyCompositedImage()) {
+ updateImageContents(contentsInfo);
return;
}
@@ -2107,7 +2247,7 @@
#endif
}
-void RenderLayerBacking::updateImageContents()
+void RenderLayerBacking::updateImageContents(PaintedContentsInfo& contentsInfo)
{
auto& imageRenderer = downcast<RenderImage>(renderer());
@@ -2132,9 +2272,9 @@
m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
m_graphicsLayer->setContentsToImage(image);
- bool isSimpleContainer = false;
- updateDrawsContent(isSimpleContainer);
+ updateDrawsContent(contentsInfo);
+
// Image animation is "lazy", in that it automatically stops unless someone is drawing
// the image. So we have to kick the animation each time; this has the downside that the
// image will keep animating, even if its layer is not visible.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2017-03-06 21:45:38 UTC (rev 213466)
@@ -35,6 +35,7 @@
namespace WebCore {
class KeyframeList;
+class PaintedContentsInfo;
class RenderLayerCompositor;
class TiledBacking;
class TransformationMatrix;
@@ -188,6 +189,7 @@
void setTiledBackingHasMargins(bool hasExtendedBackgroundOnLeftAndRight, bool hasExtendedBackgroundOnTopAndBottom);
void updateDebugIndicators(bool showBorder, bool showRepaintCounter);
+ bool paintsSubpixelAntialiasedText() const { return m_paintsSubpixelAntialiasedText; }
// GraphicsLayerClient interface
void tiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/) override;
@@ -251,6 +253,8 @@
WEBCORE_EXPORT String replayDisplayListAsText(DisplayList::AsTextFlags) const;
private:
+ friend class PaintedContentsInfo;
+
FloatRect backgroundBoxForSimpleContainerPainting() const;
void createPrimaryGraphicsLayer();
@@ -277,7 +281,7 @@
bool requiresVerticalScrollbarLayer() const;
bool requiresScrollCornerLayer() const;
bool updateScrollingLayers(bool scrollingLayers);
- void updateDrawsContent(bool isSimpleContainer);
+
void updateChildClippingStrategy(bool needsDescendantsClippingLayer);
void updateMaskingLayerGeometry();
@@ -306,29 +310,30 @@
// Return the opacity value that this layer should use for compositing.
float compositingOpacity(float rendererOpacity) const;
-
+ Color rendererBackgroundColor() const;
+
bool isMainFrameRenderViewLayer() const;
bool paintsBoxDecorations() const;
- bool paintsChildRenderers() const;
+ bool paintsContent(RenderLayer::PaintedContentRequest&) const;
+ void updateDrawsContent(PaintedContentsInfo&);
+
// Returns true if this compositing layer has no visible content.
- bool isSimpleContainerCompositingLayer() const;
+ bool isSimpleContainerCompositingLayer(PaintedContentsInfo&) const;
// Returns true if this layer has content that needs to be rendered by painting into the backing store.
- bool containsPaintedContent(bool isSimpleContainer) const;
+ bool containsPaintedContent(PaintedContentsInfo&) const;
// Returns true if the RenderLayer just contains an image that we can composite directly.
bool isDirectlyCompositedImage() const;
- void updateImageContents();
+ void updateImageContents(PaintedContentsInfo&);
- Color rendererBackgroundColor() const;
+ void updateDirectlyCompositedBoxDecorations(PaintedContentsInfo&, bool& didUpdateContentsRect);
+ void updateDirectlyCompositedBackgroundColor(PaintedContentsInfo&, bool& didUpdateContentsRect);
+ void updateDirectlyCompositedBackgroundImage(PaintedContentsInfo&, bool& didUpdateContentsRect);
- void updateDirectlyCompositedBoxDecorations(bool isSimpleContainer, bool& didUpdateContentsRect);
- void updateDirectlyCompositedBackgroundColor(bool isSimpleContainer, bool& didUpdateContentsRect);
- void updateDirectlyCompositedBackgroundImage(bool isSimpleContainer, bool& didUpdateContentsRect);
-
void resetContentsRect();
- bool isPaintDestinationForDescendantLayers() const;
+ bool isPaintDestinationForDescendantLayers(RenderLayer::PaintedContentRequest&) const;
bool hasVisibleNonCompositedDescendants() const;
bool shouldClipCompositedBounds() const;
@@ -382,6 +387,7 @@
bool m_canCompositeBackdropFilters { false };
#endif
bool m_backgroundLayerPaintsFixedRootBackground { false };
+ bool m_paintsSubpixelAntialiasedText { false }; // This is for logging only.
};
enum CanvasCompositingStrategy {
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (213465 => 213466)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -841,6 +841,12 @@
else
logString.appendLiteral("background");
}
+
+ if (backing->paintsSubpixelAntialiasedText()) {
+ if (prependSpace)
+ logString.appendLiteral(", ");
+ logString.appendLiteral("texty");
+ }
logString.appendLiteral("] ");
}
Modified: trunk/Source/WebCore/testing/Internals.cpp (213465 => 213466)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-03-06 21:45:38 UTC (rev 213466)
@@ -1348,6 +1348,11 @@
FontCache::singleton().invalidate();
}
+void Internals::setFontSmoothingEnabled(bool enabled)
+{
+ WebCore::FontCascade::setShouldUseSmoothing(enabled);
+}
+
ExceptionOr<void> Internals::setLowPowerModeEnabled(bool isEnabled)
{
auto* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (213465 => 213466)
--- trunk/Source/WebCore/testing/Internals.h 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/testing/Internals.h 2017-03-06 21:45:38 UTC (rev 213466)
@@ -176,6 +176,8 @@
ExceptionOr<void> setMarkedTextMatchesAreHighlighted(bool);
void invalidateFontCache();
+ void setFontSmoothingEnabled(bool);
+
ExceptionOr<void> setLowPowerModeEnabled(bool);
ExceptionOr<void> setScrollViewPosition(int x, int y);
Modified: trunk/Source/WebCore/testing/Internals.idl (213465 => 213466)
--- trunk/Source/WebCore/testing/Internals.idl 2017-03-06 21:44:20 UTC (rev 213465)
+++ trunk/Source/WebCore/testing/Internals.idl 2017-03-06 21:45:38 UTC (rev 213466)
@@ -160,6 +160,7 @@
[MayThrowException] void setMarkedTextMatchesAreHighlighted(boolean flag);
void invalidateFontCache();
+ void setFontSmoothingEnabled(boolean enabled);
[MayThrowException] void setScrollViewPosition(long x, long y);