https://bugs.webkit.org/show_bug.cgi?id=143738
Reviewed by Tim Horton.
Enabling custom dilation for antialised fonts broke layout tests, so re-land it,
but disable in WebKitTestRunner and DumpRenderTree. The latter requires adding
a private WebKit pref. This pref defaults to YES, enabling the feature by default
in WK1 as we do for WK2.
Source/WebCore:
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::dilationSizeForTextColor):
(WebCore::FontCascade::drawGlyphs):
Source/WebKit/mac:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences setAntialiasedFontDilationEnabled:]):
(-[WebPreferences antialiasedFontDilationEnabled]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Tools:
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182824
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-04-14 Simon Fraser <simon.fraser@apple.com>
+
+ Re-enable custom dilation for antialiased fonts
+ https://bugs.webkit.org/show_bug.cgi?id=143738
+
+ Reviewed by Tim Horton.
+
+ Enabling custom dilation for antialised fonts broke layout tests, so re-land it,
+ but disable in WebKitTestRunner and DumpRenderTree. The latter requires adding
+ a private WebKit pref. This pref defaults to YES, enabling the feature by default
+ in WK1 as we do for WK2.
+
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::dilationSizeForTextColor):
+ (WebCore::FontCascade::drawGlyphs):
+
2015-04-14 Andy Estes <aestes@apple.com>
[Content Filtering] Use ASSERT_WITH_SECURITY_IMPLICATION for verifying types from NEFilterSource
}
#endif
+#if PLATFORM(MAC) && __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
+
void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
{
const FontPlatformData& platformData = font->platformData();
originalShouldUseFontSmoothing = CGContextGetShouldSmoothFonts(cgContext);
CGContextSetShouldSmoothFonts(cgContext, shouldSmoothFonts);
}
+
+#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()));
+ }
+#endif
#endif
#if !PLATFORM(IOS)
context->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
#if !PLATFORM(IOS)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+ if (resetAntialiasingStyle)
+ CGContextSetFontAntialiasingStyle(cgContext, oldAntialiasingStyle);
+#endif
+
if (changeFontSmoothing)
CGContextSetShouldSmoothFonts(cgContext, originalShouldUseFontSmoothing);
#endif
+2015-04-14 Simon Fraser <simon.fraser@apple.com>
+
+ Re-enable custom dilation for antialiased fonts
+ https://bugs.webkit.org/show_bug.cgi?id=143738
+
+ Reviewed by Tim Horton.
+
+ Enabling custom dilation for antialised fonts broke layout tests, so re-land it,
+ but disable in WebKitTestRunner and DumpRenderTree. The latter requires adding
+ a private WebKit pref. This pref defaults to YES, enabling the feature by default
+ in WK1 as we do for WK2.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences setAntialiasedFontDilationEnabled:]):
+ (-[WebPreferences antialiasedFontDilationEnabled]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]):
+
2015-04-13 Brady Eidson <beidson@apple.com>
Share sheets from Share menus appear outside the browser window.
#define WebKitPDFDisplayModePreferenceKey @"WebKitPDFDisplayMode"
#define WebKitPDFScaleFactorPreferenceKey @"WebKitPDFScaleFactor"
#endif
+
#define WebKitUseSiteSpecificSpoofingPreferenceKey @"WebKitUseSiteSpecificSpoofing"
#define WebKitEditableLinkBehaviorPreferenceKey @"WebKitEditableLinkBehavior"
#define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey"
#define WebKitBackspaceKeyNavigationEnabledKey @"WebKitBackspaceKeyNavigationEnabled"
#define WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey @"WebKitIncrementalRenderingSuppressionTimeoutInSeconds"
#define WebKitWantsBalancedSetDefersLoadingBehaviorKey @"WebKitWantsBalancedSetDefersLoadingBehavior"
-
#define WebKitDebugFullPageZoomPreferenceKey @"WebKitDebugFullPageZoomPreferenceKey"
-
#define WebKitMinimumZoomFontSizePreferenceKey @"WebKitMinimumZoomFontSizePreferenceKey"
+#define WebKitAntialiasedFontDilationEnabledKey @"AntialiasedFontDilationEnabled"
#if TARGET_OS_IPHONE
#define WebKitStandalonePreferenceKey @"WebKitStandalonePreferenceKey"
@"0", WebKitMinimumFontSizePreferenceKey,
@"9", WebKitMinimumLogicalFontSizePreferenceKey,
@"16", WebKitDefaultFontSizePreferenceKey,
+ @(YES), WebKitAntialiasedFontDilationEnabledKey,
@"13", WebKitDefaultFixedFontSizePreferenceKey,
@"ISO-8859-1", WebKitDefaultTextEncodingNamePreferenceKey,
[NSNumber numberWithBool:NO], WebKitUsesEncodingDetectorPreferenceKey,
[self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
}
+- (void)setAntialiasedFontDilationEnabled:(BOOL)enabled
+{
+ [self _setBoolValue:enabled forKey:WebKitAntialiasedFontDilationEnabledKey];
+}
+
+- (BOOL)antialiasedFontDilationEnabled
+{
+ return [self _boolValueForKey:WebKitAntialiasedFontDilationEnabledKey];
+}
+
@end
@implementation WebPreferences (WebInternal)
- (void)setMediaKeysStorageDirectory:(NSString *)directory;
- (NSString *)mediaKeysStorageDirectory;
+- (void)setAntialiasedFontDilationEnabled:(BOOL)flag;
+- (BOOL)antialiasedFontDilationEnabled;
+
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
- (void)_setAllowCompositingLayerVisualDegradation:(BOOL)flag;
#endif
settings.setUsesEncodingDetector([preferences usesEncodingDetector]);
settings.setFantasyFontFamily([preferences fantasyFontFamily]);
settings.setFixedFontFamily([preferences fixedFontFamily]);
+ settings.setAntialiasedFontDilationEnabled([preferences antialiasedFontDilationEnabled]);
settings.setForceFTPDirectoryListings([preferences _forceFTPDirectoryListings]);
settings.setFTPDirectoryTemplatePath([preferences _ftpDirectoryTemplatePath]);
settings.setLocalStorageDatabasePath([preferences _localStorageDatabasePath]);
settings.setXSSAuditorEnabled([preferences isXSSAuditorEnabled]);
settings.setDNSPrefetchingEnabled([preferences isDNSPrefetchingEnabled]);
- // FIXME: Enabling accelerated compositing when WebGL is enabled causes tests to fail on Leopard which expect HW compositing to be disabled.
- // Until we fix that, I will comment out the test (CFM)
settings.setAcceleratedCompositingEnabled([preferences acceleratedCompositingEnabled]);
settings.setAcceleratedDrawingEnabled([preferences acceleratedDrawingEnabled]);
settings.setCanvasUsesAcceleratedDrawing([preferences canvasUsesAcceleratedDrawing]);
+2015-04-14 Simon Fraser <simon.fraser@apple.com>
+
+ Re-enable custom dilation for antialiased fonts
+ https://bugs.webkit.org/show_bug.cgi?id=143738
+
+ Reviewed by Tim Horton.
+
+ Enabling custom dilation for antialised fonts broke layout tests, so re-land it,
+ but disable in WebKitTestRunner and DumpRenderTree. The latter requires adding
+ a private WebKit pref. This pref defaults to YES, enabling the feature by default
+ in WK1 as we do for WK2.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetWebPreferencesToConsistentValues):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::resetPreferencesToConsistentValues):
+
2015-04-14 Brent Fulgham <bfulgham@apple.com>
Correct layering violation in DumpRenderTree Build
[preferences setPictographFontFamily:@"Apple Color Emoji"];
[preferences setDefaultFontSize:16];
[preferences setDefaultFixedFontSize:13];
+ [preferences setAntialiasedFontDilationEnabled:NO];
[preferences setMinimumFontSize:0];
[preferences setDefaultTextEncodingName:@"ISO-8859-1"];
[preferences setJavaEnabled:NO];
WKPreferencesResetTestRunnerOverrides(preferences);
WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
+ WKPreferencesSetAntialiasedFontDilationEnabled(preferences, false);
WKPreferencesSetXSSAuditorEnabled(preferences, false);
WKPreferencesSetWebAudioEnabled(preferences, true);
WKPreferencesSetMediaStreamEnabled(preferences, true);