Title: [239591] trunk
Revision
239591
Author
[email protected]
Date
2019-01-03 08:03:06 -0800 (Thu, 03 Jan 2019)

Log Message

REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later
https://bugs.webkit.org/show_bug.cgi?id=193095
<rdar://problem/47014944>

Reviewed by Zalan Bujtas.

Source/WebCore:

In r239306 we stopped making CALayers for font-smoothed text when not necessary on macOS Mojave
and later. However, we still turned off smoothing for non-opaque layers (setShouldSmoothFonts(false)),
which continues to affect the appearance of text.

Fix by only calling setShouldSmoothFonts(false) when the OS supports font smoothing.

Test: compositing/contents-format/subpixel-antialiased-text.html

* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayer::drawLayerContents):

LayoutTests:

A ref test that compares the rendering of layer and non-layer text with smoothing and antialiasing.

* compositing/contents-format/subpixel-antialiased-text-expected.html: Added.
* compositing/contents-format/subpixel-antialiased-text.html: Added.
* platform/mac/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239590 => 239591)


--- trunk/LayoutTests/ChangeLog	2019-01-03 15:38:33 UTC (rev 239590)
+++ trunk/LayoutTests/ChangeLog	2019-01-03 16:03:06 UTC (rev 239591)
@@ -1,3 +1,17 @@
+2019-01-02  Simon Fraser  <[email protected]>
+
+        REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later
+        https://bugs.webkit.org/show_bug.cgi?id=193095
+        <rdar://problem/47014944>
+
+        Reviewed by Zalan Bujtas.
+        
+        A ref test that compares the rendering of layer and non-layer text with smoothing and antialiasing.
+
+        * compositing/contents-format/subpixel-antialiased-text-expected.html: Added.
+        * compositing/contents-format/subpixel-antialiased-text.html: Added.
+        * platform/mac/TestExpectations:
+
 2019-01-03  Wenson Hsieh  <[email protected]>
 
         [iOS] REGRESSION (r239441): Tab cycling to offscreen <select> may not scroll it into view

Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-expected.html (0 => 239591)


--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-expected.html	2019-01-03 16:03:06 UTC (rev 239591)
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            display: inline-block;
+            height: 100px;
+            width: 220px;
+            padding: 5px;
+            margin: 10px;
+            border: 1px solid black;
+            box-sizing: border-box;
+            font-family: monospace;
+        }
+
+        .antialiased {
+            -webkit-font-smoothing: antialiased;
+        }
+
+        .smoothed {
+            -webkit-font-smoothing: subpixel-antialiased;
+        }
+    </style>
+    <script>
+        if (window.internals) {
+            internals.setFontSmoothingEnabled(true);
+            internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+        }
+    </script>
+</head>
+<body>
+
+<h2>Composited vs. non-composited</h2>
+<section>
+<div class="container">
+    This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+</div>
+
+<div class="container">
+    This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+</div>
+</section>
+
+<h2>Non-composited: antialiased vs. smoothed</h2>
+
+<section>
+    <div class="container antialiased">
+        This text should look visibly thinner.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+
+    <div class="container smoothed">
+        This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+</section>
+
+<h2>Composited: antialiased vs. smoothed</h2>
+
+<section>
+    <div class="container antialiased">
+        This text should look visibly thinner.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+
+    <div class="container smoothed">
+        This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+</section>
+
+
+</body>
+</html>

Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text.html (0 => 239591)


--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text.html	2019-01-03 16:03:06 UTC (rev 239591)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            display: inline-block;
+            height: 100px;
+            width: 220px;
+            padding: 5px;
+            margin: 10px;
+            border: 1px solid black;
+            box-sizing: border-box;
+            font-family: monospace;
+        }
+
+        .composited {
+            will-change: transform;
+        }
+
+        .antialiased {
+            -webkit-font-smoothing: antialiased;
+        }
+
+        .smoothed {
+            -webkit-font-smoothing: subpixel-antialiased;
+        }
+    </style>
+    <script>
+        if (window.internals) {
+            internals.setFontSmoothingEnabled(true);
+            internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+        }
+    </script>
+</head>
+<body>
+
+<h2>Composited vs. non-composited</h2>
+<section>
+<div class="container">
+    This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+</div>
+
+<div class="composited container">
+    This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+</div>
+</section>
+
+<h2>Non-composited: antialiased vs. smoothed</h2>
+
+<section>
+    <div class="container antialiased">
+        This text should look visibly thinner.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+
+    <div class="container smoothed">
+        This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+</section>
+
+<h2>Composited: antialiased vs. smoothed</h2>
+
+<section>
+    <div class="container composited antialiased">
+        This text should look visibly thinner.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+
+    <div class="container composited smoothed">
+        This text should have the normal appearance.<br> a b c d e f g h i j k l m n o p q r s t u v w x y z
+    </div>
+</section>
+
+
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (239590 => 239591)


--- trunk/LayoutTests/platform/mac/TestExpectations	2019-01-03 15:38:33 UTC (rev 239590)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2019-01-03 16:03:06 UTC (rev 239591)
@@ -1752,6 +1752,9 @@
 [ Mojave+ ] imported/blink/fast/text/international/text-shaping-arabic.html [ ImageOnlyFailure ]
 [ Mojave+ ] imported/blink/fast/text/international/vertical-positioning-with-combining-marks.html [ ImageOnlyFailure ]
 
+# < Mojave uses font smoothing.
+[ Sierra HighSierra ] compositing/contents-format/subpixel-antialiased-text.html [ ImageOnlyFailure ]
+
 # < Mojave doesn't support the CG needed for Conic Gradients
 [ Mojave+ ] http/wpt/css/css-images-4/conic-gradient-parsing.html [ Pass ]
 [ Mojave+ ] fast/gradients/conic-repeating.html [ Pass ]
@@ -1813,4 +1816,4 @@
 webkit.org/b/192956 [ Sierra ] webgpu/webgpu-basics.html [ Skip ]
 webkit.org/b/192956 [ Sierra ] webgpu/webgpu-enabled.html [ Skip ]
 webkit.org/b/192956 [ Sierra ] webgpu/simple-triangle-strip.html [ Skip ]
-webkit.org/b/192956 [ Sierra ] webgpu/vertex-buffer-triangle-strip.html [ Skip ]
\ No newline at end of file
+webkit.org/b/192956 [ Sierra ] webgpu/vertex-buffer-triangle-strip.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (239590 => 239591)


--- trunk/Source/WebCore/ChangeLog	2019-01-03 15:38:33 UTC (rev 239590)
+++ trunk/Source/WebCore/ChangeLog	2019-01-03 16:03:06 UTC (rev 239591)
@@ -1,3 +1,22 @@
+2019-01-02  Simon Fraser  <[email protected]>
+
+        REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later
+        https://bugs.webkit.org/show_bug.cgi?id=193095
+        <rdar://problem/47014944>
+
+        Reviewed by Zalan Bujtas.
+        
+        In r239306 we stopped making CALayers for font-smoothed text when not necessary on macOS Mojave
+        and later. However, we still turned off smoothing for non-opaque layers (setShouldSmoothFonts(false)),
+        which continues to affect the appearance of text.
+        
+        Fix by only calling setShouldSmoothFonts(false) when the OS supports font smoothing.
+
+        Test: compositing/contents-format/subpixel-antialiased-text.html
+
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (WebCore::PlatformCALayer::drawLayerContents):
+
 2019-01-02  David Kilzer  <[email protected]>
 
         Leak of CMSampleBuffer (752 bytes) in com.apple.WebKit.WebContent running WebKit layout tests

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (239590 => 239591)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2019-01-03 15:38:33 UTC (rev 239590)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2019-01-03 16:03:06 UTC (rev 239591)
@@ -1184,7 +1184,7 @@
         graphicsContext.setIsCALayerContext(true);
         graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing());
         
-        if (!layerContents->platformCALayerContentsOpaque() && !platformCALayer->supportsSubpixelAntialiasedText()) {
+        if (!layerContents->platformCALayerContentsOpaque() && !platformCALayer->supportsSubpixelAntialiasedText() && FontCascade::isSubpixelAntialiasingAvailable()) {
             // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
             graphicsContext.setShouldSmoothFonts(false);
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to