Title: [197981] trunk
Revision
197981
Author
[email protected]
Date
2016-03-10 17:49:22 -0800 (Thu, 10 Mar 2016)

Log Message

Font antialiasing (smoothing) changes when elements are rendered into compositing layers
https://bugs.webkit.org/show_bug.cgi?id=23364

Reviewed by Tim Horton.

Source/WebCore:

Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
by opting in to a new CALayer backing store format.

GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
when the platform has support for the new feature. Ideally this would only be set when
we know a layer has smoothed text drawn into it, but, for now, enable this for all
layers. The right thing happens with opaque layers under the hood.

setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
is ultimately passed to setBackingStoreFormat().

We also need to propagate this flag to TileController tiles.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::supportsSmoothedLayerText):
(WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
(WebCore::GraphicsLayer::smoothedLayerTextEnabled):
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::supportsSmoothedFonts):
(WebCore::GraphicsLayer::setSupportsSmoothedFonts):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::supportsSmoothedLayerText):
(WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
(WebCore::GraphicsLayer::smoothedLayerTextEnabled):
(WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateContentsFormat):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
the contents format says we support smoothed fonts.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setTileContentsFormatFlags):
(WebCore::TileController::createTileLayer):
* 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:
(WebCore::setBackingStoreFormat):
(PlatformCALayerCocoa::commonInit):
(PlatformCALayerCocoa::setContentsFormat):
(PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
non-opaque layers to improve text appearance. We no longer need to do that when
the contents format has "SmoothedFonts".
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::setContentsFormat):
(PlatformCALayerWin::contentsFormat):
* platform/graphics/ca/win/PlatformCALayerWin.h:
* platform/ios/LegacyTileGridTile.mm:
(WebCore::setBackingStoreFormat):
(WebCore::LegacyTileGridTile::LegacyTileGridTile):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):

Source/WebKit/mac:

Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
can disable it.

* WebView/WebView.mm:
(+[WebView _setSmoothedLayerTextEnabled:]):
(+[WebView _smoothedLayerTextEnabled]):
* WebView/WebViewPrivate.h:

Source/WebKit2:

Send the ContentsFormat to the UI process (but nothing happens to it there yet).

Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
can disable it.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* UIProcess/API/C/WKContext.cpp:
(WKContextEnableSmoothedLayerText):
* UIProcess/API/C/WKContextPrivate.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::enableSmoothedLayerText):
(WebKit::WebProcessPool::WebProcessPool): Deleted.
* UIProcess/WebProcessPool.h:
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setContentsFormat):
(WebKit::PlatformCALayerRemote::contentsFormat):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::enableSmoothedLayerText):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Tools:

Turn off smoothed layer text because it affects many layout test results.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (197980 => 197981)


--- trunk/Source/WebCore/ChangeLog	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/ChangeLog	2016-03-11 01:49:22 UTC (rev 197981)
@@ -1,3 +1,68 @@
+2016-03-10  Simon Fraser  <[email protected]>
+
+        Font antialiasing (smoothing) changes when elements are rendered into compositing layers
+        https://bugs.webkit.org/show_bug.cgi?id=23364
+
+        Reviewed by Tim Horton.
+
+        Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
+        by opting in to a new CALayer backing store format.
+
+        GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
+        when the platform has support for the new feature. Ideally this would only be set when
+        we know a layer has smoothed text drawn into it, but, for now, enable this for all
+        layers. The right thing happens with opaque layers under the hood.
+
+        setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
+        is ultimately passed to setBackingStoreFormat().
+
+        We also need to propagate this flag to TileController tiles.
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::supportsSmoothedLayerText):
+        (WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
+        (WebCore::GraphicsLayer::smoothedLayerTextEnabled):
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::supportsSmoothedFonts):
+        (WebCore::GraphicsLayer::setSupportsSmoothedFonts):
+        * platform/graphics/TiledBacking.h:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayer::supportsSmoothedLayerText):
+        (WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
+        (WebCore::GraphicsLayer::smoothedLayerTextEnabled):
+        (WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+        (WebCore::GraphicsLayerCA::updateContentsFormat):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCALayer.cpp:
+        (WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
+        the contents format says we support smoothed fonts.
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::setTileContentsFormatFlags):
+        (WebCore::TileController::createTileLayer):
+        * 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:
+        (WebCore::setBackingStoreFormat):
+        (PlatformCALayerCocoa::commonInit):
+        (PlatformCALayerCocoa::setContentsFormat):
+        (PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
+        non-opaque layers to improve text appearance. We no longer need to do that when
+        the contents format has "SmoothedFonts".
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayerWin::setContentsFormat):
+        (PlatformCALayerWin::contentsFormat):
+        * platform/graphics/ca/win/PlatformCALayerWin.h:
+        * platform/ios/LegacyTileGridTile.mm:
+        (WebCore::setBackingStoreFormat):
+        (WebCore::LegacyTileGridTile::LegacyTileGridTile):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::createGraphicsLayer):
+
 2016-03-10  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r197922.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (197980 => 197981)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -105,6 +105,22 @@
 }
 #endif
 
+#if !USE(CA)
+bool GraphicsLayer::supportsSmoothedLayerText()
+{
+    return false;
+}
+
+void GraphicsLayer::setSmoothedLayerTextEnabled(bool)
+{
+}
+
+bool GraphicsLayer::smoothedLayerTextEnabled()
+{
+    return false;
+}
+#endif
+
 GraphicsLayer::GraphicsLayer(Type type, GraphicsLayerClient& client)
     : m_client(client)
     , m_anchorPoint(0.5f, 0.5f, 0)
@@ -115,6 +131,7 @@
 #endif
     , m_type(type)
     , m_contentsOpaque(false)
+    , m_supportsSmoothedFonts(false)
     , m_preserves3D(false)
     , m_backfaceVisibility(true)
     , m_usingTiledBacking(false)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (197980 => 197981)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -364,6 +364,9 @@
     bool contentsOpaque() const { return m_contentsOpaque; }
     virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; }
 
+    bool supportsSmoothedFonts() const { return m_supportsSmoothedFonts; }
+    virtual void setSupportsSmoothedFonts(bool b) { m_supportsSmoothedFonts = b; }
+
     bool backfaceVisibility() const { return m_backfaceVisibility; }
     virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; }
 
@@ -540,7 +543,11 @@
     static bool supportsBackgroundColorContent();
     static bool supportsLayerType(Type);
     static bool supportsContentsTiling();
+    static bool supportsSmoothedLayerText();
 
+    WEBCORE_EXPORT static void setSmoothedLayerTextEnabled(bool);
+    WEBCORE_EXPORT static bool smoothedLayerTextEnabled();
+
     void updateDebugIndicators();
 
     virtual bool canThrottleLayerFlush() const { return false; }
@@ -613,6 +620,7 @@
     const Type m_type;
 
     bool m_contentsOpaque : 1;
+    bool m_supportsSmoothedFonts : 1;
     bool m_preserves3D: 1;
     bool m_backfaceVisibility : 1;
     bool m_usingTiledBacking : 1;

Modified: trunk/Source/WebCore/platform/graphics/TiledBacking.h (197980 => 197981)


--- trunk/Source/WebCore/platform/graphics/TiledBacking.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -79,6 +79,8 @@
     virtual void setTiledScrollingIndicatorPosition(const FloatPoint&) = 0;
     virtual void setTopContentInset(float) = 0;
 
+    virtual void setTileContentsFormatFlags(unsigned) = 0;
+
     virtual void setVelocity(const VelocityData&) = 0;
     
     enum {

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


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -309,6 +309,26 @@
     return true;
 }
 
+static bool isSmoothedLayerTextEnabled = true;
+
+bool GraphicsLayer::supportsSmoothedLayerText()
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    return isSmoothedLayerTextEnabled;
+#endif
+    return false;
+}
+
+void GraphicsLayer::setSmoothedLayerTextEnabled(bool flag)
+{
+    isSmoothedLayerTextEnabled = flag;
+}
+
+bool GraphicsLayer::smoothedLayerTextEnabled()
+{
+    return isSmoothedLayerTextEnabled;
+}
+
 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
 {
     std::unique_ptr<GraphicsLayer> graphicsLayer;
@@ -709,6 +729,15 @@
     noteLayerPropertyChanged(ContentsOpaqueChanged);
 }
 
+void GraphicsLayerCA::setSupportsSmoothedFonts(bool supportsSmoothedFonts)
+{
+    if (m_supportsSmoothedFonts == supportsSmoothedFonts)
+        return;
+
+    GraphicsLayer::setSupportsSmoothedFonts(supportsSmoothedFonts);
+    noteLayerPropertyChanged(ContentsFormatChanged);
+}
+
 void GraphicsLayerCA::setBackfaceVisibility(bool visible)
 {
     if (m_backfaceVisibility == visible)
@@ -1580,6 +1609,9 @@
     if (m_uncommittedChanges & ContentsOpaqueChanged)
         updateContentsOpaque(pageScaleFactor);
 
+    if (m_uncommittedChanges & ContentsFormatChanged)
+        updateContentsFormat();
+
     if (m_uncommittedChanges & BackfaceVisibilityChanged)
         updateBackfaceVisibility();
 
@@ -1890,6 +1922,20 @@
     }
 }
 
+void GraphicsLayerCA::updateContentsFormat()
+{
+    PlatformCALayer::ContentsFormatFlags formatFlags = 0;
+    if (supportsSmoothedFonts())
+        formatFlags |= PlatformCALayer::SmoothedFonts;
+
+    m_layer->setContentsFormat(formatFlags);
+
+    if (LayerMap* layerCloneMap = m_layerClones.get()) {
+        for (auto& layer : layerCloneMap->values())
+            layer->setContentsFormat(formatFlags);
+    }
+}
+
 void GraphicsLayerCA::updateBackfaceVisibility()
 {
     if (m_structuralLayer && structuralLayerPurpose() == StructuralLayerForReplicaFlattening) {

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


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -95,6 +95,8 @@
     WEBCORE_EXPORT void setBackgroundColor(const Color&) override;
 
     WEBCORE_EXPORT void setContentsOpaque(bool) override;
+    WEBCORE_EXPORT void setSupportsSmoothedFonts(bool) override;
+
     WEBCORE_EXPORT void setBackfaceVisibility(bool) override;
 
     // return true if we started an animation
@@ -391,6 +393,7 @@
     void updateMasksToBounds();
     void updateContentsVisibility();
     void updateContentsOpaque(float pageScaleFactor);
+    void updateContentsFormat();
     void updateBackfaceVisibility();
     void updateStructuralLayer();
     void updateDrawsContent();
@@ -455,43 +458,44 @@
     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,
+        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,
+        ContentsFormatChanged           = 1LLU << 11,
+        BackfaceVisibilityChanged       = 1LLU << 12,
+        OpacityChanged                  = 1LLU << 13,
+        AnimationChanged                = 1LLU << 14,
+        DirtyRectsChanged               = 1LLU << 15,
+        ContentsImageChanged            = 1LLU << 16,
+        ContentsPlatformLayerChanged    = 1LLU << 17,
+        ContentsColorLayerChanged       = 1LLU << 18,
+        ContentsRectsChanged            = 1LLU << 19,
+        MasksToBoundsRectChanged        = 1LLU << 20,
+        MaskLayerChanged                = 1LLU << 21,
+        ReplicatedLayerChanged          = 1LLU << 22,
+        ContentsNeedsDisplay            = 1LLU << 23,
+        AcceleratesDrawingChanged       = 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,
     };
     typedef uint64_t LayerChangeFlags;
     enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };

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


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -80,11 +80,6 @@
         CGContextSetRGBFillColor(context, 0, 0.5f, 0.25f, 1);
     
     CGContextFillRect(context, indicatorBox);
-    
-    if (platformCALayer->acceleratesDrawing())
-        CGContextSetRGBFillColor(context, 1, 0, 0, 1);
-    else
-        CGContextSetRGBFillColor(context, 1, 1, 1, 1);
 
     if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) {
         CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65);
@@ -92,6 +87,16 @@
         CGContextStrokeRect(context, indicatorBox);
     }
     
+    if (!platformCALayer->isOpaque() && (platformCALayer->contentsFormat() & SmoothedFonts)) {
+        CGContextSetRGBFillColor(context, 1, 1, 1, 0.4);
+        platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 7, indicatorBox.origin.y + 24, CGSizeMake(1, -1), 22, text, strlen(text));
+    }
+
+    if (platformCALayer->acceleratesDrawing())
+        CGContextSetRGBFillColor(context, 1, 0, 0, 1);
+    else
+        CGContextSetRGBFillColor(context, 1, 1, 1, 1);
+    
     platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, CGSizeMake(1, -1), 22, text, strlen(text));
     
     CGContextEndTransparencyLayer(context);

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


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -139,6 +139,14 @@
     virtual bool isOpaque() const = 0;
     virtual void setOpaque(bool) = 0;
 
+    enum ContentsFormatFlag {
+        DeepColor       = 1 << 0,
+        SmoothedFonts   = 1 << 1,
+    };
+    typedef unsigned ContentsFormatFlags;
+    virtual void setContentsFormat(ContentsFormatFlags) = 0;
+    virtual ContentsFormatFlags contentsFormat() const = 0;
+
     virtual FloatRect bounds() const = 0;
     virtual void setBounds(const FloatRect&) = 0;
 

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


--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -175,6 +175,15 @@
     tileGrid().updateTileLayerProperties();
 }
 
+void TileController::setTileContentsFormatFlags(PlatformCALayer::ContentsFormatFlags flags)
+{
+    if (flags == m_contentsFormatFlags)
+        return;
+
+    m_contentsFormatFlags = flags;
+    tileGrid().updateTileLayerProperties();
+}
+
 void TileController::setVisibleRect(const FloatRect& rect)
 {
     if (rect == m_visibleRect)
@@ -675,6 +684,7 @@
     layer->setBorderWidth(m_tileDebugBorderWidth);
     layer->setEdgeAntialiasingMask(0);
     layer->setOpaque(m_tilesAreOpaque);
+    layer->setContentsFormat(m_contentsFormatFlags);
 #ifndef NDEBUG
     layer->setName("Tile");
 #endif

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


--- trunk/Source/WebCore/platform/graphics/ca/TileController.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -78,6 +78,9 @@
     WEBCORE_EXPORT void setTilesOpaque(bool);
     bool tilesAreOpaque() const { return m_tilesAreOpaque; }
 
+    void setTileContentsFormatFlags(PlatformCALayer::ContentsFormatFlags) override;
+    PlatformCALayer::ContentsFormatFlags tileContentsFormatFlags() const { return m_contentsFormatFlags; }
+
     PlatformCALayer& rootLayer() { return *m_tileCacheLayer; }
     const PlatformCALayer& rootLayer() const { return *m_tileCacheLayer; }
 
@@ -206,6 +209,8 @@
 
     int m_marginSize { kDefaultTileSize };
 
+    PlatformCALayer::ContentsFormatFlags m_contentsFormatFlags { 0 };
+
     // m_marginTop and m_marginBottom are the height in pixels of the top and bottom margin tiles. The width
     // of those tiles will be equivalent to the width of the other tiles in the grid. m_marginRight and
     // m_marginLeft are the width in pixels of the right and left margin tiles, respectively. The height of

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


--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -175,6 +175,7 @@
 {
     bool acceleratesDrawing = m_controller.acceleratesDrawing();
     bool opaque = m_controller.tilesAreOpaque();
+    PlatformCALayer::ContentsFormatFlags formatFlags = m_controller.tileContentsFormatFlags();
     Color tileDebugBorderColor = m_controller.tileDebugBorderColor();
     float tileDebugBorderWidth = m_controller.tileDebugBorderWidth();
 
@@ -182,6 +183,7 @@
         const TileInfo& tileInfo = it->value;
         tileInfo.layer->setAcceleratesDrawing(acceleratesDrawing);
         tileInfo.layer->setOpaque(opaque);
+        tileInfo.layer->setContentsFormat(formatFlags);
         tileInfo.layer->setBorderColor(tileDebugBorderColor);
         tileInfo.layer->setBorderWidth(tileDebugBorderWidth);
     }

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


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -72,6 +72,9 @@
     bool isOpaque() const override;
     void setOpaque(bool) override;
 
+    void setContentsFormat(ContentsFormatFlags) override;
+    ContentsFormatFlags contentsFormat() const override { return m_contentsFormatFlags; }
+
     FloatRect bounds() const override;
     void setBounds(const FloatRect&) override;
 
@@ -179,6 +182,7 @@
     std::unique_ptr<PlatformCALayerList> m_customSublayers;
     GraphicsLayer::CustomAppearance m_customAppearance;
     std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
+    ContentsFormatFlags m_contentsFormatFlags { 0 };
 };
 
 } // namespace WebCore

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


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2016-03-11 01:49:22 UTC (rev 197981)
@@ -69,7 +69,7 @@
 #import <WebKitAdditions/LayerBackingStoreAdditions.mm>
 #else
 namespace WebCore {
-static void setBackingStoreFormat(CALayer *)
+static void setBackingStoreFormat(CALayer *, PlatformCALayer::ContentsFormatFlags)
 {
 }
 } // namespace WebCore
@@ -308,7 +308,7 @@
         [m_layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
 
     if (m_layerType == LayerTypeWebLayer || m_layerType == LayerTypeTiledBackingTileLayer)
-        setBackingStoreFormat(m_layer.get());
+        setBackingStoreFormat(m_layer.get(), 0);
 
     // So that the scrolling thread's performance logging code can find all the tiles, mark this as being a tile.
     if (m_layerType == LayerTypeTiledBackingTileLayer)
@@ -545,6 +545,22 @@
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
+void PlatformCALayerCocoa::setContentsFormat(ContentsFormatFlags flags)
+{
+    if (flags == m_contentsFormatFlags)
+        return;
+
+    m_contentsFormatFlags = flags;
+
+    if (usesTiledBackingLayer()) {
+        WebTiledBackingLayer* tiledBackingLayer = static_cast<WebTiledBackingLayer*>(m_layer.get());
+        tiledBackingLayer.tiledBacking->setTileContentsFormatFlags(flags);
+        return;
+    }
+
+    setBackingStoreFormat(m_layer.get(), flags);
+}
+
 FloatRect PlatformCALayerCocoa::bounds() const
 {
     return [m_layer bounds];
@@ -1056,7 +1072,7 @@
     graphicsContext.setIsCALayerContext(true);
     graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing());
     
-    if (!layerContents->platformCALayerContentsOpaque()) {
+    if (!layerContents->platformCALayerContentsOpaque() && !(platformCALayer->contentsFormat() & SmoothedFonts)) {
         // 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/win/PlatformCALayerWin.cpp (197980 => 197981)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -377,6 +377,16 @@
     setNeedsCommit();
 }
 
+void PlatformCALayerWin::setContentsFormat(ContentsFormatFlags formatFlags)
+{
+    m_contentsFormat = formatFlags;
+}
+
+PlatformCALayer::ContentsFormatFlags PlatformCALayerWin::contentsFormat() const
+{
+    return m_contentsFormat;
+}
+
 FloatRect PlatformCALayerWin::bounds() const
 {
     return CACFLayerGetBounds(m_layer.get());

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


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -64,6 +64,9 @@
     bool isOpaque() const override;
     void setOpaque(bool) override;
 
+    void setContentsFormat(ContentsFormatFlags) override;
+    ContentsFormatFlags contentsFormat() const override;
+
     FloatRect bounds() const override;
     void setBounds(const FloatRect&) override;
 
@@ -163,6 +166,7 @@
     HashMap<String, RefPtr<PlatformCAAnimation>> m_animations;
     std::unique_ptr<PlatformCALayerList> m_customSublayers;
     GraphicsLayer::CustomAppearance m_customAppearance;
+    ContentsFormatFlags m_contentsFormat { 0 };
 };
 
 }

Modified: trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm (197980 => 197981)


--- trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm	2016-03-11 01:49:22 UTC (rev 197981)
@@ -28,11 +28,13 @@
 
 #if PLATFORM(IOS)
 
+#include "BlockExceptions.h"
 #include "Color.h"
 #include "LegacyTileCache.h"
 #include "LegacyTileGrid.h"
 #include "LegacyTileLayer.h"
 #include "LegacyTileLayerPool.h"
+#include "PlatformCALayer.h"
 #include "QuartzCoreSPI.h"
 #include "WAKWindow.h"
 #include <algorithm>
@@ -43,7 +45,7 @@
 #import <WebKitAdditions/LayerBackingStoreAdditions.mm>
 #else
 namespace WebCore {
-static void setBackingStoreFormat(CALayer *)
+static void setBackingStoreFormat(CALayer *, PlatformCALayer::ContentsFormatFlags)
 {
 }
 } // namespace WebCore
@@ -71,7 +73,7 @@
         m_tileLayer = adoptNS([[LegacyTileLayer alloc] init]);
     }
     LegacyTileLayer* layer = m_tileLayer.get();
-    setBackingStoreFormat(layer);
+    setBackingStoreFormat(layer, 0);
     [layer setTileGrid:tileGrid];
     [layer setOpaque:m_tileGrid->tileCache().tilesOpaque()];
     [layer setEdgeAntialiasingMask:0];

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (197980 => 197981)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -178,6 +178,10 @@
     graphicsLayer->setAcceleratesDrawing(compositor().acceleratedDrawingEnabled());
     graphicsLayer->setUsesDisplayListDrawing(compositor().displayListDrawingEnabled());
 #endif
+
+    // FIXME: ideally we'd only do this if the layer contains smoothed text.
+    if (GraphicsLayer::supportsSmoothedLayerText())
+        graphicsLayer->setSupportsSmoothedFonts(true);
     
     return graphicsLayer;
 }

Modified: trunk/Source/WebKit/mac/ChangeLog (197980 => 197981)


--- trunk/Source/WebKit/mac/ChangeLog	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-03-11 01:49:22 UTC (rev 197981)
@@ -1,3 +1,18 @@
+2016-03-10  Simon Fraser  <[email protected]>
+
+        Font antialiasing (smoothing) changes when elements are rendered into compositing layers
+        https://bugs.webkit.org/show_bug.cgi?id=23364
+
+        Reviewed by Tim Horton.
+
+        Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
+        can disable it.
+
+        * WebView/WebView.mm:
+        (+[WebView _setSmoothedLayerTextEnabled:]):
+        (+[WebView _smoothedLayerTextEnabled]):
+        * WebView/WebViewPrivate.h:
+
 2016-03-10  Jer Noble  <[email protected]>
 
         Add WebCore, WebKit, & WebKit2 preference/setting to enable Main Content heuristic.

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (197980 => 197981)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2016-03-11 01:49:22 UTC (rev 197981)
@@ -140,6 +140,7 @@
 #import <WebCore/GCController.h>
 #import <WebCore/GeolocationController.h>
 #import <WebCore/GeolocationError.h>
+#import <WebCore/GraphicsLayer.h>
 #import <WebCore/HTMLNames.h>
 #import <WebCore/HTMLVideoElement.h>
 #import <WebCore/HistoryController.h>
@@ -3236,6 +3237,16 @@
     return FontCascade::shouldUseSmoothing();
 }
 
++ (void)_setSmoothedLayerTextEnabled:(BOOL)f
+{
+    GraphicsLayer::setSmoothedLayerTextEnabled(f);
+}
+
++ (BOOL)_smoothedLayerTextEnabled
+{
+    return GraphicsLayer::smoothedLayerTextEnabled();
+}
+
 #if !PLATFORM(IOS)
 + (void)_setUsesTestModeFocusRingColor:(BOOL)f
 {

Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (197980 => 197981)


--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -532,6 +532,9 @@
 + (void)_setShouldUseFontSmoothing:(BOOL)f;
 + (BOOL)_shouldUseFontSmoothing;
 
++ (void)_setSmoothedLayerTextEnabled:(BOOL)f;
++ (BOOL)_smoothedLayerTextEnabled;
+
 #if !TARGET_OS_IPHONE
 // These two methods are useful for a test harness that needs a consistent appearance for the focus rings
 // regardless of OS X version.

Modified: trunk/Source/WebKit2/ChangeLog (197980 => 197981)


--- trunk/Source/WebKit2/ChangeLog	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-11 01:49:22 UTC (rev 197981)
@@ -1,3 +1,42 @@
+2016-03-10  Simon Fraser  <[email protected]>
+
+        Font antialiasing (smoothing) changes when elements are rendered into compositing layers
+        https://bugs.webkit.org/show_bug.cgi?id=23364
+
+        Reviewed by Tim Horton.
+
+        Send the ContentsFormat to the UI process (but nothing happens to it there yet).
+
+        Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
+        can disable it.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextEnableSmoothedLayerText):
+        * UIProcess/API/C/WKContextPrivate.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createNewWebProcess):
+        (WebKit::WebProcessPool::enableSmoothedLayerText):
+        (WebKit::WebProcessPool::WebProcessPool): Deleted.
+        * UIProcess/WebProcessPool.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::setContentsFormat):
+        (WebKit::PlatformCALayerRemote::contentsFormat):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        (WebKit::WebProcess::enableSmoothedLayerText):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
 2016-03-10  Enrica Casucci  <[email protected]>
 
         Expose additional WKDataDetectorTypes.

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (197980 => 197981)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -35,20 +35,7 @@
 namespace WebKit {
 
 WebProcessCreationParameters::WebProcessCreationParameters()
-    : shouldAlwaysUseComplexTextCodePath(false)
-    , shouldEnableMemoryPressureReliefLogging(false)
-    , shouldUseFontSmoothing(true)
-    , defaultRequestTimeoutInterval(INT_MAX)
-#if PLATFORM(COCOA)
-    , shouldEnableJIT(false)
-    , shouldEnableFTLJIT(false)
-#endif
-    , memoryCacheDisabled(false)
-#if ENABLE(SERVICE_CONTROLS)
-    , hasImageServices(false)
-    , hasSelectionServices(false)
-    , hasRichContentServices(false)
-#endif
+    : defaultRequestTimeoutInterval(INT_MAX)
 {
 }
 
@@ -96,6 +83,7 @@
     encoder << shouldEnableMemoryPressureReliefLogging;
     encoder << shouldSuppressMemoryPressureHandler;
     encoder << shouldUseFontSmoothing;
+    encoder << enabledSmoothedLayerText;
     encoder << resourceLoadStatisticsEnabled;
     encoder << fontWhitelist;
     encoder << iconDatabaseEnabled;
@@ -214,6 +202,8 @@
         return false;
     if (!decoder.decode(parameters.shouldUseFontSmoothing))
         return false;
+    if (!decoder.decode(parameters.enabledSmoothedLayerText))
+        return false;
     if (!decoder.decode(parameters.resourceLoadStatisticsEnabled))
         return false;
     if (!decoder.decode(parameters.fontWhitelist))

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (197980 => 197981)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -103,10 +103,11 @@
 
     CacheModel cacheModel;
 
-    bool shouldAlwaysUseComplexTextCodePath;
-    bool shouldEnableMemoryPressureReliefLogging;
+    bool shouldAlwaysUseComplexTextCodePath { false };
+    bool shouldEnableMemoryPressureReliefLogging { false };
     bool shouldSuppressMemoryPressureHandler { false };
-    bool shouldUseFontSmoothing;
+    bool shouldUseFontSmoothing { true };
+    bool enabledSmoothedLayerText { true };
     bool resourceLoadStatisticsEnabled { false };
 
     Vector<String> fontWhitelist;
@@ -138,8 +139,8 @@
     String uiProcessBundleResourcePath;
     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
 
-    bool shouldEnableJIT;
-    bool shouldEnableFTLJIT;
+    bool shouldEnableJIT { false };
+    bool shouldEnableFTLJIT { false };
     
     RefPtr<API::Data> bundleParameterData;
 
@@ -152,12 +153,12 @@
     HashMap<WebCore::SessionID, HashMap<unsigned, double>> plugInAutoStartOriginHashes;
     Vector<String> plugInAutoStartOrigins;
 
-    bool memoryCacheDisabled;
+    bool memoryCacheDisabled { false };
 
 #if ENABLE(SERVICE_CONTROLS)
-    bool hasImageServices;
-    bool hasSelectionServices;
-    bool hasRichContentServices;
+    bool hasImageServices { false };
+    bool hasSelectionServices { false };
+    bool hasRichContentServices { false };
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (197980 => 197981)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -87,7 +87,8 @@
         FiltersChanged                  = 1LLU << 32,
         AnimationsChanged               = 1LLU << 33,
         EdgeAntialiasingMaskChanged     = 1LLU << 34,
-        CustomAppearanceChanged         = 1LLU << 35,
+        ContentsFormatFlagsChanged      = 1LLU << 35,
+        CustomAppearanceChanged         = 1LLU << 36,
     };
     typedef uint64_t LayerChange;
 
@@ -153,6 +154,7 @@
         WebCore::Color backgroundColor;
         WebCore::Color borderColor;
         unsigned edgeAntialiasingMask;
+        WebCore::PlatformCALayer::ContentsFormatFlags contentsFormatFlags;
         WebCore::GraphicsLayer::CustomAppearance customAppearance;
         WebCore::PlatformCALayer::FilterType minificationFilter;
         WebCore::PlatformCALayer::FilterType magnificationFilter;

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (197980 => 197981)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2016-03-11 01:49:22 UTC (rev 197981)
@@ -211,6 +211,9 @@
     if (changedProperties & OpaqueChanged)
         encoder << opaque;
 
+    if (changedProperties & ContentsFormatFlagsChanged)
+        encoder << contentsFormatFlags;
+
     if (changedProperties & MaskLayerChanged)
         encoder << maskLayerID;
 
@@ -374,6 +377,11 @@
             return false;
     }
 
+    if (result.changedProperties & ContentsFormatFlagsChanged) {
+        if (!decoder.decode(result.contentsFormatFlags))
+            return false;
+    }
+
     if (result.changedProperties & MaskLayerChanged) {
         if (!decoder.decode(result.maskLayerID))
             return false;

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp (197980 => 197981)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -347,6 +347,11 @@
     toImpl(contextRef)->setShouldUseFontSmoothing(useFontSmoothing);
 }
 
+void WKContextEnableSmoothedLayerText(WKContextRef contextRef, bool smoothedLayerText)
+{
+    toImpl(contextRef)->enableSmoothedLayerText(smoothedLayerText);
+}
+
 void WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory)
 {
 #if ENABLE(NETSCAPE_PLUGIN_API)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h (197980 => 197981)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -50,6 +50,8 @@
 
 WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool useFontSmoothing);
 
+WK_EXPORT void WKContextEnableSmoothedLayerText(WKContextRef context, bool);
+
 WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme);
 
 WK_EXPORT void WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(WKContextRef context, WKStringRef urlScheme);

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (197980 => 197981)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -148,8 +148,6 @@
     , m_visitedLinkStore(VisitedLinkStore::create())
     , m_visitedLinksPopulated(false)
     , m_plugInAutoStartProvider(this)
-    , m_alwaysUsesComplexTextCodePath(false)
-    , m_shouldUseFontSmoothing(true)
     , m_memorySamplerEnabled(false)
     , m_memorySamplerInterval(1400.0)
     , m_websiteDataStore(m_configuration->shouldHaveLegacyDataStore() ? API::WebsiteDataStore::create(legacyWebsiteDataStoreConfiguration(m_configuration)).ptr() : nullptr)
@@ -586,6 +584,7 @@
 
     parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath;
     parameters.shouldUseFontSmoothing = m_shouldUseFontSmoothing;
+    parameters.enabledSmoothedLayerText = m_enabledSmoothedLayerText;
 
     // FIXME: This leaves UI process and WebProcess disagreeing about the state if the client hasn't set the path.
     // iconDatabasePath is non-empty by default, but m_iconDatabase isn't enabled in UI process unless setDatabasePath is called explicitly.
@@ -872,6 +871,12 @@
     sendToAllProcesses(Messages::WebProcess::SetShouldUseFontSmoothing(useFontSmoothing));
 }
 
+void WebProcessPool::enableSmoothedLayerText(bool enableSmoothedText)
+{
+    m_enabledSmoothedLayerText = enableSmoothedText;
+    sendToAllProcesses(Messages::WebProcess::EnableSmoothedLayerText(enableSmoothedText));
+}
+
 void WebProcessPool::registerURLSchemeAsEmptyDocument(const String& urlScheme)
 {
     m_schemesToRegisterAsEmptyDocument.add(urlScheme);

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (197980 => 197981)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -191,6 +191,7 @@
 
     void setAlwaysUsesComplexTextCodePath(bool);
     void setShouldUseFontSmoothing(bool);
+    void enableSmoothedLayerText(bool);
     
     void registerURLSchemeAsEmptyDocument(const String&);
     void registerURLSchemeAsSecure(const String&);
@@ -463,8 +464,9 @@
     HashSet<String> m_schemesToRegisterAsCachePartitioned;
 #endif
 
-    bool m_alwaysUsesComplexTextCodePath;
-    bool m_shouldUseFontSmoothing;
+    bool m_alwaysUsesComplexTextCodePath { false };
+    bool m_shouldUseFontSmoothing { true };
+    bool m_enabledSmoothedLayerText { true };
 
     Vector<String> m_fontWhitelist;
 

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -401,6 +401,20 @@
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MaskLayerChanged);
 }
 
+void PlatformCALayerRemote::setContentsFormat(ContentsFormatFlags formatFlags)
+{
+    if (formatFlags == m_properties.contentsFormatFlags)
+        return;
+
+    m_properties.contentsFormatFlags = formatFlags;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsFormatFlagsChanged);
+}
+
+PlatformCALayer::ContentsFormatFlags PlatformCALayerRemote::contentsFormat() const
+{
+    return m_properties.contentsFormatFlags;
+}
+
 void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer)
 {
     if (isEquivalentLayer(layer, m_properties.clonedLayerID))

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -76,6 +76,9 @@
     bool isOpaque() const override;
     void setOpaque(bool) override;
 
+    void setContentsFormat(ContentsFormatFlags) override;
+    ContentsFormatFlags contentsFormat() const override;
+
     WebCore::FloatRect bounds() const override;
     void setBounds(const WebCore::FloatRect&) override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (197980 => 197981)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -76,6 +76,7 @@
 #include <WebCore/FrameLoader.h>
 #include <WebCore/GCController.h>
 #include <WebCore/GlyphPage.h>
+#include <WebCore/GraphicsLayer.h>
 #include <WebCore/IconDatabase.h>
 #include <WebCore/JSDOMWindow.h>
 #include <WebCore/Language.h>
@@ -343,6 +344,8 @@
     if (parameters.shouldUseFontSmoothing)
         setShouldUseFontSmoothing(true);
 
+    enableSmoothedLayerText(parameters.enabledSmoothedLayerText);
+        
 #if PLATFORM(COCOA) || USE(CFNETWORK)
     setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
     SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
@@ -476,6 +479,11 @@
     WebCore::FontCascade::setShouldUseSmoothing(useFontSmoothing);
 }
 
+void WebProcess::enableSmoothedLayerText(bool smoothedLayerText)
+{
+    WebCore::GraphicsLayer::setSmoothedLayerTextEnabled(smoothedLayerText);
+}
+
 void WebProcess::userPreferredLanguagesChanged(const Vector<String>& languages) const
 {
     overrideUserPreferredLanguages(languages);

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (197980 => 197981)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2016-03-11 01:49:22 UTC (rev 197981)
@@ -238,6 +238,8 @@
     void setDefaultRequestTimeoutInterval(double);
     void setAlwaysUsesComplexTextCodePath(bool);
     void setShouldUseFontSmoothing(bool);
+    void enableSmoothedLayerText(bool);
+
     void setResourceLoadStatisticsEnabled(bool);
     void userPreferredLanguagesChanged(const Vector<String>&) const;
     void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (197980 => 197981)


--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in	2016-03-11 01:49:22 UTC (rev 197981)
@@ -42,6 +42,7 @@
     SetDefaultRequestTimeoutInterval(double timeoutInterval)
     SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
     SetShouldUseFontSmoothing(bool useFontSmoothing)
+    EnableSmoothedLayerText(bool smoothedLayerText)
     SetResourceLoadStatisticsEnabled(bool resourceLoadStatisticsEnabled);
     UserPreferredLanguagesChanged(Vector<String> languages)
     FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)

Modified: trunk/Tools/ChangeLog (197980 => 197981)


--- trunk/Tools/ChangeLog	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Tools/ChangeLog	2016-03-11 01:49:22 UTC (rev 197981)
@@ -1,3 +1,17 @@
+2016-03-10  Simon Fraser  <[email protected]>
+
+        Font antialiasing (smoothing) changes when elements are rendered into compositing layers
+        https://bugs.webkit.org/show_bug.cgi?id=23364
+
+        Reviewed by Tim Horton.
+
+        Turn off smoothed layer text because it affects many layout test results.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues):
+
 2016-03-10  Jer Noble  <[email protected]>
 
         Partial roll-out of r197953; test fails because encode/decode support of those properties were never added.

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (197980 => 197981)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-03-11 01:49:22 UTC (rev 197981)
@@ -1847,6 +1847,7 @@
     [[webView window] setAutodisplay:NO];
 #endif
     [webView setTracksRepaints:NO];
+    [WebView _setSmoothedLayerTextEnabled:NO];
 
     [WebCache clearCachedCredentials];
     

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (197980 => 197981)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2016-03-11 01:46:31 UTC (rev 197980)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2016-03-11 01:49:22 UTC (rev 197981)
@@ -717,6 +717,7 @@
     WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), resetMessageBody.get());
 
     WKContextSetShouldUseFontSmoothing(TestController::singleton().context(), false);
+    WKContextEnableSmoothedLayerText(TestController::singleton().context(), false);
 
     WKContextSetCacheModel(TestController::singleton().context(), kWKCacheModelDocumentBrowser);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to