<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182549] tags/Safari-601.1.26/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182549">182549</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2015-04-08 10:49:56 -0700 (Wed, 08 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/182516">r182516</a>. rdar://problem/20113980</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsSafari601126SourceWebCoreChangeLog">tags/Safari-601.1.26/Source/WebCore/ChangeLog</a></li>
<li><a href="#tagsSafari601126SourceWebCorepageSettingscpp">tags/Safari-601.1.26/Source/WebCore/page/Settings.cpp</a></li>
<li><a href="#tagsSafari601126SourceWebCorepageSettingsh">tags/Safari-601.1.26/Source/WebCore/page/Settings.h</a></li>
<li><a href="#tagsSafari601126SourceWebCorepageSettingsin">tags/Safari-601.1.26/Source/WebCore/page/Settings.in</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformgraphicsFontCascadecpp">tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.cpp</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformgraphicsFontCascadeh">tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.h</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformgraphicsGraphicsContextcpp">tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.cpp</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformgraphicsGraphicsContexth">tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.h</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformgraphicscamacPlatformCALayerMacmm">tags/Safari-601.1.26/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformgraphicscocoaFontCascadeCocoamm">tags/Safari-601.1.26/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm</a></li>
<li><a href="#tagsSafari601126SourceWebCoreplatformspicgCoreGraphicsSPIh">tags/Safari-601.1.26/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsSafari601126SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/ChangeLog (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/ChangeLog        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/ChangeLog        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-04-08 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r182516.
+
+ 2015-04-07 Simon Fraser <simon.fraser@apple.com>
+
+ Add experimental code to use custom font dilation when rendering into non-opaque contexts
+ https://bugs.webkit.org/show_bug.cgi?id=143508
+
+ Reviewed by Sam Weinig.
+
+ Add GraphicsContext::setAntialiasedFontDilationEnabled(), and set it to true
+ when rendering into a compositing layer which is not opaque (at the same location
+ where we disable font smoothing).
+
+ If Settings::antialiasedFontDilationEnabled() is true, when rendering non-smoothed
+ text (and if CSS hasn't opted into antialiased mode), use custom font dilation
+ parameters, chosen using a light/medium/dark heuristic, to make this text
+ match more closely with LCD-smoothed text.
+
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ (WebCore::Settings::setAntialiasedFontDilationEnabled): Set global state
+ in FontCascade (which can't easily get at Settings). This it not ideal,
+ but is temporary.
+ * page/Settings.h:
+ (WebCore::Settings::antialiasedFontDilationEnabled):
+ * page/Settings.in: Can't autogenerate this setting any more.
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::FontCascade::setAntialiasedFontDilationEnabled): Set the global.
+ (WebCore::FontCascade::antialiasedFontDilationEnabled):
+ * platform/graphics/FontCascade.h:
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::setAntialiasedFontDilationEnabled): Set graphics state
+ to say that we should do dilation of antialiased text.
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::GraphicsContextState::GraphicsContextState):
+ (WebCore::GraphicsContext::antialiasedFontDilationEnabled):
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayer::drawLayerContents): If the layer is not opaque, enable the
+ dilated text code path.
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::dilationSizeForTextColor): Heuristic (values chosen empirically) to
+ computed custom dilation based on foreground color.
+ (WebCore::FontCascade::drawGlyphs): Set the custom dilation parameters, and the
+ antialiasing state if we're not doing smoothing, and CSS hasn't opted into the
+ antialiased path.
+ * platform/spi/cg/CoreGraphicsSPI.h: New SPI.
+
</ins><span class="cx"> 2015-04-07 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r182511.
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCorepageSettingscpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/page/Settings.cpp (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/page/Settings.cpp        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/page/Settings.cpp        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -180,6 +180,7 @@
</span><span class="cx"> , m_needsAdobeFrameReloadingQuirk(false)
</span><span class="cx"> , m_usesPageCache(false)
</span><span class="cx"> , m_fontRenderingMode(0)
</span><ins>+ , m_antialiasedFontDilationEnabled(true)
</ins><span class="cx"> , m_showTiledScrollingIndicator(false)
</span><span class="cx"> , m_backgroundShouldExtendBeyondPage(false)
</span><span class="cx"> , m_dnsPrefetchingEnabled(false)
</span><span class="lines">@@ -341,6 +342,12 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+void Settings::setAntialiasedFontDilationEnabled(bool enabled)
+{
+ // FIXME: It's wrong for a setting to toggle a global, but this code is temporary.
+ FontCascade::setAntialiasedFontDilationEnabled(enabled);
+}
+
</ins><span class="cx"> void Settings::setMediaTypeOverride(const String& mediaTypeOverride)
</span><span class="cx"> {
</span><span class="cx"> if (m_mediaTypeOverride == mediaTypeOverride)
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCorepageSettingsh"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/page/Settings.h (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/page/Settings.h        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/page/Settings.h        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -109,6 +109,9 @@
</span><span class="cx"> const IntSize& textAutosizingWindowSizeOverride() const { return m_textAutosizingWindowSizeOverride; }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT void setAntialiasedFontDilationEnabled(bool);
+ bool antialiasedFontDilationEnabled() const { return m_antialiasedFontDilationEnabled; }
+
</ins><span class="cx"> // Only set by Layout Tests.
</span><span class="cx"> WEBCORE_EXPORT void setMediaTypeOverride(const String&);
</span><span class="cx"> const String& mediaTypeOverride() const { return m_mediaTypeOverride; }
</span><span class="lines">@@ -295,6 +298,7 @@
</span><span class="cx"> bool m_needsAdobeFrameReloadingQuirk : 1;
</span><span class="cx"> bool m_usesPageCache : 1;
</span><span class="cx"> unsigned m_fontRenderingMode : 1;
</span><ins>+ bool m_antialiasedFontDilationEnabled : 1;
</ins><span class="cx"> bool m_showTiledScrollingIndicator : 1;
</span><span class="cx"> bool m_backgroundShouldExtendBeyondPage : 1;
</span><span class="cx"> bool m_dnsPrefetchingEnabled : 1;
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCorepageSettingsin"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/page/Settings.in (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/page/Settings.in        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/page/Settings.in        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> minimumLogicalFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
</span><span class="cx"> defaultFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
</span><span class="cx"> defaultFixedFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
</span><del>-antialiasedFontDilationEnabled type=bool, initial=true, setNeedsStyleRecalcInAllFrames=1
</del><span class="cx">
</span><span class="cx"> editingBehaviorType type=EditingBehaviorType, initial=editingBehaviorTypeForPlatform()
</span><span class="cx"> maximumHTMLParserDOMTreeDepth type=unsigned, initial=defaultMaximumHTMLParserDOMTreeDepth
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformgraphicsFontCascadecpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.cpp (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.cpp        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.cpp        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -592,6 +592,18 @@
</span><span class="cx"> return shouldUseFontSmoothing;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool antialiasedFontDilationIsEnabled = true;
+
+void FontCascade::setAntialiasedFontDilationEnabled(bool enabled)
+{
+ antialiasedFontDilationIsEnabled = enabled;
+}
+
+bool FontCascade::antialiasedFontDilationEnabled()
+{
+ return antialiasedFontDilationIsEnabled;
+}
+
</ins><span class="cx"> void FontCascade::setCodePath(CodePath p)
</span><span class="cx"> {
</span><span class="cx"> s_codePath = p;
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformgraphicsFontCascadeh"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.h (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.h        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/graphics/FontCascade.h        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -205,6 +205,9 @@
</span><span class="cx"> static bool leadingExpansionOpportunity(const StringView&, TextDirection);
</span><span class="cx"> static bool trailingExpansionOpportunity(const StringView&, TextDirection);
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT static void setAntialiasedFontDilationEnabled(bool);
+ WEBCORE_EXPORT static bool antialiasedFontDilationEnabled();
+
</ins><span class="cx"> WEBCORE_EXPORT static void setShouldUseSmoothing(bool);
</span><span class="cx"> WEBCORE_EXPORT static bool shouldUseSmoothing();
</span><span class="cx">
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.cpp (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.cpp        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.cpp        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -257,6 +257,11 @@
</span><span class="cx"> setPlatformShouldSmoothFonts(shouldSmoothFonts);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void GraphicsContext::setAntialiasedFontDilationEnabled(bool antialiasedFontDilationEnabled)
+{
+ m_state.antialiasedFontDilationEnabled = antialiasedFontDilationEnabled;
+}
+
</ins><span class="cx"> void GraphicsContext::setStrokePattern(Ref<Pattern>&& pattern)
</span><span class="cx"> {
</span><span class="cx"> m_state.strokeGradient.clear();
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformgraphicsGraphicsContexth"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.h (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.h        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/graphics/GraphicsContext.h        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -114,6 +114,7 @@
</span><span class="cx"> GraphicsContextState()
</span><span class="cx"> : shouldAntialias(true)
</span><span class="cx"> , shouldSmoothFonts(true)
</span><ins>+ , antialiasedFontDilationEnabled(true)
</ins><span class="cx"> , shouldSubpixelQuantizeFonts(true)
</span><span class="cx"> , paintingDisabled(false)
</span><span class="cx"> , shadowsIgnoreTransforms(false)
</span><span class="lines">@@ -156,6 +157,7 @@
</span><span class="cx">
</span><span class="cx"> bool shouldAntialias : 1;
</span><span class="cx"> bool shouldSmoothFonts : 1;
</span><ins>+ bool antialiasedFontDilationEnabled : 1;
</ins><span class="cx"> bool shouldSubpixelQuantizeFonts : 1;
</span><span class="cx"> bool paintingDisabled : 1;
</span><span class="cx"> bool shadowsIgnoreTransforms : 1;
</span><span class="lines">@@ -239,6 +241,9 @@
</span><span class="cx"> WEBCORE_EXPORT void setShouldAntialias(bool);
</span><span class="cx"> bool shouldAntialias() const { return m_state.shouldAntialias; }
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT void setAntialiasedFontDilationEnabled(bool);
+ bool antialiasedFontDilationEnabled() const { return m_state.antialiasedFontDilationEnabled; }
+
</ins><span class="cx"> WEBCORE_EXPORT void setShouldSmoothFonts(bool);
</span><span class="cx"> bool shouldSmoothFonts() const { return m_state.shouldSmoothFonts; }
</span><span class="cx">
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformgraphicscamacPlatformCALayerMacmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -1045,6 +1045,7 @@
</span><span class="cx"> if (!layerContents->platformCALayerContentsOpaque()) {
</span><span class="cx"> // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
</span><span class="cx"> graphicsContext.setShouldSmoothFonts(false);
</span><ins>+ graphicsContext.setAntialiasedFontDilationEnabled(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformgraphicscocoaFontCascadeCocoamm"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -203,6 +203,26 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+static CGSize dilationSizeForTextColor(const Color& color)
+{
+ double hue;
+ double saturation;
+ double lightness;
+ color.getHSL(hue, saturation, lightness);
+
+ // These values were derived empirically, and are only experimental.
+ if (lightness < 0.3333) // Dark
+ return CGSizeMake(0.007, 0.019);
+
+ if (lightness < 0.6667) // Medium
+ return CGSizeMake(0.032, 0.032);
+
+ // Light
+ return CGSizeMake(0.0475, 0.039);
+}
+#endif
+
</ins><span class="cx"> void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
</span><span class="cx"> {
</span><span class="cx"> const FontPlatformData& platformData = font->platformData();
</span><span class="lines">@@ -213,29 +233,34 @@
</span><span class="cx">
</span><span class="cx"> bool shouldSmoothFonts;
</span><span class="cx"> bool changeFontSmoothing;
</span><ins>+ bool matchAntialiasedAndSmoothedFonts = context->antialiasedFontDilationEnabled();
</ins><span class="cx">
</span><span class="cx"> switch (fontDescription().fontSmoothing()) {
</span><span class="cx"> case Antialiased: {
</span><span class="cx"> context->setShouldAntialias(true);
</span><span class="cx"> shouldSmoothFonts = false;
</span><span class="cx"> changeFontSmoothing = true;
</span><ins>+ matchAntialiasedAndSmoothedFonts = false; // CSS has opted into strictly antialiased fonts.
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case SubpixelAntialiased: {
</span><span class="cx"> context->setShouldAntialias(true);
</span><span class="cx"> shouldSmoothFonts = true;
</span><span class="cx"> changeFontSmoothing = true;
</span><ins>+ matchAntialiasedAndSmoothedFonts = true;
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case NoSmoothing: {
</span><span class="cx"> context->setShouldAntialias(false);
</span><span class="cx"> shouldSmoothFonts = false;
</span><span class="cx"> changeFontSmoothing = true;
</span><ins>+ matchAntialiasedAndSmoothedFonts = false;
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case AutoSmoothing: {
</span><span class="cx"> shouldSmoothFonts = true;
</span><span class="cx"> changeFontSmoothing = false;
</span><ins>+ matchAntialiasedAndSmoothedFonts = true;
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -243,6 +268,7 @@
</span><span class="cx"> if (!shouldUseSmoothing()) {
</span><span class="cx"> shouldSmoothFonts = false;
</span><span class="cx"> changeFontSmoothing = true;
</span><ins>+ matchAntialiasedAndSmoothedFonts = true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="lines">@@ -251,7 +277,18 @@
</span><span class="cx"> originalShouldUseFontSmoothing = CGContextGetShouldSmoothFonts(cgContext);
</span><span class="cx"> CGContextSetShouldSmoothFonts(cgContext, shouldSmoothFonts);
</span><span class="cx"> }
</span><ins>+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+ CGFontAntialiasingStyle oldAntialiasingStyle;
+ bool resetAntialiasingStyle = false;
+ if (antialiasedFontDilationEnabled() && !CGContextGetShouldSmoothFonts(cgContext) && matchAntialiasedAndSmoothedFonts) {
+ resetAntialiasingStyle = true;
+ oldAntialiasingStyle = CGContextGetFontAntialiasingStyle(cgContext);
+ CGContextSetFontAntialiasingStyle(cgContext, kCGFontAntialiasingStyleUnfilteredCustomDilation);
+ CGContextSetFontDilation(cgContext, dilationSizeForTextColor(context->fillColor()));
+ }
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> NSFont* drawFont = [platformData.nsFont() printerFont];
</span><span class="lines">@@ -368,6 +405,11 @@
</span><span class="cx"> context->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
</span><span class="cx">
</span><span class="cx"> #if !PLATFORM(IOS)
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+ if (resetAntialiasingStyle)
+ CGContextSetFontAntialiasingStyle(cgContext, oldAntialiasingStyle);
+#endif
+
</ins><span class="cx"> if (changeFontSmoothing)
</span><span class="cx"> CGContextSetShouldSmoothFonts(cgContext, originalShouldUseFontSmoothing);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="tagsSafari601126SourceWebCoreplatformspicgCoreGraphicsSPIh"></a>
<div class="modfile"><h4>Modified: tags/Safari-601.1.26/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h (182548 => 182549)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-601.1.26/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h        2015-04-08 17:27:33 UTC (rev 182548)
+++ tags/Safari-601.1.26/Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h        2015-04-08 17:49:56 UTC (rev 182549)
</span><span class="lines">@@ -79,6 +79,9 @@
</span><span class="cx"> enum {
</span><span class="cx"> kCGFontAntialiasingStyleUnfiltered = 0 << 7,
</span><span class="cx"> kCGFontAntialiasingStyleFilterLight = 1 << 7,
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+ kCGFontAntialiasingStyleUnfilteredCustomDilation = (8 << 7),
+#endif
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t CGFontAntialiasingStyle;
</span><span class="cx">
</span><span class="lines">@@ -126,6 +129,9 @@
</span><span class="cx"> void CGContextSetCTM(CGContextRef, CGAffineTransform);
</span><span class="cx"> void CGContextSetCompositeOperation(CGContextRef, CGCompositeOperation);
</span><span class="cx"> void CGContextSetShouldAntialiasFonts(CGContextRef, bool shouldAntialiasFonts);
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+void CGContextSetFontDilation(CGContextRef, CGSize);
+#endif
</ins><span class="cx">
</span><span class="cx"> CFStringRef CGFontCopyFamilyName(CGFontRef);
</span><span class="cx"> bool CGFontGetDescriptor(CGFontRef, CGFontDescriptor*);
</span></span></pre>
</div>
</div>
</body>
</html>