Title: [212776] trunk
Revision
212776
Author
[email protected]
Date
2017-02-21 16:30:32 -0800 (Tue, 21 Feb 2017)

Log Message

Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
https://bugs.webkit.org/show_bug.cgi?id=168620
<rdar://problem/30617772>

Reviewed by Tim Horton.
Source/WebCore:

Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
PlatformCALayer, where it ultimately affects the layer contents format.

TileControllers are slightly special because we communicate with them via an Obj-C
WebTiledBackingLayer.

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

* page/Settings.in:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
(WebCore::GraphicsLayer::dumpProperties):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::supportsSubpixelAntialiasedText):
(WebCore::GraphicsLayer::setSupportsSubpixelAntialiasedText):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setSupportsSubpixelAntialiasedText):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateSupportsSubpixelAntialiasedText):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator):
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setWantsDeepColorBackingStore):
(WebCore::TileController::setSupportsSubpixelAntialiasedText):
(WebCore::TileController::setTilesOpaque):
* platform/graphics/ca/TileController.h:
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::updateTileLayerProperties):
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::supportsSubpixelAntialiasedText):
(PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText):
(layerContentsFormat):
(PlatformCALayerCocoa::updateContentsFormat):
(PlatformCALayer::drawLayerContents):
* platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
* platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
(-[WebTiledBackingLayer drawsAsynchronously]):
(-[WebTiledBackingLayer setSupportsSubpixelAntialiasedText:]):
(-[WebTiledBackingLayer supportsSubpixelAntialiasedText]):
* platform/spi/cocoa/QuartzCoreSPI.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences subpixelAntialiasedLayerTextEnabled]):
(-[WebPreferences setSubpixelAntialiasedLayerTextEnabled:]):
* WebView/WebPreferencesPrivate.h:

Source/WebKit2:

Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
PlatformCALayer, where it ultimately affects the layer contents format.

This is not supported with UI-side compositing.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetSubpixelAntialiasedLayerTextEnabled):
(WKPreferencesGetSubpixelAntialiasedLayerTextEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _subpixelAntialiasedLayerTextEnabled]):
(-[WKPreferences _setSubpixelAntialiasedLayerTextEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::supportsSubpixelAntialiasedText):
(WebKit::PlatformCALayerRemote::setSupportsSubpixelAntialiasedText):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
(WebKit::PlatformCALayerRemoteTiledBacking::supportsSubpixelAntialiasedText):
(WebKit::PlatformCALayerRemoteTiledBacking::setSupportsSubpixelAntialiasedText):
* WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:

Tools:

Add a setting that allows one to toggle subpixel-antialiased layer text on and off.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController toggleSubpixelAntialiasedLayerTextEnabled:]):
(-[SettingsController subpixelAntialiasedLayerTextEnabled]):
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt (0 => 212776)


--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt	2017-02-22 00:30:32 UTC (rev 212776)
@@ -0,0 +1,39 @@
+Normal layer
+Tiled layer
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 5018.00 2018.00)
+  (children 1
+    (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
+        (GraphicsLayer
+          (position 18.00 10.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+          (supports subpixel antialiased text 1)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (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)
+          (top left tile 0, 0 tiles grid 2 x 1)
+          (in window 1)
+        )
+      )
+    )
+  )
+)
+

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


--- trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-format/subpixel-antialiased-text-enabled.html	2017-02-22 00:30:32 UTC (rev 212776)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+        }
+        
+        .box {
+            height: 100px;
+            width: 100px;
+            background-color: blue;
+            margin: 10px;
+        }
+        
+        .composited {
+            transform: translateZ(0);
+        }
+        
+        .tiled {
+            width: 5000px;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function doAfterReload()
+        {
+            if (window.internals)
+                document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+
+            delete window.localStorage.stage;
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+
+        function doOnFirstLoad()
+        {
+            window.localStorage.stage = 1;
+            if (window.internals)
+                internals.settings.setSubpixelAntialiasedLayerTextEnabled(true)
+
+            // Reload so that the setting affects page tiles.
+            location.reload();
+        }
+
+        function doTest()
+        {
+            if (window.localStorage.stage)
+                doAfterReload();
+            else
+                doOnFirstLoad();
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+
+<div class="composited box">
+    Normal layer
+</div>
+
+<div class="tiled composited box">
+    Tiled layer
+</div>
+
+<pre id="layers"></pre>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt (0 => 212776)


--- trunk/LayoutTests/platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/contents-format/subpixel-antialiased-text-enabled-expected.txt	2017-02-22 00:30:32 UTC (rev 212776)
@@ -0,0 +1,35 @@
+Normal layer
+Tiled layer
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 5018.00 2018.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 5018.00 2018.00)
+      (contentsOpaque 1)
+      (supports subpixel antialiased text 1)
+      (children 2
+        (GraphicsLayer
+          (position 18.00 10.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+          (supports subpixel antialiased text 1)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (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)
+          (top left tile 0, 0 tiles grid 2 x 1)
+          (in window 1)
+        )
+      )
+    )
+  )
+)
+

Modified: trunk/Source/WebCore/ChangeLog (212775 => 212776)


--- trunk/Source/WebCore/ChangeLog	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/ChangeLog	2017-02-22 00:30:32 UTC (rev 212776)
@@ -1,3 +1,57 @@
+2017-02-20  Simon Fraser  <[email protected]>
+
+        Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
+        https://bugs.webkit.org/show_bug.cgi?id=168620
+        <rdar://problem/30617772>
+
+        Reviewed by Tim Horton.
+
+        Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
+        PlatformCALayer, where it ultimately affects the layer contents format.
+        
+        TileControllers are slightly special because we communicate with them via an Obj-C
+        WebTiledBackingLayer.
+
+        Test: compositing/contents-format/subpixel-antialiased-text-enabled.html
+
+        * page/Settings.in:
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        (WebCore::GraphicsLayer::dumpProperties):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::supportsSubpixelAntialiasedText):
+        (WebCore::GraphicsLayer::setSupportsSubpixelAntialiasedText):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::setSupportsSubpixelAntialiasedText):
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+        (WebCore::GraphicsLayerCA::updateSupportsSubpixelAntialiasedText):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCALayer.cpp:
+        (WebCore::PlatformCALayer::drawRepaintIndicator):
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::setWantsDeepColorBackingStore):
+        (WebCore::TileController::setSupportsSubpixelAntialiasedText):
+        (WebCore::TileController::setTilesOpaque):
+        * platform/graphics/ca/TileController.h:
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::updateTileLayerProperties):
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::supportsSubpixelAntialiasedText):
+        (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText):
+        (layerContentsFormat):
+        (PlatformCALayerCocoa::updateContentsFormat):
+        (PlatformCALayer::drawLayerContents):
+        * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
+        * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
+        (-[WebTiledBackingLayer drawsAsynchronously]):
+        (-[WebTiledBackingLayer setSupportsSubpixelAntialiasedText:]):
+        (-[WebTiledBackingLayer supportsSubpixelAntialiasedText]):
+        * platform/spi/cocoa/QuartzCoreSPI.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::createGraphicsLayer):
+
 2017-02-21  Chris Dumez  <[email protected]>
 
         REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work

Modified: trunk/Source/WebCore/page/Settings.in (212775 => 212776)


--- trunk/Source/WebCore/page/Settings.in	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/page/Settings.in	2017-02-22 00:30:32 UTC (rev 212776)
@@ -201,6 +201,7 @@
 textAutosizingWindowSizeOverride type=IntSize, setNeedsStyleRecalcInAllFrames=1, conditional=TEXT_AUTOSIZING
 minimumZoomFontSize type=float, initial=defaultMinimumZoomFontSize(), conditional=TEXT_AUTOSIZING
 
+subpixelAntialiasedLayerTextEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
 simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
 simpleLineLayoutDebugBordersEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -115,6 +115,7 @@
 #endif
     , m_type(type)
     , m_contentsOpaque(false)
+    , m_supportsSubpixelAntialiasedText(false)
     , m_preserves3D(false)
     , m_backfaceVisibility(true)
     , m_masksToBounds(false)
@@ -762,6 +763,11 @@
         ts << "(contentsOpaque " << (m_contentsOpaque || needsIOSDumpRenderTreeMainFrameRenderViewLayerIsAlwaysOpaqueHack) << ")\n";
     }
 
+    if (m_supportsSubpixelAntialiasedText) {
+        writeIndent(ts, indent + 1);
+        ts << "(supports subpixel antialiased text " << m_supportsSubpixelAntialiasedText << ")\n";
+    }
+
     if (m_preserves3D) {
         writeIndent(ts, indent + 1);
         ts << "(preserves3D " << m_preserves3D << ")\n";

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -374,6 +374,9 @@
     bool contentsOpaque() const { return m_contentsOpaque; }
     virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; }
 
+    bool supportsSubpixelAntialiasedText() const { return m_supportsSubpixelAntialiasedText; }
+    virtual void setSupportsSubpixelAntialiasedText(bool b) { m_supportsSubpixelAntialiasedText = b; }
+
     bool backfaceVisibility() const { return m_backfaceVisibility; }
     virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; }
 
@@ -631,6 +634,7 @@
     const Type m_type;
 
     bool m_contentsOpaque : 1;
+    bool m_supportsSubpixelAntialiasedText : 1;
     bool m_preserves3D: 1;
     bool m_backfaceVisibility : 1;
     bool m_masksToBounds : 1;

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -738,6 +738,15 @@
     noteLayerPropertyChanged(ContentsOpaqueChanged);
 }
 
+void GraphicsLayerCA::setSupportsSubpixelAntialiasedText(bool supportsSubpixelAntialiasedText)
+{
+    if (m_supportsSubpixelAntialiasedText == supportsSubpixelAntialiasedText)
+        return;
+
+    GraphicsLayer::setSupportsSubpixelAntialiasedText(supportsSubpixelAntialiasedText);
+    noteLayerPropertyChanged(SupportsSubpixelAntialiasedTextChanged);
+}
+
 void GraphicsLayerCA::setBackfaceVisibility(bool visible)
 {
     if (m_backfaceVisibility == visible)
@@ -1671,6 +1680,9 @@
     if (m_uncommittedChanges & AcceleratesDrawingChanged)
         updateAcceleratesDrawing();
 
+    if (m_uncommittedChanges & SupportsSubpixelAntialiasedTextChanged)
+        updateSupportsSubpixelAntialiasedText();
+
     if (m_uncommittedChanges & DebugIndicatorsChanged)
         updateDebugBorder();
 
@@ -2202,6 +2214,11 @@
     m_layer->setAcceleratesDrawing(m_acceleratesDrawing);
 }
 
+void GraphicsLayerCA::updateSupportsSubpixelAntialiasedText()
+{
+    m_layer->setSupportsSubpixelAntialiasedText(m_supportsSubpixelAntialiasedText);
+}
+
 static void setLayerDebugBorder(PlatformCALayer& layer, Color borderColor, float borderWidth)
 {
     layer.setBorderColor(borderColor);

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -94,6 +94,8 @@
     WEBCORE_EXPORT void setBackgroundColor(const Color&) override;
 
     WEBCORE_EXPORT void setContentsOpaque(bool) override;
+    WEBCORE_EXPORT void setSupportsSubpixelAntialiasedText(bool) override;
+
     WEBCORE_EXPORT void setBackfaceVisibility(bool) override;
 
     // return true if we started an animation
@@ -405,6 +407,7 @@
     void updateAnimations();
     void updateContentsNeedsDisplay();
     void updateAcceleratesDrawing();
+    void updateSupportsSubpixelAntialiasedText();
     void updateDebugBorder();
     void updateTiles();
     void updateContentsScale(float pageScaleFactor);
@@ -452,44 +455,45 @@
     bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, double timeOffset);
 
     enum LayerChange : uint64_t {
-        NoChange =                      0,
-        NameChanged =                   1LLU << 1,
-        ChildrenChanged =               1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
-        GeometryChanged =               1LLU << 3,
-        TransformChanged =              1LLU << 4,
-        ChildrenTransformChanged =      1LLU << 5,
-        Preserves3DChanged =            1LLU << 6,
-        MasksToBoundsChanged =          1LLU << 7,
-        DrawsContentChanged =           1LLU << 8,
-        BackgroundColorChanged =        1LLU << 9,
-        ContentsOpaqueChanged =         1LLU << 10,
-        BackfaceVisibilityChanged =     1LLU << 11,
-        OpacityChanged =                1LLU << 12,
-        AnimationChanged =              1LLU << 13,
-        DirtyRectsChanged =             1LLU << 14,
-        ContentsImageChanged =          1LLU << 15,
-        ContentsPlatformLayerChanged =  1LLU << 16,
-        ContentsColorLayerChanged =     1LLU << 17,
-        ContentsRectsChanged =          1LLU << 18,
-        MasksToBoundsRectChanged =      1LLU << 19,
-        MaskLayerChanged =              1LLU << 20,
-        ReplicatedLayerChanged =        1LLU << 21,
-        ContentsNeedsDisplay =          1LLU << 22,
-        AcceleratesDrawingChanged =     1LLU << 23,
-        ContentsScaleChanged =          1LLU << 24,
-        ContentsVisibilityChanged =     1LLU << 25,
-        CoverageRectChanged =           1LLU << 26,
-        FiltersChanged =                1LLU << 27,
-        BackdropFiltersChanged =        1LLU << 28,
-        BackdropFiltersRectChanged =    1LLU << 29,
-        TilingAreaChanged =             1LLU << 30,
-        TilesAdded =                    1LLU << 31,
-        DebugIndicatorsChanged =        1LLU << 32,
-        CustomAppearanceChanged =       1LLU << 33,
-        BlendModeChanged =              1LLU << 34,
-        ShapeChanged =                  1LLU << 35,
-        WindRuleChanged =               1LLU << 36,
-        UserInteractionEnabledChanged = 1LLU << 37,
+        NoChange                                = 0,
+        NameChanged                             = 1LLU << 1,
+        ChildrenChanged                         = 1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
+        GeometryChanged                         = 1LLU << 3,
+        TransformChanged                        = 1LLU << 4,
+        ChildrenTransformChanged                = 1LLU << 5,
+        Preserves3DChanged                      = 1LLU << 6,
+        MasksToBoundsChanged                    = 1LLU << 7,
+        DrawsContentChanged                     = 1LLU << 8,
+        BackgroundColorChanged                  = 1LLU << 9,
+        ContentsOpaqueChanged                   = 1LLU << 10,
+        BackfaceVisibilityChanged               = 1LLU << 11,
+        OpacityChanged                          = 1LLU << 12,
+        AnimationChanged                        = 1LLU << 13,
+        DirtyRectsChanged                       = 1LLU << 14,
+        ContentsImageChanged                    = 1LLU << 15,
+        ContentsPlatformLayerChanged            = 1LLU << 16,
+        ContentsColorLayerChanged               = 1LLU << 17,
+        ContentsRectsChanged                    = 1LLU << 18,
+        MasksToBoundsRectChanged                = 1LLU << 19,
+        MaskLayerChanged                        = 1LLU << 20,
+        ReplicatedLayerChanged                  = 1LLU << 21,
+        ContentsNeedsDisplay                    = 1LLU << 22,
+        AcceleratesDrawingChanged               = 1LLU << 23,
+        SupportsSubpixelAntialiasedTextChanged  = 1LLU << 24,
+        ContentsScaleChanged                    = 1LLU << 25,
+        ContentsVisibilityChanged               = 1LLU << 26,
+        CoverageRectChanged                     = 1LLU << 27,
+        FiltersChanged                          = 1LLU << 28,
+        BackdropFiltersChanged                  = 1LLU << 29,
+        BackdropFiltersRectChanged              = 1LLU << 30,
+        TilingAreaChanged                       = 1LLU << 31,
+        TilesAdded                              = 1LLU << 32,
+        DebugIndicatorsChanged                  = 1LLU << 33,
+        CustomAppearanceChanged                 = 1LLU << 34,
+        BlendModeChanged                        = 1LLU << 35,
+        ShapeChanged                            = 1LLU << 36,
+        WindRuleChanged                         = 1LLU << 37,
+        UserInteractionEnabledChanged           = 1LLU << 38,
     };
     typedef uint64_t LayerChangeFlags;
     enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -116,6 +116,12 @@
         CGContextStrokeRect(context, indicatorBox);
     }
 
+    if (!platformCALayer->isOpaque() && platformCALayer->supportsSubpixelAntialiasedText()) {
+        // Draw a gray shadow behind the repaint count.
+        CGContextSetRGBFillColor(context, 1, 1, 1, 0.4);
+        platformCALayer->drawTextAtPoint(context, indicatorBox.x() + 7, indicatorBox.y() + 24, CGSizeMake(1, -1), 22, text, strlen(text));
+    }
+
     if (platformCALayer->acceleratesDrawing())
         CGContextSetRGBFillColor(context, 1, 0, 0, 1);
     else

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -179,6 +179,9 @@
     virtual bool wantsDeepColorBackingStore() const = 0;
     virtual void setWantsDeepColorBackingStore(bool) = 0;
 
+    virtual bool supportsSubpixelAntialiasedText() const = 0;
+    virtual void setSupportsSubpixelAntialiasedText(bool) = 0;
+
     virtual CFTypeRef contents() const = 0;
     virtual void setContents(CFTypeRef) = 0;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/TileController.cpp (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -179,7 +179,15 @@
         return;
 
     m_wantsDeepColorBackingStore = wantsDeepColorBackingStore;
+    tileGrid().updateTileLayerProperties();
+}
 
+void TileController::setSupportsSubpixelAntialiasedText(bool supportsSubpixelAntialiasedText)
+{
+    if (m_supportsSubpixelAntialiasedText == supportsSubpixelAntialiasedText)
+        return;
+
+    m_supportsSubpixelAntialiasedText = supportsSubpixelAntialiasedText;
     tileGrid().updateTileLayerProperties();
 }
 
@@ -187,8 +195,8 @@
 {
     if (opaque == m_tilesAreOpaque)
         return;
+
     m_tilesAreOpaque = opaque;
-
     tileGrid().updateTileLayerProperties();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/ca/TileController.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/TileController.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -74,6 +74,9 @@
     bool wantsDeepColorBackingStore() const { return m_wantsDeepColorBackingStore; }
     WEBCORE_EXPORT void setWantsDeepColorBackingStore(bool);
 
+    bool supportsSubpixelAntialiasedText() const { return m_supportsSubpixelAntialiasedText; }
+    WEBCORE_EXPORT void setSupportsSubpixelAntialiasedText(bool);
+
     WEBCORE_EXPORT void setTilesOpaque(bool);
     bool tilesAreOpaque() const { return m_tilesAreOpaque; }
 
@@ -221,6 +224,7 @@
     bool m_scrollingPerformanceLoggingEnabled { false };
     bool m_acceleratesDrawing { false };
     bool m_wantsDeepColorBackingStore { false };
+    bool m_supportsSubpixelAntialiasedText { false };
     bool m_tilesAreOpaque { false };
     bool m_hasTilesWithTemporaryScaleFactor { false }; // Used to make low-res tiles when zooming.
     bool m_inLiveResize { false };

Modified: trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -199,6 +199,7 @@
 {
     bool acceleratesDrawing = m_controller.acceleratesDrawing();
     bool deepColor = m_controller.wantsDeepColorBackingStore();
+    bool subpixelAntialiasedText = m_controller.supportsSubpixelAntialiasedText();
     bool opaque = m_controller.tilesAreOpaque();
     Color tileDebugBorderColor = m_controller.tileDebugBorderColor();
     float tileDebugBorderWidth = m_controller.tileDebugBorderWidth();
@@ -207,6 +208,7 @@
         const TileInfo& tileInfo = it->value;
         tileInfo.layer->setAcceleratesDrawing(acceleratesDrawing);
         tileInfo.layer->setWantsDeepColorBackingStore(deepColor);
+        tileInfo.layer->setSupportsSubpixelAntialiasedText(subpixelAntialiasedText);
         tileInfo.layer->setOpaque(opaque);
         tileInfo.layer->setBorderColor(tileDebugBorderColor);
         tileInfo.layer->setBorderWidth(tileDebugBorderWidth);

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -113,6 +113,9 @@
     bool wantsDeepColorBackingStore() const override;
     void setWantsDeepColorBackingStore(bool) override;
 
+    bool supportsSubpixelAntialiasedText() const override;
+    void setSupportsSubpixelAntialiasedText(bool) override;
+
     CFTypeRef contents() const override;
     void setContents(CFTypeRef) override;
 
@@ -191,6 +194,7 @@
     GraphicsLayer::CustomAppearance m_customAppearance;
     std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
     bool m_wantsDeepColorBackingStore { false };
+    bool m_supportsSubpixelAntialiasedText { false };
 };
 
 } // namespace WebCore

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


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2017-02-22 00:30:32 UTC (rev 212776)
@@ -705,6 +705,26 @@
     updateContentsFormat();
 }
 
+bool PlatformCALayerCocoa::supportsSubpixelAntialiasedText() const
+{
+    return m_supportsSubpixelAntialiasedText;
+}
+
+void PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText(bool supportsSubpixelAntialiasedText)
+{
+    if (supportsSubpixelAntialiasedText == m_supportsSubpixelAntialiasedText)
+        return;
+    
+    m_supportsSubpixelAntialiasedText = supportsSubpixelAntialiasedText;
+
+    if (usesTiledBackingLayer()) {
+        [static_cast<WebTiledBackingLayer *>(m_layer.get()) setSupportsSubpixelAntialiasedText:m_supportsSubpixelAntialiasedText];
+        return;
+    }
+
+    updateContentsFormat();
+}
+
 CFTypeRef PlatformCALayerCocoa::contents() const
 {
     return [m_layer contents];
@@ -975,7 +995,7 @@
 }
 
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
-static NSString *layerContentsFormat(bool wantsDeepColor)
+static NSString *layerContentsFormat(bool wantsDeepColor, bool supportsSubpixelAntialiasedFonts)
 {
 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300
     if (wantsDeepColor)
@@ -983,6 +1003,14 @@
 #else
     UNUSED_PARAM(wantsDeepColor);
 #endif
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    if (supportsSubpixelAntialiasedFonts)
+        return kCAContentsFormatRGBA8ColorRGBA8LinearGlyphMask;
+#else
+    UNUSED_PARAM(supportsSubpixelAntialiasedFonts);
+#endif
+
     return nil;
 }
 #endif
@@ -992,7 +1020,7 @@
     if (m_layerType == LayerTypeWebLayer || m_layerType == LayerTypeTiledBackingTileLayer) {
         BEGIN_BLOCK_OBJC_EXCEPTIONS
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90300) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
-        if (NSString *formatString = layerContentsFormat(wantsDeepColorBackingStore()))
+        if (NSString *formatString = layerContentsFormat(wantsDeepColorBackingStore(), supportsSubpixelAntialiasedText()))
             [m_layer setContentsFormat:formatString];
 #endif
         END_BLOCK_OBJC_EXCEPTIONS
@@ -1107,7 +1135,7 @@
         graphicsContext.setIsCALayerContext(true);
         graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing());
         
-        if (!layerContents->platformCALayerContentsOpaque()) {
+        if (!layerContents->platformCALayerContentsOpaque() && !platformCALayer->supportsSubpixelAntialiasedText()) {
             // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
             graphicsContext.setShouldSmoothFonts(false);
         }

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -46,6 +46,9 @@
 - (void)setWantsDeepColorBackingStore:(BOOL)wantsDeepColor;
 - (BOOL)wantsDeepColorBackingStore;
 
+- (void)setSupportsSubpixelAntialiasedText:(BOOL)supportsSubpixelAntialiasedText;
+- (BOOL)supportsSubpixelAntialiasedText;
+
 @end
 
 #endif // WebTiledBackingLayer_h

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm	2017-02-22 00:30:32 UTC (rev 212776)
@@ -108,6 +108,11 @@
     _tileController->setAcceleratesDrawing(acceleratesDrawing);
 }
 
+- (BOOL)drawsAsynchronously
+{
+    return _tileController ? _tileController->acceleratesDrawing() : NO;
+}
+
 - (void)setWantsDeepColorBackingStore:(BOOL)wantsDeepColor
 {
     _tileController->setWantsDeepColorBackingStore(wantsDeepColor);
@@ -118,11 +123,16 @@
     return _tileController->wantsDeepColorBackingStore();
 }
 
-- (BOOL)drawsAsynchronously
+- (void)setSupportsSubpixelAntialiasedText:(BOOL)supportsSubpixelAntialiasedText
 {
-    return _tileController ? _tileController->acceleratesDrawing() : NO;
+    _tileController->setSupportsSubpixelAntialiasedText(supportsSubpixelAntialiasedText);
 }
 
+- (BOOL)supportsSubpixelAntialiasedText
+{
+    return _tileController->supportsSubpixelAntialiasedText();
+}
+
 - (void)setContentsScale:(CGFloat)contentsScale
 {
     _tileController->setContentsScale(contentsScale);

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -528,6 +528,15 @@
 {
 }
 
+bool PlatformCALayerWin::supportsSubpixelAntialiasedText() const
+{
+    return false
+}
+
+void PlatformCALayerWin::setSupportsSubpixelAntialiasedText(bool)
+{
+}
+
 CFTypeRef PlatformCALayerWin::contents() const
 {
     return CACFLayerGetContents(m_layer.get());

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (212775 => 212776)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -105,6 +105,9 @@
     bool wantsDeepColorBackingStore() const override;
     void setWantsDeepColorBackingStore(bool) override;
 
+    bool supportsSubpixelAntialiasedText() const override;
+    void setSupportsSubpixelAntialiasedText(bool) override;
+
     CFTypeRef contents() const override;
     void setContents(CFTypeRef) override;
 

Modified: trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h (212775 => 212776)


--- trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -221,6 +221,10 @@
 extern NSString * const kCAContentsFormatRGBA10XR;
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+extern NSString * const kCAContentsFormatRGBA8ColorRGBA8LinearGlyphMask;
+#endif
+
 #if (PLATFORM(APPLETV) && __TV_OS_VERSION_MAX_ALLOWED < 100000) \
     || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MAX_ALLOWED < 30000) \
     || (PLATFORM(IOS) && TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED < 100000) \

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (212775 => 212776)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -142,6 +142,7 @@
 #if PLATFORM(COCOA) && USE(CA)
     graphicsLayer->setAcceleratesDrawing(compositor().acceleratedDrawingEnabled());
     graphicsLayer->setUsesDisplayListDrawing(compositor().displayListDrawingEnabled());
+    graphicsLayer->setSupportsSubpixelAntialiasedText(renderer().settings().subpixelAntialiasedLayerTextEnabled());
 #endif
     
     return graphicsLayer;

Modified: trunk/Source/WebKit/mac/ChangeLog (212775 => 212776)


--- trunk/Source/WebKit/mac/ChangeLog	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-02-22 00:30:32 UTC (rev 212776)
@@ -1,3 +1,18 @@
+2017-02-20  Simon Fraser  <[email protected]>
+
+        Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
+        https://bugs.webkit.org/show_bug.cgi?id=168620
+        <rdar://problem/30617772>
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences subpixelAntialiasedLayerTextEnabled]):
+        (-[WebPreferences setSubpixelAntialiasedLayerTextEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+
 2017-02-21  Aakash Jain  <[email protected]>
 
         Export various NSString symbols from WebUIDelegatePrivate.h

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (212775 => 212776)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -105,6 +105,7 @@
 #define WebKitCanvasUsesAcceleratedDrawingPreferenceKey @"WebKitCanvasUsesAcceleratedDrawing"
 #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled"
 #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders"
+#define WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey @"WebKitSubpixelAntialiasedLayerTextEnabled"
 #define WebKitSimpleLineLayoutEnabledPreferenceKey @"WebKitSimpleLineLayoutEnabled"
 #define WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey @"WebKitSimpleLineLayoutDebugBordersEnabled"
 #define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter"

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (212775 => 212776)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2017-02-22 00:30:32 UTC (rev 212776)
@@ -491,6 +491,7 @@
         [NSNumber numberWithBool:NO],   WebKitJavaScriptCanAccessClipboardPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitXSSAuditorEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitAcceleratedCompositingEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitDisplayListDrawingEnabledPreferenceKey,
 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
         [NSNumber numberWithBool:YES],  WebKitAcceleratedDrawingEnabledPreferenceKey,
@@ -1961,6 +1962,16 @@
     [self _setBoolValue:enabled forKey:WebKitShowDebugBordersPreferenceKey];
 }
 
+- (BOOL)subpixelAntialiasedLayerTextEnabled
+{
+    return [self _boolValueForKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
+}
+
+- (void)setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
+}
+
 - (BOOL)simpleLineLayoutEnabled
 {
     return [self _boolValueForKey:WebKitSimpleLineLayoutEnabledPreferenceKey];

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (212775 => 212776)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -224,6 +224,9 @@
 - (BOOL)acceleratedCompositingEnabled;
 - (void)setAcceleratedCompositingEnabled:(BOOL)enabled;
 
+- (BOOL)subpixelAntialiasedLayerTextEnabled;
+- (void)setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled;
+
 - (BOOL)showDebugBorders;
 - (void)setShowDebugBorders:(BOOL)show;
 

Modified: trunk/Source/WebKit2/ChangeLog (212775 => 212776)


--- trunk/Source/WebKit2/ChangeLog	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-22 00:30:32 UTC (rev 212776)
@@ -1,3 +1,36 @@
+2017-02-20  Simon Fraser  <[email protected]>
+
+        Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
+        https://bugs.webkit.org/show_bug.cgi?id=168620
+        <rdar://problem/30617772>
+
+        Reviewed by Tim Horton.
+
+        Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
+        PlatformCALayer, where it ultimately affects the layer contents format.
+        
+        This is not supported with UI-side compositing.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetSubpixelAntialiasedLayerTextEnabled):
+        (WKPreferencesGetSubpixelAntialiasedLayerTextEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _subpixelAntialiasedLayerTextEnabled]):
+        (-[WKPreferences _setSubpixelAntialiasedLayerTextEnabled:]):
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::supportsSubpixelAntialiasedText):
+        (WebKit::PlatformCALayerRemote::setSupportsSubpixelAntialiasedText):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
+        (WebKit::PlatformCALayerRemoteTiledBacking::supportsSubpixelAntialiasedText):
+        (WebKit::PlatformCALayerRemoteTiledBacking::setSupportsSubpixelAntialiasedText):
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
+
 2017-02-21  John Wilander  <[email protected]>
 
         Resource Load Statistics: Only scan website data store once per session ID + reinstate removal counting

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (212775 => 212776)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -273,6 +273,7 @@
 
 #define FOR_EACH_WEBKIT_DEBUG_BOOL_PREFERENCE(macro) \
     macro(AcceleratedDrawingEnabled, acceleratedDrawingEnabled, Bool, bool, DEFAULT_ACCELERATED_DRAWING_ENABLED, "", "") \
+    macro(SubpixelAntialiasedLayerTextEnabled, subpixelAntialiasedLayerTextEnabled, Bool, bool, false, "", "") \
     macro(DisplayListDrawingEnabled, displayListDrawingEnabled, Bool, bool, false, "", "") \
     macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false, "", "") \
     macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false, "", "") \

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (212775 => 212776)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -383,6 +383,16 @@
     return toAPI(static_cast<FontSmoothingLevel>(toImpl(preferencesRef)->fontSmoothingLevel()));
 }
 
+void WKPreferencesSetSubpixelAntialiasedLayerTextEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setSubpixelAntialiasedLayerTextEnabled(flag);
+}
+
+bool WKPreferencesGetSubpixelAntialiasedLayerTextEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->subpixelAntialiasedLayerTextEnabled();
+}
+
 void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setAcceleratedDrawingEnabled(flag);

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (212775 => 212776)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -63,6 +63,10 @@
 WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel);
 WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef);
 
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetSubpixelAntialiasedLayerTextEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetSubpixelAntialiasedLayerTextEnabled(WKPreferencesRef);
+
 // Defaults to EditableLinkNeverLive.
 WK_EXPORT void WKPreferencesSetEditableLinkBehavior(WKPreferencesRef preferencesRef, WKEditableLinkBehavior);
 WK_EXPORT WKEditableLinkBehavior WKPreferencesGetEditableLinkBehavior(WKPreferencesRef preferencesRef);   

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm (212775 => 212776)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm	2017-02-22 00:30:32 UTC (rev 212776)
@@ -365,6 +365,16 @@
     _preferences->setTextAutosizingEnabled(enabled);
 }
 
+- (BOOL)_subpixelAntialiasedLayerTextEnabled
+{
+    return _preferences->subpixelAntialiasedLayerTextEnabled();
+}
+
+- (void)_setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
+{
+    _preferences->setSubpixelAntialiasedLayerTextEnabled(enabled);
+}
+
 - (BOOL)_developerExtrasEnabled
 {
     return _preferences->developerExtrasEnabled();

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h (212775 => 212776)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -67,6 +67,7 @@
 @property (nonatomic, setter=_setLargeImageAsyncDecodingEnabled:) BOOL _largeImageAsyncDecodingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setAnimatedImageAsyncDecodingEnabled:) BOOL _animatedImageAsyncDecodingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setTextAutosizingEnabled:) BOOL _textAutosizingEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
+@property (nonatomic, setter=_setSubpixelAntialiasedLayerTextEnabled:) BOOL _subpixelAntialiasedLayerTextEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 
 @property (nonatomic, setter=_setDeveloperExtrasEnabled:) BOOL _developerExtrasEnabled WK_API_AVAILABLE(macosx(10.11), ios(9.0));
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (212775 => 212776)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -3005,7 +3005,8 @@
     settings.setShowTiledScrollingIndicator(store.getBoolValueForKey(WebPreferencesKey::tiledScrollingIndicatorVisibleKey()));
     settings.setVisibleDebugOverlayRegions(store.getUInt32ValueForKey(WebPreferencesKey::visibleDebugOverlayRegionsKey()));
     settings.setUseGiantTiles(store.getBoolValueForKey(WebPreferencesKey::useGiantTilesKey()));
-    
+    settings.setSubpixelAntialiasedLayerTextEnabled(store.getBoolValueForKey(WebPreferencesKey::subpixelAntialiasedLayerTextEnabledKey()));
+
     settings.setAggressiveTileRetentionEnabled(store.getBoolValueForKey(WebPreferencesKey::aggressiveTileRetentionEnabledKey()));
     settings.setTemporaryTileCohortRetentionEnabled(store.getBoolValueForKey(WebPreferencesKey::temporaryTileCohortRetentionEnabledKey()));
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (212775 => 212776)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -607,6 +607,15 @@
     updateBackingStore();
 }
 
+bool PlatformCALayerRemote::supportsSubpixelAntialiasedText() const
+{
+    return false;
+}
+
+void PlatformCALayerRemote::setSupportsSubpixelAntialiasedText(bool)
+{
+}
+
 CFTypeRef PlatformCALayerRemote::contents() const
 {
     return nullptr;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (212775 => 212776)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -118,6 +118,9 @@
     bool wantsDeepColorBackingStore() const override;
     void setWantsDeepColorBackingStore(bool) override;
 
+    bool supportsSubpixelAntialiasedText() const override;
+    void setSupportsSubpixelAntialiasedText(bool) override;
+
     CFTypeRef contents() const override;
     void setContents(CFTypeRef) override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp (212775 => 212776)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -97,6 +97,16 @@
     m_tileController->setWantsDeepColorBackingStore(wantsDeepColorBackingStore);
 }
 
+bool PlatformCALayerRemoteTiledBacking::supportsSubpixelAntialiasedText() const
+{
+    return m_tileController->supportsSubpixelAntialiasedText();
+}
+
+void PlatformCALayerRemoteTiledBacking::setSupportsSubpixelAntialiasedText(bool supportsSubpixelAntialiasedText)
+{
+    m_tileController->setSupportsSubpixelAntialiasedText(supportsSubpixelAntialiasedText);
+}
+
 float PlatformCALayerRemoteTiledBacking::contentsScale() const
 {
     return m_tileController->contentsScale();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h (212775 => 212776)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -56,7 +56,10 @@
 
     bool wantsDeepColorBackingStore() const override;
     void setWantsDeepColorBackingStore(bool) override;
-    
+
+    bool supportsSubpixelAntialiasedText() const override;
+    void setSupportsSubpixelAntialiasedText(bool) override;
+
     float contentsScale() const override;
     void setContentsScale(float) override;
     

Modified: trunk/Tools/ChangeLog (212775 => 212776)


--- trunk/Tools/ChangeLog	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/ChangeLog	2017-02-22 00:30:32 UTC (rev 212776)
@@ -1,3 +1,28 @@
+2017-02-20  Simon Fraser  <[email protected]>
+
+        Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
+        https://bugs.webkit.org/show_bug.cgi?id=168620
+        <rdar://problem/30617772>
+
+        Reviewed by Tim Horton.
+        
+        Add a setting that allows one to toggle subpixel-antialiased layer text on and off.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * MiniBrowser/mac/SettingsController.h:
+        * MiniBrowser/mac/SettingsController.m:
+        (-[SettingsController _populateMenu]):
+        (-[SettingsController validateMenuItem:]):
+        (-[SettingsController toggleSubpixelAntialiasedLayerTextEnabled:]):
+        (-[SettingsController subpixelAntialiasedLayerTextEnabled]):
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController didChangeSettings]):
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController didChangeSettings]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2017-02-21  John Wilander  <[email protected]>
 
         Resource Load Statistics: Add alternate classification method

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (212775 => 212776)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-02-22 00:30:32 UTC (rev 212776)
@@ -971,11 +971,13 @@
         [preferences setUserStyleSheetEnabled:YES];
     } else
         [preferences setUserStyleSheetEnabled:NO];
+
     [preferences setMediaPlaybackAllowsInline:YES];
     [preferences setVideoPlaybackRequiresUserGesture:NO];
     [preferences setAudioPlaybackRequiresUserGesture:NO];
     [preferences setMediaDataLoadsAutomatically:YES];
     [preferences setInvisibleAutoplayNotPermitted:NO];
+    [preferences setSubpixelAntialiasedLayerTextEnabled:NO];
 
 #if PLATFORM(IOS)
     // Enable the tracker before creating the first WebView will

Modified: trunk/Tools/MiniBrowser/mac/SettingsController.h (212775 => 212776)


--- trunk/Tools/MiniBrowser/mac/SettingsController.h	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/MiniBrowser/mac/SettingsController.h	2017-02-22 00:30:32 UTC (rev 212776)
@@ -51,6 +51,7 @@
 @property (nonatomic, readonly) BOOL subPixelCSSOMMetricsEnabled;
 @property (nonatomic, readonly) BOOL acceleratedDrawingEnabled;
 @property (nonatomic, readonly) BOOL displayListDrawingEnabled;
+@property (nonatomic, readonly) BOOL subpixelAntialiasedLayerTextEnabled;
 @property (nonatomic, readonly) BOOL resourceLoadStatisticsEnabled;
 @property (nonatomic, readonly) BOOL visualViewportEnabled;
 @property (nonatomic, readonly) BOOL largeImageAsyncDecodingEnabled;

Modified: trunk/Tools/MiniBrowser/mac/SettingsController.m (212775 => 212776)


--- trunk/Tools/MiniBrowser/mac/SettingsController.m	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/MiniBrowser/mac/SettingsController.m	2017-02-22 00:30:32 UTC (rev 212776)
@@ -50,6 +50,7 @@
 static NSString * const IncrementalRenderingSuppressedPreferenceKey = @"IncrementalRenderingSuppressed";
 static NSString * const AcceleratedDrawingEnabledPreferenceKey = @"AcceleratedDrawingEnabled";
 static NSString * const DisplayListDrawingEnabledPreferenceKey = @"DisplayListDrawingEnabled";
+static NSString * const SubpixelAntialiasedLayerTextEnabledPreferenceKey = @"SubpixelAntialiasedLayerTextEnabled";
 static NSString * const ResourceLoadStatisticsEnabledPreferenceKey = @"ResourceLoadStatisticsEnabled";
 
 static NSString * const NonFastScrollableRegionOverlayVisiblePreferenceKey = @"NonFastScrollableRegionOverlayVisible";
@@ -134,6 +135,7 @@
     [self _addItemWithTitle:@"Suppress Incremental Rendering in New Windows" action:@selector(toggleIncrementalRenderingSuppressed:) indented:NO];
     [self _addItemWithTitle:@"Enable Accelerated Drawing" action:@selector(toggleAcceleratedDrawingEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Display List Drawing" action:@selector(toggleDisplayListDrawingEnabled:) indented:NO];
+    [self _addItemWithTitle:@"Enable Subpixel-antialiased Layer Text" action:@selector(toggleSubpixelAntialiasedLayerTextEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Visual Viewport" action:@selector(toggleVisualViewportEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Resource Load Statistics" action:@selector(toggleResourceLoadStatisticsEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Large Image Async Decoding" action:@selector(toggleLargeImageAsyncDecodingEnabled:) indented:NO];
@@ -218,6 +220,8 @@
         [menuItem setState:[self acceleratedDrawingEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleDisplayListDrawingEnabled:))
         [menuItem setState:[self displayListDrawingEnabled] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleSubpixelAntialiasedLayerTextEnabled:))
+        [menuItem setState:[self subpixelAntialiasedLayerTextEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleResourceLoadStatisticsEnabled:))
         [menuItem setState:[self resourceLoadStatisticsEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleLargeImageAsyncDecodingEnabled:))
@@ -398,6 +402,16 @@
     return [[NSUserDefaults standardUserDefaults] boolForKey:DisplayListDrawingEnabledPreferenceKey];
 }
 
+- (void)toggleSubpixelAntialiasedLayerTextEnabled:(id)sender
+{
+    [self _toggleBooleanDefault:SubpixelAntialiasedLayerTextEnabledPreferenceKey];
+}
+
+- (BOOL)subpixelAntialiasedLayerTextEnabled
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:SubpixelAntialiasedLayerTextEnabledPreferenceKey];
+}
+
 - (void)toggleReserveSpaceForBanners:(id)sender
 {
     [self _toggleBooleanDefault:ReserveSpaceForBannersPreferenceKey];

Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m (212775 => 212776)


--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2017-02-22 00:30:32 UTC (rev 212776)
@@ -269,6 +269,7 @@
     [[WebPreferences standardPreferences] setShowRepaintCounter:settings.layerBordersVisible];
     [[WebPreferences standardPreferences] setSuppressesIncrementalRendering:settings.incrementalRenderingSuppressed];
     [[WebPreferences standardPreferences] setAcceleratedDrawingEnabled:settings.acceleratedDrawingEnabled];
+    [[WebPreferences standardPreferences] setSubpixelAntialiasedLayerTextEnabled:settings.subpixelAntialiasedLayerTextEnabled];
     [[WebPreferences standardPreferences] setResourceLoadStatisticsEnabled:settings.resourceLoadStatisticsEnabled];
     [[WebPreferences standardPreferences] setVisualViewportEnabled:settings.visualViewportEnabled];
     [[WebPreferences standardPreferences] setLargeImageAsyncDecodingEnabled:settings.largeImageAsyncDecodingEnabled];

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (212775 => 212776)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2017-02-22 00:30:32 UTC (rev 212776)
@@ -375,6 +375,7 @@
     preferences._acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled;
     preferences._resourceUsageOverlayVisible = settings.resourceUsageOverlayVisible;
     preferences._displayListDrawingEnabled = settings.displayListDrawingEnabled;
+    preferences._subpixelAntialiasedLayerTextEnabled = settings.subpixelAntialiasedLayerTextEnabled;
     preferences._visualViewportEnabled = settings.visualViewportEnabled;
     preferences._largeImageAsyncDecodingEnabled = settings.largeImageAsyncDecodingEnabled;
     preferences._animatedImageAsyncDecodingEnabled = settings.animatedImageAsyncDecodingEnabled;

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (212775 => 212776)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-02-21 23:57:03 UTC (rev 212775)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-02-22 00:30:32 UTC (rev 212776)
@@ -642,6 +642,7 @@
     WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(preferences, false);
     WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
     WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
+    WKPreferencesSetSubpixelAntialiasedLayerTextEnabled(preferences, false);
     WKPreferencesSetXSSAuditorEnabled(preferences, false);
     WKPreferencesSetWebAudioEnabled(preferences, true);
     WKPreferencesSetMediaStreamEnabled(preferences, true);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to