Changeset 197923 in webkit


Ignore:
Timestamp:
Mar 9, 2016, 9:26:25 PM (9 years ago)
Author:
Simon Fraser
Message:

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

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::supportsSmoothedFontsInNonOpaqueLayers):
(WebCore::GraphicsLayer::GraphicsLayer):

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::supportsSmoothedFonts):
(WebCore::GraphicsLayer::setSupportsSmoothedFonts):

  • platform/graphics/TiledBacking.h:
  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
(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/ios/LegacyTileGridTile.mm:

(WebCore::setBackingStoreFormat):
(WebCore::LegacyTileGridTile::LegacyTileGridTile):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::createGraphicsLayer):

Source/WebKit2:

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

  • Shared/mac/RemoteLayerTreeTransaction.h:
  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::setContentsFormat):
(WebKit::PlatformCALayerRemote::contentsFormat):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.h:
Location:
trunk/Source
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r197922 r197923  
     12016-03-09  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Font antialiasing (smoothing) changes when elements are rendered into compositing layers
     4        https://bugs.webkit.org/show_bug.cgi?id=23364
     5        rdar://problem/7288429
     6
     7        Reviewed by Tim Horton.
     8
     9        Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
     10        by opting in to a new CALayer backing store format.
     11       
     12        GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
     13        when the platform has support for the new feature. Ideally this would only be set when
     14        we know a layer has smoothed text drawn into it, but, for now, enable this for all
     15        layers. The right thing happens with opaque layers under the hood.
     16       
     17        setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
     18        is ultimately passed to setBackingStoreFormat().
     19       
     20        We also need to propagate this flag to TileController tiles.
     21
     22        * platform/graphics/GraphicsLayer.cpp:
     23        (WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
     24        (WebCore::GraphicsLayer::GraphicsLayer):
     25        * platform/graphics/GraphicsLayer.h:
     26        (WebCore::GraphicsLayer::supportsSmoothedFonts):
     27        (WebCore::GraphicsLayer::setSupportsSmoothedFonts):
     28        * platform/graphics/TiledBacking.h:
     29        * platform/graphics/ca/GraphicsLayerCA.cpp:
     30        (WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
     31        (WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
     32        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
     33        (WebCore::GraphicsLayerCA::updateContentsFormat):
     34        * platform/graphics/ca/GraphicsLayerCA.h:
     35        * platform/graphics/ca/PlatformCALayer.cpp:
     36        (WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
     37        the contents format says we support smoothed fonts.
     38        * platform/graphics/ca/PlatformCALayer.h:
     39        * platform/graphics/ca/TileController.cpp:
     40        (WebCore::TileController::setTileContentsFormatFlags):
     41        (WebCore::TileController::createTileLayer):
     42        * platform/graphics/ca/TileController.h:
     43        * platform/graphics/ca/TileGrid.cpp:
     44        (WebCore::TileGrid::updateTileLayerProperties):
     45        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
     46        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
     47        (WebCore::setBackingStoreFormat):
     48        (PlatformCALayerCocoa::commonInit):
     49        (PlatformCALayerCocoa::setContentsFormat):
     50        (PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
     51        non-opaque layers to improve text appearance. We no longer need to do that when
     52        the contents format has "SmoothedFonts".
     53        * platform/ios/LegacyTileGridTile.mm:
     54        (WebCore::setBackingStoreFormat):
     55        (WebCore::LegacyTileGridTile::LegacyTileGridTile):
     56        * rendering/RenderLayerBacking.cpp:
     57        (WebCore::RenderLayerBacking::createGraphicsLayer):
     58
    1592016-03-09  Gavin Barraclough  <barraclough@apple.com>
    260
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r195515 r197923  
    106106#endif
    107107
     108#if !USE(CA)
     109bool GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers()
     110{
     111    return false;
     112}
     113#endif
     114
    108115GraphicsLayer::GraphicsLayer(Type type, GraphicsLayerClient& client)
    109116    : m_client(client)
     
    116123    , m_type(type)
    117124    , m_contentsOpaque(false)
     125    , m_supportsSmoothedFonts(false)
    118126    , m_preserves3D(false)
    119127    , m_backfaceVisibility(true)
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r197563 r197923  
    365365    virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; }
    366366
     367    bool supportsSmoothedFonts() const { return m_supportsSmoothedFonts; }
     368    virtual void setSupportsSmoothedFonts(bool b) { m_supportsSmoothedFonts = b; }
     369
    367370    bool backfaceVisibility() const { return m_backfaceVisibility; }
    368371    virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; }
     
    541544    static bool supportsLayerType(Type);
    542545    static bool supportsContentsTiling();
     546    static bool supportsSmoothedFontsInNonOpaqueLayers();
    543547
    544548    void updateDebugIndicators();
     
    614618
    615619    bool m_contentsOpaque : 1;
     620    bool m_supportsSmoothedFonts : 1;
    616621    bool m_preserves3D: 1;
    617622    bool m_backfaceVisibility : 1;
  • trunk/Source/WebCore/platform/graphics/TiledBacking.h

    r197541 r197923  
    8080    virtual void setTopContentInset(float) = 0;
    8181
     82    virtual void setTileContentsFormatFlags(unsigned) = 0;
     83
    8284    virtual void setVelocity(const VelocityData&) = 0;
    8385   
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r197541 r197923  
    310310}
    311311
     312bool GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers()
     313{
     314#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     315    return true;
     316#endif
     317    return false;
     318}
     319
    312320std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
    313321{
     
    708716    GraphicsLayer::setContentsOpaque(opaque);
    709717    noteLayerPropertyChanged(ContentsOpaqueChanged);
     718}
     719
     720void GraphicsLayerCA::setSupportsSmoothedFonts(bool supportsSmoothedFonts)
     721{
     722    if (m_supportsSmoothedFonts == supportsSmoothedFonts)
     723        return;
     724
     725    GraphicsLayer::setSupportsSmoothedFonts(supportsSmoothedFonts);
     726    noteLayerPropertyChanged(ContentsFormatChanged);
    710727}
    711728
     
    15811598        updateContentsOpaque(pageScaleFactor);
    15821599
     1600    if (m_uncommittedChanges & ContentsFormatChanged)
     1601        updateContentsFormat();
     1602
    15831603    if (m_uncommittedChanges & BackfaceVisibilityChanged)
    15841604        updateBackfaceVisibility();
     
    18881908        for (auto& layer : layerCloneMap->values())
    18891909            layer->setOpaque(contentsOpaque);
     1910    }
     1911}
     1912
     1913void GraphicsLayerCA::updateContentsFormat()
     1914{
     1915    PlatformCALayer::ContentsFormatFlags formatFlags = 0;
     1916    if (supportsSmoothedFonts())
     1917        formatFlags |= PlatformCALayer::SmoothedFonts;
     1918
     1919    m_layer->setContentsFormat(formatFlags);
     1920
     1921    if (LayerMap* layerCloneMap = m_layerClones.get()) {
     1922        for (auto& layer : layerCloneMap->values())
     1923            layer->setContentsFormat(formatFlags);
    18901924    }
    18911925}
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r197563 r197923  
    9696
    9797    WEBCORE_EXPORT void setContentsOpaque(bool) override;
     98    WEBCORE_EXPORT void setSupportsSmoothedFonts(bool) override;
     99
    98100    WEBCORE_EXPORT void setBackfaceVisibility(bool) override;
    99101
     
    392394    void updateContentsVisibility();
    393395    void updateContentsOpaque(float pageScaleFactor);
     396    void updateContentsFormat();
    394397    void updateBackfaceVisibility();
    395398    void updateStructuralLayer();
     
    456459
    457460    enum LayerChange : uint64_t {
    458         NoChange =                      0,
    459         NameChanged =                   1LLU << 1,
    460         ChildrenChanged =               1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
    461         GeometryChanged =               1LLU << 3,
    462         TransformChanged =              1LLU << 4,
    463         ChildrenTransformChanged =      1LLU << 5,
    464         Preserves3DChanged =            1LLU << 6,
    465         MasksToBoundsChanged =          1LLU << 7,
    466         DrawsContentChanged =           1LLU << 8,
    467         BackgroundColorChanged =        1LLU << 9,
    468         ContentsOpaqueChanged =         1LLU << 10,
    469         BackfaceVisibilityChanged =     1LLU << 11,
    470         OpacityChanged =                1LLU << 12,
    471         AnimationChanged =              1LLU << 13,
    472         DirtyRectsChanged =             1LLU << 14,
    473         ContentsImageChanged =          1LLU << 15,
    474         ContentsPlatformLayerChanged =  1LLU << 16,
    475         ContentsColorLayerChanged =     1LLU << 17,
    476         ContentsRectsChanged =          1LLU << 18,
    477         MasksToBoundsRectChanged =      1LLU << 19,
    478         MaskLayerChanged =              1LLU << 20,
    479         ReplicatedLayerChanged =        1LLU << 21,
    480         ContentsNeedsDisplay =          1LLU << 22,
    481         AcceleratesDrawingChanged =     1LLU << 23,
    482         ContentsScaleChanged =          1LLU << 24,
    483         ContentsVisibilityChanged =     1LLU << 25,
    484         CoverageRectChanged =           1LLU << 26,
    485         FiltersChanged =                1LLU << 27,
    486         BackdropFiltersChanged =        1LLU << 28,
    487         BackdropFiltersRectChanged =    1LLU << 29,
    488         TilingAreaChanged =             1LLU << 30,
    489         TilesAdded =                    1LLU << 31,
    490         DebugIndicatorsChanged =        1LLU << 32,
    491         CustomAppearanceChanged =       1LLU << 33,
    492         BlendModeChanged =              1LLU << 34,
    493         ShapeChanged =                  1LLU << 35,
    494         WindRuleChanged =               1LLU << 36,
     461        NoChange                        = 0,
     462        NameChanged                     = 1LLU << 1,
     463        ChildrenChanged                 = 1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
     464        GeometryChanged                 = 1LLU << 3,
     465        TransformChanged                = 1LLU << 4,
     466        ChildrenTransformChanged        = 1LLU << 5,
     467        Preserves3DChanged              = 1LLU << 6,
     468        MasksToBoundsChanged            = 1LLU << 7,
     469        DrawsContentChanged             = 1LLU << 8,
     470        BackgroundColorChanged          = 1LLU << 9,
     471        ContentsOpaqueChanged           = 1LLU << 10,
     472        ContentsFormatChanged           = 1LLU << 11,
     473        BackfaceVisibilityChanged       = 1LLU << 12,
     474        OpacityChanged                  = 1LLU << 13,
     475        AnimationChanged                = 1LLU << 14,
     476        DirtyRectsChanged               = 1LLU << 15,
     477        ContentsImageChanged            = 1LLU << 16,
     478        ContentsPlatformLayerChanged    = 1LLU << 17,
     479        ContentsColorLayerChanged       = 1LLU << 18,
     480        ContentsRectsChanged            = 1LLU << 19,
     481        MasksToBoundsRectChanged        = 1LLU << 20,
     482        MaskLayerChanged                = 1LLU << 21,
     483        ReplicatedLayerChanged          = 1LLU << 22,
     484        ContentsNeedsDisplay            = 1LLU << 23,
     485        AcceleratesDrawingChanged       = 1LLU << 24,
     486        ContentsScaleChanged            = 1LLU << 25,
     487        ContentsVisibilityChanged       = 1LLU << 26,
     488        CoverageRectChanged             = 1LLU << 27,
     489        FiltersChanged                  = 1LLU << 28,
     490        BackdropFiltersChanged          = 1LLU << 29,
     491        BackdropFiltersRectChanged      = 1LLU << 30,
     492        TilingAreaChanged               = 1LLU << 31,
     493        TilesAdded                      = 1LLU << 32,
     494        DebugIndicatorsChanged          = 1LLU << 33,
     495        CustomAppearanceChanged         = 1LLU << 34,
     496        BlendModeChanged                = 1LLU << 35,
     497        ShapeChanged                    = 1LLU << 36,
     498        WindRuleChanged                 = 1LLU << 37,
    495499    };
    496500    typedef uint64_t LayerChangeFlags;
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp

    r194825 r197923  
    8181   
    8282    CGContextFillRect(context, indicatorBox);
    83    
     83
     84    if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) {
     85        CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65);
     86        CGContextSetLineWidth(context, 2);
     87        CGContextStrokeRect(context, indicatorBox);
     88    }
     89   
     90    if (!platformCALayer->isOpaque() && (platformCALayer->contentsFormat() & SmoothedFonts)) {
     91        CGContextSetRGBFillColor(context, 1, 1, 1, 0.4);
     92        platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 7, indicatorBox.origin.y + 24, CGSizeMake(1, -1), 22, text, strlen(text));
     93    }
     94
    8495    if (platformCALayer->acceleratesDrawing())
    8596        CGContextSetRGBFillColor(context, 1, 0, 0, 1);
    8697    else
    8798        CGContextSetRGBFillColor(context, 1, 1, 1, 1);
    88 
    89     if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) {
    90         CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65);
    91         CGContextSetLineWidth(context, 2);
    92         CGContextStrokeRect(context, indicatorBox);
    93     }
    9499   
    95100    platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, CGSizeMake(1, -1), 22, text, strlen(text));
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r193382 r197923  
    140140    virtual void setOpaque(bool) = 0;
    141141
     142    enum ContentsFormatFlag {
     143        DeepColor       = 1 << 0,
     144        SmoothedFonts   = 1 << 1,
     145    };
     146    typedef unsigned ContentsFormatFlags;
     147    virtual void setContentsFormat(ContentsFormatFlags) = 0;
     148    virtual ContentsFormatFlags contentsFormat() const = 0;
     149
    142150    virtual FloatRect bounds() const = 0;
    143151    virtual void setBounds(const FloatRect&) = 0;
  • trunk/Source/WebCore/platform/graphics/ca/TileController.cpp

    r197593 r197923  
    176176}
    177177
     178void TileController::setTileContentsFormatFlags(PlatformCALayer::ContentsFormatFlags flags)
     179{
     180    if (flags == m_contentsFormatFlags)
     181        return;
     182
     183    m_contentsFormatFlags = flags;
     184    tileGrid().updateTileLayerProperties();
     185}
     186
    178187void TileController::setVisibleRect(const FloatRect& rect)
    179188{
     
    676685    layer->setEdgeAntialiasingMask(0);
    677686    layer->setOpaque(m_tilesAreOpaque);
     687    layer->setContentsFormat(m_contentsFormatFlags);
    678688#ifndef NDEBUG
    679689    layer->setName("Tile");
  • trunk/Source/WebCore/platform/graphics/ca/TileController.h

    r197593 r197923  
    7878    WEBCORE_EXPORT void setTilesOpaque(bool);
    7979    bool tilesAreOpaque() const { return m_tilesAreOpaque; }
     80
     81    void setTileContentsFormatFlags(PlatformCALayer::ContentsFormatFlags) override;
     82    PlatformCALayer::ContentsFormatFlags tileContentsFormatFlags() const { return m_contentsFormatFlags; }
    8083
    8184    PlatformCALayer& rootLayer() { return *m_tileCacheLayer; }
     
    207210    int m_marginSize { kDefaultTileSize };
    208211
     212    PlatformCALayer::ContentsFormatFlags m_contentsFormatFlags { 0 };
     213
    209214    // m_marginTop and m_marginBottom are the height in pixels of the top and bottom margin tiles. The width
    210215    // of those tiles will be equivalent to the width of the other tiles in the grid. m_marginRight and
  • trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp

    r197594 r197923  
    176176    bool acceleratesDrawing = m_controller.acceleratesDrawing();
    177177    bool opaque = m_controller.tilesAreOpaque();
     178    PlatformCALayer::ContentsFormatFlags formatFlags = m_controller.tileContentsFormatFlags();
    178179    Color tileDebugBorderColor = m_controller.tileDebugBorderColor();
    179180    float tileDebugBorderWidth = m_controller.tileDebugBorderWidth();
     
    183184        tileInfo.layer->setAcceleratesDrawing(acceleratesDrawing);
    184185        tileInfo.layer->setOpaque(opaque);
     186        tileInfo.layer->setContentsFormat(formatFlags);
    185187        tileInfo.layer->setBorderColor(tileDebugBorderColor);
    186188        tileInfo.layer->setBorderWidth(tileDebugBorderWidth);
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h

    r197563 r197923  
    7272    bool isOpaque() const override;
    7373    void setOpaque(bool) override;
     74
     75    void setContentsFormat(ContentsFormatFlags) override;
     76    ContentsFormatFlags contentsFormat() const override { return m_contentsFormatFlags; }
    7477
    7578    FloatRect bounds() const override;
     
    180183    GraphicsLayer::CustomAppearance m_customAppearance;
    181184    std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
     185    ContentsFormatFlags m_contentsFormatFlags { 0 };
    182186};
    183187
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm

    r197382 r197923  
    7070#else
    7171namespace WebCore {
    72 static void setBackingStoreFormat(CALayer *)
     72static void setBackingStoreFormat(CALayer *, PlatformCALayer::ContentsFormatFlags)
    7373{
    7474}
     
    309309
    310310    if (m_layerType == LayerTypeWebLayer || m_layerType == LayerTypeTiledBackingTileLayer)
    311         setBackingStoreFormat(m_layer.get());
     311        setBackingStoreFormat(m_layer.get(), 0);
    312312
    313313    // So that the scrolling thread's performance logging code can find all the tiles, mark this as being a tile.
     
    546546}
    547547
     548void PlatformCALayerCocoa::setContentsFormat(ContentsFormatFlags flags)
     549{
     550    if (flags == m_contentsFormatFlags)
     551        return;
     552
     553    m_contentsFormatFlags = flags;
     554
     555    if (usesTiledBackingLayer()) {
     556        WebTiledBackingLayer* tiledBackingLayer = static_cast<WebTiledBackingLayer*>(m_layer.get());
     557        tiledBackingLayer.tiledBacking->setTileContentsFormatFlags(flags);
     558        return;
     559    }
     560
     561    setBackingStoreFormat(m_layer.get(), flags);
     562}
     563
    548564FloatRect PlatformCALayerCocoa::bounds() const
    549565{
     
    10571073    graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing());
    10581074   
    1059     if (!layerContents->platformCALayerContentsOpaque()) {
     1075    if (!layerContents->platformCALayerContentsOpaque() && !(platformCALayer->contentsFormat() & SmoothedFonts)) {
    10601076        // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
    10611077        graphicsContext.setShouldSmoothFonts(false);
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp

    r192143 r197923  
    378378}
    379379
     380void PlatformCALayerWin::setContentsFormat(ContentsFormatFlags formatFlags)
     381{
     382    m_contentsFormat = formatFlags;
     383}
     384
     385PlatformCALayer::ContentsFormatFlags PlatformCALayerWin::contentsFormat() const
     386{
     387    return m_contentsFormat;
     388}
     389
    380390FloatRect PlatformCALayerWin::bounds() const
    381391{
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h

    r197563 r197923  
    6464    bool isOpaque() const override;
    6565    void setOpaque(bool) override;
     66
     67    void setContentsFormat(ContentsFormatFlags) override;
     68    ContentsFormatFlags contentsFormat() const override;
    6669
    6770    FloatRect bounds() const override;
     
    164167    std::unique_ptr<PlatformCALayerList> m_customSublayers;
    165168    GraphicsLayer::CustomAppearance m_customAppearance;
     169    ContentsFormatFlags m_contentsFormat { 0 };
    166170};
    167171
  • trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm

    r195937 r197923  
    2929#if PLATFORM(IOS)
    3030
     31#include "BlockExceptions.h"
    3132#include "Color.h"
    3233#include "LegacyTileCache.h"
     
    3435#include "LegacyTileLayer.h"
    3536#include "LegacyTileLayerPool.h"
     37#include "PlatformCALayer.h"
    3638#include "QuartzCoreSPI.h"
    3739#include "WAKWindow.h"
     
    4446#else
    4547namespace WebCore {
    46 static void setBackingStoreFormat(CALayer *)
     48static void setBackingStoreFormat(CALayer *, PlatformCALayer::ContentsFormatFlags)
    4749{
    4850}
     
    7274    }
    7375    LegacyTileLayer* layer = m_tileLayer.get();
    74     setBackingStoreFormat(layer);
     76    setBackingStoreFormat(layer, 0);
    7577    [layer setTileGrid:tileGrid];
    7678    [layer setOpaque:m_tileGrid->tileCache().tilesOpaque()];
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r197628 r197923  
    179179    graphicsLayer->setUsesDisplayListDrawing(compositor().displayListDrawingEnabled());
    180180#endif
     181
     182    // FIXME: ideally we'd only do this if the layer contains smoothed text.
     183    if (GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers())
     184        graphicsLayer->setSupportsSmoothedFonts(true);
    181185   
    182186    return graphicsLayer;
  • trunk/Source/WebKit2/ChangeLog

    r197921 r197923  
     12016-03-09  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Font antialiasing (smoothing) changes when elements are rendered into compositing layers
     4        https://bugs.webkit.org/show_bug.cgi?id=23364
     5        rdar://problem/7288429
     6
     7        Reviewed by Tim Horton.
     8       
     9        Send the ContentsFormat to the UI process (but nothing happens to it there yet).
     10
     11        * Shared/mac/RemoteLayerTreeTransaction.h:
     12        * Shared/mac/RemoteLayerTreeTransaction.mm:
     13        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
     14        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
     15        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     16        (WebKit::PlatformCALayerRemote::setContentsFormat):
     17        (WebKit::PlatformCALayerRemote::contentsFormat):
     18        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
     19
    1202016-03-09  Ryosuke Niwa  <rniwa@webkit.org>
    221
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r195607 r197923  
    8888        AnimationsChanged               = 1LLU << 33,
    8989        EdgeAntialiasingMaskChanged     = 1LLU << 34,
    90         CustomAppearanceChanged         = 1LLU << 35,
     90        ContentsFormatFlagsChanged      = 1LLU << 35,
     91        CustomAppearanceChanged         = 1LLU << 36,
    9192    };
    9293    typedef uint64_t LayerChange;
     
    154155        WebCore::Color borderColor;
    155156        unsigned edgeAntialiasingMask;
     157        WebCore::PlatformCALayer::ContentsFormatFlags contentsFormatFlags;
    156158        WebCore::GraphicsLayer::CustomAppearance customAppearance;
    157159        WebCore::PlatformCALayer::FilterType minificationFilter;
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r195607 r197923  
    212212        encoder << opaque;
    213213
     214    if (changedProperties & ContentsFormatFlagsChanged)
     215        encoder << contentsFormatFlags;
     216
    214217    if (changedProperties & MaskLayerChanged)
    215218        encoder << maskLayerID;
     
    372375    if (result.changedProperties & OpaqueChanged) {
    373376        if (!decoder.decode(result.opaque))
     377            return false;
     378    }
     379
     380    if (result.changedProperties & ContentsFormatFlagsChanged) {
     381        if (!decoder.decode(result.contentsFormatFlags))
    374382            return false;
    375383    }
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r193382 r197923  
    402402}
    403403
     404void PlatformCALayerRemote::setContentsFormat(ContentsFormatFlags formatFlags)
     405{
     406    if (formatFlags == m_properties.contentsFormatFlags)
     407        return;
     408
     409    m_properties.contentsFormatFlags = formatFlags;
     410    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsFormatFlagsChanged);
     411}
     412
     413PlatformCALayer::ContentsFormatFlags PlatformCALayerRemote::contentsFormat() const
     414{
     415    return m_properties.contentsFormatFlags;
     416}
     417
    404418void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer)
    405419{
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

    r197563 r197923  
    7777    void setOpaque(bool) override;
    7878
     79    void setContentsFormat(ContentsFormatFlags) override;
     80    ContentsFormatFlags contentsFormat() const override;
     81
    7982    WebCore::FloatRect bounds() const override;
    8083    void setBounds(const WebCore::FloatRect&) override;
Note: See TracChangeset for help on using the changeset viewer.