Diff
Modified: trunk/Source/WebCore/ChangeLog (197922 => 197923)
--- trunk/Source/WebCore/ChangeLog 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/ChangeLog 2016-03-10 05:26:25 UTC (rev 197923)
@@ -1,3 +1,61 @@
+2016-03-09 Simon Fraser <[email protected]>
+
+ 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.
+
+ 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):
+
2016-03-09 Gavin Barraclough <[email protected]>
WebKit should adopt journal_mode=wal for all SQLite databases.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -105,6 +105,13 @@
}
#endif
+#if !USE(CA)
+bool GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers()
+{
+ return false;
+}
+#endif
+
GraphicsLayer::GraphicsLayer(Type type, GraphicsLayerClient& client)
: m_client(client)
, m_anchorPoint(0.5f, 0.5f, 0)
@@ -115,6 +122,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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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,6 +543,7 @@
static bool supportsBackgroundColorContent();
static bool supportsLayerType(Type);
static bool supportsContentsTiling();
+ static bool supportsSmoothedFontsInNonOpaqueLayers();
void updateDebugIndicators();
@@ -613,6 +617,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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/TiledBacking.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -309,6 +309,14 @@
return true;
}
+bool GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers()
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ return true;
+#endif
+ return false;
+}
+
std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
{
std::unique_ptr<GraphicsLayer> graphicsLayer;
@@ -709,6 +717,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 +1597,9 @@
if (m_uncommittedChanges & ContentsOpaqueChanged)
updateContentsOpaque(pageScaleFactor);
+ if (m_uncommittedChanges & ContentsFormatChanged)
+ updateContentsFormat();
+
if (m_uncommittedChanges & BackfaceVisibilityChanged)
updateBackfaceVisibility();
@@ -1890,6 +1910,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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/TileController.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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::supportsSmoothedFontsInNonOpaqueLayers())
+ graphicsLayer->setSupportsSmoothedFonts(true);
return graphicsLayer;
}
Modified: trunk/Source/WebKit2/ChangeLog (197922 => 197923)
--- trunk/Source/WebKit2/ChangeLog 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-10 05:26:25 UTC (rev 197923)
@@ -1,3 +1,22 @@
+2016-03-09 Simon Fraser <[email protected]>
+
+ 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.
+
+ 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:
+
2016-03-09 Ryosuke Niwa <[email protected]>
Add runtime flags for shadow DOM and custom elements
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (197922 => 197923)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (197922 => 197923)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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 (197922 => 197923)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2016-03-10 05:17:58 UTC (rev 197922)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2016-03-10 05:26:25 UTC (rev 197923)
@@ -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;