Remove support for screen font substitution
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jan 2015 22:40:17 +0000 (22:40 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jan 2015 22:40:17 +0000 (22:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141038

Reviewed by Tim Horton.

Source/WebCore:

- Removes the screen font substitution setting (which was only on in Mountain Lion)
- Remove the concept of a printer font, from the family of Font related classes.

* WebCore.exp.in:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::initializeFontStyle):
* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::shouldEnableScreenFontSubstitutionByDefault): Deleted.
(WebCore::Settings::setScreenFontSubstitutionEnabled): Deleted.
* page/Settings.h:
(WebCore::Settings::screenFontSubstitutionEnabled): Deleted.
* page/mac/SettingsMac.mm:
(WebCore::Settings::shouldEnableScreenFontSubstitutionByDefault): Deleted.
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionFontDataCacheKey::makeFlagKey):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::FontCascade):
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::isPrinterFont): Deleted.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::FontDescription):
(WebCore::FontDescription::setWeight):
(WebCore::FontDescription::equalForTextAutoSizing):
(WebCore::FontDescription::operator==):
(WebCore::FontDescription::usePrinterFont): Deleted.
(WebCore::FontDescription::setUsePrinterFont): Deleted.
* platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformData::isCompositeFontReference):
(WebCore::FontPlatformData::hash):
(WebCore::FontPlatformData::operator==):
(WebCore::FontPlatformData::isPrinterFont): Deleted.
* platform/graphics/WidthIterator.h:
(WebCore::WidthIterator::supportsTypesettingFeatures):
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::platformDataInit):
(WebCore::FontPlatformData::platformDataAssign):
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::FontCache::getSystemFontFallbackForCharacters):
(WebCore::FontCache::createFontPlatformData):
* platform/graphics/ios/SimpleFontDataIOS.mm:
(WebCore::Font::platformCreateScaledFont):
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::systemFallbackForCharacters):
(WebCore::FontCache::createFontPlatformData):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::Font::compositeFontReferenceFont):
(WebCore::Font::platformCreateScaledFont):
* platform/mac/DragImageMac.mm:
(WebCore::fontFromNSFont):
(WebCore::widthWithFont):
(WebCore::drawAtPoint):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

Source/WebKit/mac:

* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
(-[NSString _web_widthWithFont:]):
* Misc/WebStringTruncator.mm:
(fontFromNSFont):
Update for new signature of the FontPlatformData constructor, which no longer cares about
whether to use printer fonts.

* WebView/WebPreferenceKeysPrivate.h:
Remove the WebKitScreenFontSubstitutionEnabledKey key.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
Remove support for WebKitScreenFontSubstitutionEnabledKey.

(needsScreenFontsEnabledQuirk): Deleted.
Remove support for the Mountain Lion era 1-Password quirk.

(-[WebPreferences screenFontSubstitutionEnabled]): Deleted.
(-[WebPreferences setScreenFontSubstitutionEnabled:]): Deleted.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
(-[WebView _preferencesChanged:]):
Remove support for the screen font substitution setting.

Source/WebKit/win:

* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::screenFontSubstitutionEnabled):
(WebPreferences::setScreenFontSubstitutionEnabled):
Remove implementations. Have this setting set on windows didn't have any effect before,
so this doesn't change behavior.

Source/WebKit2:

* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKPreferencesSetScreenFontSubstitutionEnabled):
(WKPreferencesGetScreenFontSubstitutionEnabled):
Move now empty preferences SPI to WKDeprecatedFunctions.

* Shared/WebPreferencesDefinitions.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetScreenFontSubstitutionEnabled): Deleted.
(WKPreferencesGetScreenFontSubstitutionEnabled): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::presenterApplicationPid):
(WebKit::WebProcess::shouldForceScreenFontSubstitution): Deleted.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Stop piping screen font substitution setting to the web process.

Tools:

* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):
Remove call to now setScreenFontSubstitutionEnabled() which is a no-op.

LayoutTests:

* platform/mac/fast/text/international/hindi-spacing-expected.txt:
Update results now that buttons always use printer fonts. We were accidentally
allowing buttons to use screen fonts, which usually didn't make a difference,
but does with some fallback fonts.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179368 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/text/international/hindi-spacing-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/page/mac/SettingsMac.mm
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/WidthIterator.h
Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm
Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
Source/WebCore/platform/mac/DragImageMac.mm
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebKitNSStringExtras.mm
Source/WebKit/mac/Misc/WebStringTruncator.mm
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebPreferenceKeysPrivate.h
Source/WebKit/win/WebPreferences.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm
Tools/ChangeLog
Tools/DumpRenderTree/win/DumpRenderTree.cpp

index dabb2b2..6e7ecb4 100644 (file)
@@ -1,3 +1,15 @@
+2015-01-29  Sam Weinig  <sam@webkit.org>
+
+        Remove support for screen font substitution
+        https://bugs.webkit.org/show_bug.cgi?id=141038
+
+        Reviewed by Tim Horton.
+
+        * platform/mac/fast/text/international/hindi-spacing-expected.txt:
+        Update results now that buttons always use printer fonts. We were accidentally
+        allowing buttons to use screen fonts, which usually didn't make a difference,
+        but does with some fallback fonts.
+
 2015-01-20  David Hyatt  <hyatt@apple.com>
 
         Japanese line breaking rules need to be respected before and after Ruby.
index 667d01f..578f7b7 100644 (file)
@@ -8,11 +8,11 @@ layer at (0,0) size 800x600
         text run at (0,18) width 761: "left for it. Neither the Hindi on the button below nor the same text on two lines below that should be truncated at either"
         text run at (0,36) width 28: "end."
       RenderBR {BR} at (27,50) size 1x0
-      RenderButton {INPUT} at (2,56) size 99x18 [bgcolor=#C0C0C0]
-        RenderBlock (anonymous) at (8,2) size 83x17
-          RenderText at (0,1) size 83x13
-            text run at (0,1) width 83: "\x{915}\x{93F}\x{938}\x{940} \x{92D}\x{940} \x{924}\x{930}\x{939} \x{906}\x{917}\x{947} \x{92C}"
-      RenderBR {BR} at (102,70) size 1x0
+      RenderButton {INPUT} at (2,56) size 101x18 [bgcolor=#C0C0C0]
+        RenderBlock (anonymous) at (8,2) size 85x17
+          RenderText at (0,1) size 85x13
+            text run at (0,1) width 85: "\x{915}\x{93F}\x{938}\x{940} \x{92D}\x{940} \x{924}\x{930}\x{939} \x{906}\x{917}\x{947} \x{92C}"
+      RenderBR {BR} at (104,70) size 1x0
       RenderInline {SPAN} at (0,0) size 114x18
         RenderText {#text} at (0,80) size 114x18
           text run at (0,80) width 114: "\x{915}\x{93F}\x{938}\x{940} \x{92D}\x{940} \x{924}\x{930}\x{939} \x{906}\x{917}\x{947} \x{92C}"
index fc666c8..54e713a 100644 (file)
@@ -1,3 +1,72 @@
+2015-01-29  Sam Weinig  <sam@webkit.org>
+
+        Remove support for screen font substitution
+        https://bugs.webkit.org/show_bug.cgi?id=141038
+
+        Reviewed by Tim Horton.
+
+        - Removes the screen font substitution setting (which was only on in Mountain Lion)
+        - Remove the concept of a printer font, from the family of Font related classes.
+
+        * WebCore.exp.in:
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::initializeFontStyle):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::shouldEnableScreenFontSubstitutionByDefault): Deleted.
+        (WebCore::Settings::setScreenFontSubstitutionEnabled): Deleted.
+        * page/Settings.h:
+        (WebCore::Settings::screenFontSubstitutionEnabled): Deleted.
+        * page/mac/SettingsMac.mm:
+        (WebCore::Settings::shouldEnableScreenFontSubstitutionByDefault): Deleted.
+        * platform/graphics/FontCache.h:
+        (WebCore::FontDescriptionFontDataCacheKey::makeFlagKey):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::FontCascade):
+        * platform/graphics/FontCascade.h:
+        (WebCore::FontCascade::isPrinterFont): Deleted.
+        * platform/graphics/FontDescription.h:
+        (WebCore::FontDescription::FontDescription):
+        (WebCore::FontDescription::setWeight):
+        (WebCore::FontDescription::equalForTextAutoSizing):
+        (WebCore::FontDescription::operator==):
+        (WebCore::FontDescription::usePrinterFont): Deleted.
+        (WebCore::FontDescription::setUsePrinterFont): Deleted.
+        * platform/graphics/FontPlatformData.h:
+        (WebCore::FontPlatformData::isCompositeFontReference):
+        (WebCore::FontPlatformData::hash):
+        (WebCore::FontPlatformData::operator==):
+        (WebCore::FontPlatformData::isPrinterFont): Deleted.
+        * platform/graphics/WidthIterator.h:
+        (WebCore::WidthIterator::supportsTypesettingFeatures):
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::FontCascade::drawGlyphs):
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::platformDataInit):
+        (WebCore::FontPlatformData::platformDataAssign):
+        * platform/graphics/ios/FontCacheIOS.mm:
+        (WebCore::FontCache::getSystemFontFallbackForCharacters):
+        (WebCore::FontCache::createFontPlatformData):
+        * platform/graphics/ios/SimpleFontDataIOS.mm:
+        (WebCore::Font::platformCreateScaledFont):
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::systemFallbackForCharacters):
+        (WebCore::FontCache::createFontPlatformData):
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::Font::compositeFontReferenceFont):
+        (WebCore::Font::platformCreateScaledFont):
+        * platform/mac/DragImageMac.mm:
+        (WebCore::fontFromNSFont):
+        (WebCore::widthWithFont):
+        (WebCore::drawAtPoint):
+        * style/StyleResolveForDocument.cpp:
+        (WebCore::Style::resolveForDocument):
+
 2015-01-20  David Hyatt  <hyatt@apple.com>
 
         Japanese line breaking rules need to be respected before and after Ruby.
index c9aa2c0..7c87ad2 100644 (file)
@@ -141,7 +141,7 @@ __ZN7WebCore11FontCascade11setCodePathENS0_8CodePathE
 __ZN7WebCore11FontCascade18shouldUseSmoothingEv
 __ZN7WebCore11FontCascade21setShouldUseSmoothingEb
 __ZN7WebCore11FontCascade29setDefaultTypesettingFeaturesEj
-__ZN7WebCore11FontCascadeC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
+__ZN7WebCore11FontCascadeC1ERKNS_16FontPlatformDataENS_17FontSmoothingModeE
 __ZN7WebCore11FontCascadeC1Ev
 __ZN7WebCore11FontCascadeaSERKS0_
 __ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
@@ -1470,7 +1470,6 @@ __ZN7WebCore8Settings30setShowTiledScrollingIndicatorEb
 __ZN7WebCore8Settings32defaultDOMTimerAlignmentIntervalEv
 __ZN7WebCore8Settings32setAcceleratedCompositingEnabledEb
 __ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
-__ZN7WebCore8Settings32setScreenFontSubstitutionEnabledEb
 __ZN7WebCore8Settings33setFontFallbackPrefersPictographsEb
 __ZN7WebCore8Settings35setBackgroundShouldExtendBeyondPageEb
 __ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
@@ -2372,8 +2371,7 @@ __ZN7WebCore13getRawCookiesERKNS_21NetworkStorageSessionERKNS_3URLES5_RN3WTF6Vec
 __ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
 __ZN7WebCore14cookiesEnabledERKNS_21NetworkStorageSessionERKNS_3URLES5_
 __ZN7WebCore15ResourceRequest41updateFromDelegatePreservingOldPropertiesERKS0_
-__ZN7WebCore16FontPlatformDataC1EP6NSFontfbbbNS_15FontOrientationENS_16FontWidthVariantE
-__ZN7WebCore16FontPlatformDataC2EP6NSFontfbbbNS_15FontOrientationENS_16FontWidthVariantE
+__ZN7WebCore16FontPlatformDataC1EP6NSFontfbbNS_15FontOrientationENS_16FontWidthVariantE
 __ZN7WebCore16colorFromNSColorEP7NSColor
 __ZN7WebCore16deleteAllCookiesERKNS_21NetworkStorageSessionE
 __ZN7WebCore16enclosingIntRectERK7_NSRect
index 6d9ecaa..23f34e5 100644 (file)
@@ -2077,7 +2077,6 @@ void StyleResolver::initializeFontStyle(Settings* settings)
 {
     FontDescription fontDescription;
     fontDescription.setRenderingMode(settings->fontRenderingMode());
-    fontDescription.setUsePrinterFont(document().printing() || !settings->screenFontSubstitutionEnabled());
     fontDescription.setOneFamily(standardFamily);
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
     setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueMedium, false, document()));
index 956b44c..f7bdc4c 100644 (file)
@@ -177,7 +177,6 @@ Settings::Settings(Page* page)
 #endif
 #endif
     SETTINGS_INITIALIZER_LIST
-    , m_screenFontSubstitutionEnabled(shouldEnableScreenFontSubstitutionByDefault())
     , m_isJavaEnabled(false)
     , m_isJavaEnabledForLocalFiles(true)
     , m_loadsImagesAutomatically(false)
@@ -231,13 +230,6 @@ double Settings::hiddenPageDOMTimerAlignmentInterval()
 }
 
 #if !PLATFORM(COCOA)
-bool Settings::shouldEnableScreenFontSubstitutionByDefault()
-{
-    return true;
-}
-#endif
-
-#if !PLATFORM(COCOA)
 void Settings::initializeDefaultFontFamilies()
 {
     // Other platforms can set up fonts from a client, but on Mac, we want it in WebCore to share code between WebKit1 and WebKit2.
@@ -523,16 +515,6 @@ void Settings::setUsesPageCache(bool usesPageCache)
         PageCache::shared().pruneToSizeNow(0, PruningReason::None);
 }
 
-void Settings::setScreenFontSubstitutionEnabled(bool enabled)
-{
-    if (m_screenFontSubstitutionEnabled == enabled)
-        return;
-    m_screenFontSubstitutionEnabled = enabled;
-
-    if (m_page)
-        m_page->setNeedsRecalcStyleInAllFrames();
-}
-
 void Settings::setFontRenderingMode(FontRenderingMode mode)
 {
     if (fontRenderingMode() == mode)
index cbc28ac..8231861 100644 (file)
@@ -125,9 +125,6 @@ public:
 
     SETTINGS_GETTERS_AND_SETTERS
 
-    WEBCORE_EXPORT void setScreenFontSubstitutionEnabled(bool);
-    bool screenFontSubstitutionEnabled() const { return m_screenFontSubstitutionEnabled; }
-
     WEBCORE_EXPORT void setJavaEnabled(bool);
     bool isJavaEnabled() const { return m_isJavaEnabled; }
 
@@ -283,7 +280,6 @@ private:
     explicit Settings(Page*);
 
     void initializeDefaultFontFamilies();
-    static bool shouldEnableScreenFontSubstitutionByDefault();
 
     Page* m_page;
 
@@ -300,7 +296,6 @@ private:
 
     SETTINGS_MEMBER_VARIABLES
 
-    bool m_screenFontSubstitutionEnabled : 1;
     bool m_isJavaEnabled : 1;
     bool m_isJavaEnabledForLocalFiles : 1;
     bool m_loadsImagesAutomatically : 1;
index e9feb4c..2fc6c2e 100644 (file)
 
 namespace WebCore {
 
-bool Settings::shouldEnableScreenFontSubstitutionByDefault()
-{
-#if PLATFORM(MAC)
-    return false;
-#else
-    return true;
-#endif
-}
-
 void Settings::initializeDefaultFontFamilies()
 {
 #if !PLATFORM(IOS)
index d88454e..dcc3e59 100644 (file)
@@ -79,11 +79,10 @@ struct FontDescriptionFontDataCacheKey {
     { }
     static unsigned makeFlagKey(const FontDescription& description)
     {
-        return static_cast<unsigned>(description.widthVariant()) << 5
-            | static_cast<unsigned>(description.nonCJKGlyphOrientation()) << 4
-            | static_cast<unsigned>(description.orientation()) << 3
-            | static_cast<unsigned>(description.italic()) << 2
-            | static_cast<unsigned>(description.usePrinterFont()) << 1
+        return static_cast<unsigned>(description.widthVariant()) << 4
+            | static_cast<unsigned>(description.nonCJKGlyphOrientation()) << 3
+            | static_cast<unsigned>(description.orientation()) << 2
+            | static_cast<unsigned>(description.italic()) << 1
             | static_cast<unsigned>(description.renderingMode());
     }
     bool operator==(const FontDescriptionFontDataCacheKey& other) const
index 355b36e..8219cdc 100644 (file)
@@ -124,14 +124,13 @@ FontCascade::FontCascade(const FontDescription& fd, float letterSpacing, float w
 }
 
 // FIXME: We should make this constructor platform-independent.
-FontCascade::FontCascade(const FontPlatformData& font, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
+FontCascade::FontCascade(const FontPlatformData& font, FontSmoothingMode fontSmoothingMode)
     : m_glyphs(FontGlyphs::createForPlatformFont(font))
     , m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_useBackslashAsYenSymbol(false)
     , m_typesettingFeatures(computeTypesettingFeatures())
 {
-    m_fontDescription.setUsePrinterFont(isPrinterFont);
     m_fontDescription.setFontSmoothing(fontSmoothingMode);
 #if PLATFORM(IOS)
     m_fontDescription.setSpecifiedSize(CTFontGetSize(font.font()));
@@ -154,7 +153,6 @@ FontCascade::FontCascade(const FontPlatformData& font, PassRefPtr<FontSelector>
     m_fontDescription.setComputedSize(CTFontGetSize(primaryFont));
     m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitItalic);
     m_fontDescription.setWeight((CTFontGetSymbolicTraits(primaryFont) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
-    m_fontDescription.setUsePrinterFont(font.isPrinterFont());
     m_glyphs = retrieveOrAddCachedFontGlyphs(m_fontDescription, fontSelector.get());
 }
 #endif
index 8c33abe..7b1d8ca 100644 (file)
@@ -111,7 +111,7 @@ public:
     WEBCORE_EXPORT FontCascade();
     WEBCORE_EXPORT FontCascade(const FontDescription&, float letterSpacing, float wordSpacing);
     // This constructor is only used if the platform wants to start with a native font.
-    WEBCORE_EXPORT FontCascade(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoothing);
+    WEBCORE_EXPORT FontCascade(const FontPlatformData&, FontSmoothingMode = AutoSmoothing);
 
     // FIXME: We should make this constructor platform-independent.
 #if PLATFORM(IOS)
@@ -156,7 +156,6 @@ public:
     void setWordSpacing(float s) { m_wordSpacing = s; }
     void setLetterSpacing(float s) { m_letterSpacing = s; }
     bool isFixedPitch() const;
-    bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
     
     FontRenderingMode renderingMode() const { return m_fontDescription.renderingMode(); }
 
index 6b026a6..f8fe414 100644 (file)
@@ -85,7 +85,6 @@ public:
         , m_smallCaps(FontSmallCapsOff)
         , m_isAbsoluteSize(false)
         , m_weight(FontWeightNormal)
-        , m_usePrinterFont(false)
         , m_renderingMode(NormalRenderingMode)
         , m_kerning(AutoKerning)
         , m_commonLigaturesState(NormalLigaturesState)
@@ -116,7 +115,6 @@ public:
     FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
     FontWeight lighterWeight() const;
     FontWeight bolderWeight() const;
-    bool usePrinterFont() const { return m_usePrinterFont; }
     // only use fixed default size when there is only one font family, and that family is "monospace"
     bool useFixedDefaultSize() const { return familyCount() == 1 && firstFamily() == monospaceFamily; }
     FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
@@ -153,7 +151,6 @@ public:
     void setIsSmallCaps(bool c) { setSmallCaps(c ? FontSmallCapsOn : FontSmallCapsOff); }
     void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
     void setWeight(FontWeight w) { m_weight = w; }
-    void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
     void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
     void setKerning(Kerning kerning) { m_kerning = kerning; }
     void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; }
@@ -190,7 +187,6 @@ public:
             && m_specifiedSize == other.m_specifiedSize
             && m_smallCaps == other.m_smallCaps
             && m_isAbsoluteSize == other.m_isAbsoluteSize
-            && m_usePrinterFont == other.m_usePrinterFont;
     }
 #endif
 
@@ -219,7 +215,6 @@ private:
     unsigned m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit size
                                   // (logical sizes like "medium" don't count).
     unsigned m_weight : 8; // FontWeight
-    unsigned m_usePrinterFont : 1;
 
     unsigned m_renderingMode : 1;  // Used to switch between CG and GDI text on Windows.
     unsigned m_kerning : 2; // Kerning
@@ -247,7 +242,6 @@ inline bool FontDescription::operator==(const FontDescription& other) const
         && m_smallCaps == other.m_smallCaps
         && m_isAbsoluteSize == other.m_isAbsoluteSize
         && m_weight == other.m_weight
-        && m_usePrinterFont == other.m_usePrinterFont
         && m_renderingMode == other.m_renderingMode
         && m_kerning == other.m_kerning
         && m_commonLigaturesState == other.m_commonLigaturesState
index af82e1f..3c56dfa 100644 (file)
@@ -85,10 +85,10 @@ public:
     FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 
 #if PLATFORM(COCOA)
-    WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool isPrinterFont = false, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
+    WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 #if USE(APPKIT)
     // FIXME: Remove this when all NSFont usage is removed.
-    WEBCORE_EXPORT FontPlatformData(NSFont *, float size, bool isPrinterFont = false, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
+    WEBCORE_EXPORT FontPlatformData(NSFont *, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 #endif
 #endif
 
@@ -144,9 +144,6 @@ public:
     bool syntheticOblique() const { return m_syntheticOblique; }
     bool isColorBitmapFont() const { return m_isColorBitmapFont; }
     bool isCompositeFontReference() const { return m_isCompositeFontReference; }
-#if PLATFORM(COCOA)
-    bool isPrinterFont() const { return m_isPrinterFont; }
-#endif
     FontOrientation orientation() const { return m_orientation; }
     FontWidthVariant widthVariant() const { return m_widthVariant; }
 
@@ -163,10 +160,10 @@ public:
 #elif OS(DARWIN)
 #if USE(APPKIT)
         ASSERT(m_font || !m_cgFont);
-        uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, static_cast<uintptr_t>(m_isPrinterFont << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique) };
+        uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, static_cast<uintptr_t>(m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique) };
 #else
         ASSERT(m_font || !m_cgFont || m_isEmoji);
-        uintptr_t hashCodes[3] = { static_cast<uintptr_t>(CFHash(m_font)), m_widthVariant, static_cast<uintptr_t>(m_isEmoji << 4 | m_isPrinterFont << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique) };
+        uintptr_t hashCodes[3] = { static_cast<uintptr_t>(CFHash(m_font)), m_widthVariant, static_cast<uintptr_t>(m_isEmoji << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique) };
 #endif // !PLATFORM(IOS)
         return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
 #elif USE(CAIRO)
@@ -184,9 +181,6 @@ public:
             && m_syntheticOblique == other.m_syntheticOblique
             && m_isColorBitmapFont == other.m_isColorBitmapFont
             && m_isCompositeFontReference == other.m_isCompositeFontReference
-#if PLATFORM(COCOA)
-            && m_isPrinterFont == other.m_isPrinterFont
-#endif
             && m_orientation == other.m_orientation
             && m_widthVariant == other.m_widthVariant;
     }
@@ -251,9 +245,6 @@ private:
 
     bool m_isColorBitmapFont { false };
     bool m_isCompositeFontReference { false };
-#if PLATFORM(COCOA)
-    bool m_isPrinterFont { false };
-#endif
 
 #if PLATFORM(WIN)
     bool m_useGDI { false };
index 3e19da1..2646917 100644 (file)
@@ -61,9 +61,6 @@ public:
     static bool supportsTypesettingFeatures(const FontCascade& font)
     {
 #if PLATFORM(COCOA)
-        if (!font.isPrinterFont())
-            return !font.typesettingFeatures();
-
         return !(font.typesettingFeatures() & ~(Kerning | Ligatures));
 #else
         return !font.typesettingFeatures();
index 54fec8c..c6eca45 100644 (file)
@@ -248,21 +248,7 @@ void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const G
 #endif
 
 #if !PLATFORM(IOS)
-    NSFont* drawFont;
-    if (!isPrinterFont()) {
-        drawFont = [platformData.nsFont() screenFont];
-        if (drawFont != platformData.nsFont()) {
-            // We are getting this in too many places (3406411); use ERROR so it only prints on debug versions for now. (We should debug this also, eventually).
-            LOG_ERROR("Attempting to set non-screen font (%@) when drawing to screen.  Using screen font anyway, may result in incorrect metrics.",
-                [[[platformData.nsFont() fontDescriptor] fontAttributes] objectForKey:NSFontNameAttribute]);
-        }
-    } else {
-        drawFont = [platformData.nsFont() printerFont];
-        if (drawFont != platformData.nsFont()) {
-            NSLog(@"Attempting to set non-printer font (%@) when printing.  Using printer font anyway, may result in incorrect metrics.",
-                [[[platformData.nsFont() fontDescriptor] fontAttributes] objectForKey:NSFontNameAttribute]);
-        }
-    }
+    NSFont* drawFont = [platformData.nsFont() printerFont];
 #endif
     
     CGContextSetFont(cgContext, platformData.cgFont());
index 1004a9c..2a76ab3 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore {
 // These CoreText Text Spacing feature selectors are not defined in CoreText.
 enum TextSpacingCTFeatureSelector { TextSpacingProportional, TextSpacingFullWidth, TextSpacingHalfWidth, TextSpacingThirdWidth, TextSpacingQuarterWidth };
 
-FontPlatformData::FontPlatformData(CTFontRef font, float size, bool isPrinterFont, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
+FontPlatformData::FontPlatformData(CTFontRef font, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
     : m_syntheticBold(syntheticBold)
     , m_syntheticOblique(syntheticOblique)
     , m_orientation(orientation)
@@ -51,7 +51,6 @@ FontPlatformData::FontPlatformData(CTFontRef font, float size, bool isPrinterFon
     , m_cgFont(adoptCF(CTFontCopyGraphicsFont(font, NULL)))
     , m_isColorBitmapFont(CTFontGetSymbolicTraits(font) & kCTFontTraitColorGlyphs)
     , m_isCompositeFontReference(CTFontGetSymbolicTraits(font) & kCTFontCompositeTrait)
-    , m_isPrinterFont(isPrinterFont)
 {
     ASSERT_ARG(font, font);
     CFRetain(m_font);
@@ -59,8 +58,8 @@ FontPlatformData::FontPlatformData(CTFontRef font, float size, bool isPrinterFon
 
 #if USE(APPKIT)
 // FIXME: Remove this when all NSFont usage is removed.
-FontPlatformData::FontPlatformData(NSFont *font, float size, bool isPrinterFont, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
-    : FontPlatformData((CTFontRef)font, size, isPrinterFont, syntheticBold, syntheticOblique, orientation, widthVariant)
+FontPlatformData::FontPlatformData(NSFont *font, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
+    : FontPlatformData((CTFontRef)font, size, syntheticBold, syntheticOblique, orientation, widthVariant)
 {
 }
 #endif
@@ -80,7 +79,6 @@ void FontPlatformData::platformDataInit(const FontPlatformData& f)
 #endif
     m_cgFont = f.m_cgFont;
     m_ctFont = f.m_ctFont;
-    m_isPrinterFont = f.m_isPrinterFont;
 }
 
 const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformData& f)
@@ -97,7 +95,6 @@ const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformD
         CFRelease(m_font);
     m_font = f.m_font;
     m_ctFont = f.m_ctFont;
-    m_isPrinterFont = f.m_isPrinterFont;
 
     return *this;
 }
index 3b13943..35ac270 100644 (file)
@@ -91,7 +91,7 @@ PassRefPtr<Font> FontCache::getSystemFontFallbackForCharacters(const FontDescrip
     bool syntheticBold = (originalTraits & kCTFontTraitBold) && !(actualTraits & kCTFontTraitBold);
     bool syntheticOblique = (originalTraits & kCTFontTraitItalic) && !(actualTraits & kCTFontTraitItalic);
 
-    FontPlatformData alternateFont(substituteFont.get(), platformData.size(), platformData.isPrinterFont(), syntheticBold, syntheticOblique, platformData.m_orientation);
+    FontPlatformData alternateFont(substituteFont.get(), platformData.size(), syntheticBold, syntheticOblique, platformData.m_orientation);
     alternateFont.m_isEmoji = CTFontIsAppleColorEmoji(substituteFont.get());
 
     return fontForPlatformData(alternateFont);
@@ -677,7 +677,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe
     bool syntheticBold = (traits & kCTFontTraitBold) && !(actualTraits & kCTFontTraitBold) && !isAppleColorEmoji;
     bool syntheticOblique = (traits & kCTFontTraitItalic) && !(actualTraits & kCTFontTraitItalic) && !isAppleColorEmoji;
 
-    auto result = std::make_unique<FontPlatformData>(ctFont.get(), size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant());
+    auto result = std::make_unique<FontPlatformData>(ctFont.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant());
     if (isAppleColorEmoji)
         result->m_isEmoji = true;
     return result;
index 879691e..0726f3a 100644 (file)
@@ -149,7 +149,7 @@ PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float sc
     CTFontSymbolicTraits fontTraits = CTFontGetSymbolicTraits(m_platformData.font());
     RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontCopyFontDescriptor(m_platformData.font()));
     RetainPtr<CTFontRef> scaledFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr));
-    FontPlatformData scaledFontData(scaledFont.get(), size, m_platformData.isPrinterFont(), false, false, m_platformData.orientation());
+    FontPlatformData scaledFontData(scaledFont.get(), size, false, false, m_platformData.orientation());
 
     if (scaledFontData.font()) {
         if (m_platformData.m_syntheticBold)
index 1ad7821..4efdfa6 100644 (file)
@@ -588,7 +588,6 @@ void ComplexTextController::adjustGlyphsAndAdvances()
         const CGSize* advances = complexTextRun.advances();
 
         bool lastRun = r + 1 == runCount;
-        bool roundsAdvances = !m_font.isPrinterFont() && font.platformData().roundsGlyphAdvances();
         float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
         CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth);
         const UChar* cp = complexTextRun.characters();
@@ -631,9 +630,6 @@ void ComplexTextController::adjustGlyphsAndAdvances()
             }
 
             float roundedAdvanceWidth = roundf(advance.width);
-            if (roundsAdvances)
-                advance.width = roundedAdvanceWidth;
-
             advance.width += font.syntheticBoldOffset();
 
  
index 02ec73a..79e1aca 100644 (file)
@@ -281,7 +281,7 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
                     // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on
                     // using the font as returned, even though it may not have the best NSFontRenderingMode.
                     if (!runFont) {
-                        FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont), m_font.fontDescription().usePrinterFont());
+                        FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont));
                         runFont = &fontCache().fontForPlatformData(runFontPlatformData).get();
                     }
 #else
index e9a1de9..8d91229 100644 (file)
@@ -389,12 +389,12 @@ RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& descr
         }
     }
 
-    substituteFont = description.usePrinterFont() ? [substituteFont printerFont] : [substituteFont screenFont];
+    substituteFont = [substituteFont printerFont];
 
     substituteFontTraits = [fontManager traitsOfFont:substituteFont];
     substituteFontWeight = [fontManager weightOfFont:substituteFont];
 
-    FontPlatformData alternateFont(substituteFont, platformData.size(), platformData.isPrinterFont(),
+    FontPlatformData alternateFont(substituteFont, platformData.size(),
         !isPlatformFont && isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(substituteFontWeight),
         !isPlatformFont && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait),
         platformData.m_orientation);
@@ -499,11 +499,11 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe
         actualTraits = [fontManager traitsOfFont:nsFont];
     NSInteger actualWeight = [fontManager weightOfFont:nsFont];
 
-    NSFont *platformFont = fontDescription.usePrinterFont() ? [nsFont printerFont] : [nsFont screenFont];
+    NSFont *platformFont = [nsFont printerFont];
     bool syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight);
     bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait);
 
-    return std::make_unique<FontPlatformData>(platformFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant());
+    return std::make_unique<FontPlatformData>(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant());
 }
 
 } // namespace WebCore
index f2cc219..bcff84d 100644 (file)
@@ -95,14 +95,13 @@ const Font* Font::compositeFontReferenceFont(NSFont *key) const
 
     auto addResult = m_derivedFontData->compositeFontReferences.add(key, nullptr);
     if (addResult.isNewEntry) {
-        bool isUsingPrinterFont = platformData().isPrinterFont();
-        NSFont *substituteFont = isUsingPrinterFont ? [key printerFont] : [key screenFont];
+        NSFont *substituteFont = [key printerFont];
 
         CTFontSymbolicTraits traits = CTFontGetSymbolicTraits((CTFontRef)substituteFont);
         bool syntheticBold = platformData().syntheticBold() && !(traits & kCTFontBoldTrait);
         bool syntheticOblique = platformData().syntheticOblique() && !(traits & kCTFontItalicTrait);
 
-        FontPlatformData substitutePlatform(substituteFont, platformData().size(), isUsingPrinterFont, syntheticBold, syntheticOblique, platformData().orientation(), platformData().widthVariant());
+        FontPlatformData substitutePlatform(substituteFont, platformData().size(), syntheticBold, syntheticOblique, platformData().orientation(), platformData().widthVariant());
         addResult.iterator->value = Font::create(substitutePlatform, isCustomFont());
     }
     return addResult.iterator->value.get();
@@ -274,7 +273,7 @@ void Font::platformDestroy()
 }
 
 #if !PLATFORM(IOS)
-PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
+PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
 {
     if (isCustomFont()) {
         FontPlatformData scaledFontData(m_platformData);
@@ -284,11 +283,11 @@ PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescr
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     float size = m_platformData.size() * scaleFactor;
-    FontPlatformData scaledFontData([[NSFontManager sharedFontManager] convertFont:m_platformData.nsFont() toSize:size], size, m_platformData.isPrinterFont(), false, false, m_platformData.orientation());
+    FontPlatformData scaledFontData([[NSFontManager sharedFontManager] convertFont:m_platformData.nsFont() toSize:size], size, false, false, m_platformData.orientation());
 
     // AppKit resets the type information (screen/printer) when you convert a font to a different size.
     // We have to fix up the font that we're handed back.
-    scaledFontData.setNSFont(fontDescription.usePrinterFont() ? [scaledFontData.nsFont() printerFont] : [scaledFontData.nsFont() screenFont]);
+    scaledFontData.setNSFont([scaledFontData.nsFont() printerFont]);
 
     if (scaledFontData.font()) {
         NSFontManager *fontManager = [NSFontManager sharedFontManager];
index 7d04f20..e793134 100644 (file)
@@ -168,8 +168,7 @@ static FontCascade& fontFromNSFont(NSFont *font)
         CFRelease(currentFont);
     currentFont = font;
     CFRetain(currentFont);
-    FontPlatformData f(font, [font pointSize]);
-    currentRenderer = FontCascade(f, ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+    currentRenderer = FontCascade(FontPlatformData(font, [font pointSize]));
     return currentRenderer;
 }
 
@@ -192,7 +191,7 @@ static float widthWithFont(NSString *string, NSFont *font)
     [string getCharacters:buffer.data()];
     
     if (canUseFastRenderer(buffer.data(), length)) {
-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]));
         TextRun run(buffer.data(), length);
         run.disableRoundingHacks();
         return webCoreFont.width(run);
@@ -224,7 +223,7 @@ static void drawAtPoint(NSString *string, NSPoint point, NSFont *font, NSColor *
         if (!flipped)
             CGContextScaleCTM(cgContext, 1, -1);
             
-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], Antialiased);
+        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), Antialiased);
         TextRun run(buffer.data(), length);
         run.disableRoundingHacks();
 
index a02c49e..0d257d0 100644 (file)
@@ -98,7 +98,6 @@ Ref<RenderStyle> resolveForDocument(const Document& document)
 
     FontDescription fontDescription;
     fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle.get().locale()));
-    fontDescription.setUsePrinterFont(document.printing() || !settings.screenFontSubstitutionEnabled());
     fontDescription.setRenderingMode(settings.fontRenderingMode());
     fontDescription.setOneFamily(standardFamily);
 
index 32995da..3acc113 100644 (file)
@@ -1,3 +1,36 @@
+2015-01-29  Sam Weinig  <sam@webkit.org>
+
+        Remove support for screen font substitution
+        https://bugs.webkit.org/show_bug.cgi?id=141038
+
+        Reviewed by Tim Horton.
+
+        * Misc/WebKitNSStringExtras.mm:
+        (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
+        (-[NSString _web_widthWithFont:]):
+        * Misc/WebStringTruncator.mm:
+        (fontFromNSFont):
+        Update for new signature of the FontPlatformData constructor, which no longer cares about
+        whether to use printer fonts.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        Remove the WebKitScreenFontSubstitutionEnabledKey key.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        Remove support for WebKitScreenFontSubstitutionEnabledKey.
+
+        (needsScreenFontsEnabledQuirk): Deleted.
+        Remove support for the Mountain Lion era 1-Password quirk.
+
+        (-[WebPreferences screenFontSubstitutionEnabled]): Deleted.
+        (-[WebPreferences setScreenFontSubstitutionEnabled:]): Deleted.
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+        (-[WebView _preferencesChanged:]):
+        Remove support for the screen font substitution setting.
+
 2015-01-29  Chris Dumez  <cdumez@apple.com>
 
         Clean up / modernize PageCache class
index 5d905e6..53379c5 100644 (file)
@@ -92,7 +92,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
         if (!flipped)
             CGContextScaleCTM(cgContext, 1, -1);
 
-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
+        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
         TextRun run(buffer.data(), length);
         run.disableRoundingHacks();
 
@@ -138,7 +138,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
     [self getCharacters:buffer.data()];
 
     if (canUseFastRenderer(buffer.data(), length)) {
-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]));
         TextRun run(buffer.data(), length);
         run.disableRoundingHacks();
         return webCoreFont.width(run);
index c5e4654..3628f85 100644 (file)
@@ -43,7 +43,7 @@ static WebCore::FontCascade& fontFromNSFont(NSFont *font)
     if ([font isEqual:currentNSFont.get().get()])
         return currentFont;
     currentNSFont.get() = font;
-    currentFont.get() = WebCore::FontCascade(WebCore::FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+    currentFont.get() = WebCore::FontCascade(WebCore::FontPlatformData(font, [font pointSize]));
     return currentFont;
 }
 
index 5707b93..56b19b8 100644 (file)
 #define WebKitShouldRespectImageOrientationKey @"WebKitShouldRespectImageOrientation"
 #define WebKitRequestAnimationFrameEnabledPreferenceKey @"WebKitRequestAnimationFrameEnabled"
 #define WebKitDiagnosticLoggingEnabledKey @"WebKitDiagnosticLoggingEnabled"
-#define WebKitScreenFontSubstitutionEnabledKey @"WebKitScreenFontSubstitutionEnabled"
 #define WebKitStorageBlockingPolicyKey @"WebKitStorageBlockingPolicy"
 #define WebKitPlugInSnapshottingEnabledPreferenceKey @"WebKitPlugInSnapshottingEnabled"
 #define WebKitQTKitEnabledPreferenceKey @"WebKitQTKitEnabled"
index 5448329..1367959 100644 (file)
@@ -543,12 +543,6 @@ public:
         [NSNumber numberWithBool:YES],  WebKitRequestAnimationFrameEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
         [NSNumber numberWithBool:NO],   WebKitDiagnosticLoggingEnabledKey,
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-        [NSNumber numberWithBool:NO],
-#else
-        [NSNumber numberWithBool:YES],
-#endif
-                                        WebKitScreenFontSubstitutionEnabledKey,
         [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
         [NSNumber numberWithBool:NO],   WebKitPlugInSnapshottingEnabledPreferenceKey,
 
@@ -2356,29 +2350,6 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey];
 }
 
-static bool needsScreenFontsEnabledQuirk()
-{
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-    static bool is1PasswordNeedingScreenFontsQuirk = WKExecutableWasLinkedOnOrBeforeMountainLion()
-        && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"ws.agile.1Password"];
-    return is1PasswordNeedingScreenFontsQuirk;
-#else
-    return NO;
-#endif
-}
-
-- (BOOL)screenFontSubstitutionEnabled
-{
-    if (needsScreenFontsEnabledQuirk())
-        return YES;
-    return [self _boolValueForKey:WebKitScreenFontSubstitutionEnabledKey];
-}
-
-- (void)setScreenFontSubstitutionEnabled:(BOOL)enabled
-{
-    [self _setBoolValue:enabled forKey:WebKitScreenFontSubstitutionEnabledKey];
-}
-
 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
 {
 #if PLATFORM(IOS)
index 0dcc069..fdd8b67 100644 (file)
@@ -394,9 +394,6 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (BOOL)diagnosticLoggingEnabled;
 - (void)setDiagnosticLoggingEnabled:(BOOL)enabled;
 
-- (BOOL)screenFontSubstitutionEnabled;
-- (void)setScreenFontSubstitutionEnabled:(BOOL)enabled;
-
 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy;
 - (WebStorageBlockingPolicy)storageBlockingPolicy;
 
index 7952f7a..51e34d5 100644 (file)
@@ -1208,7 +1208,6 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     _private->page->settings().setDefaultFixedFontSize(13);
     _private->page->settings().setDownloadableBinaryFontsEnabled(false);
     _private->page->settings().setAcceleratedDrawingEnabled([preferences acceleratedDrawingEnabled]);
-    _private->page->settings().setScreenFontSubstitutionEnabled(false);
     
     _private->page->settings().setFontFallbackPrefersPictographs(true);
     _private->page->settings().setPictographFontFamily("AppleColorEmoji");
@@ -2204,12 +2203,6 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setUsesEncodingDetector([preferences usesEncodingDetector]);
     settings.setFantasyFontFamily([preferences fantasyFontFamily]);
     settings.setFixedFontFamily([preferences fixedFontFamily]);
-    settings.setScreenFontSubstitutionEnabled(
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-        [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"] ||
-#endif
-        [preferences screenFontSubstitutionEnabled]
-    );
     settings.setForceFTPDirectoryListings([preferences _forceFTPDirectoryListings]);
     settings.setFTPDirectoryTemplatePath([preferences _ftpDirectoryTemplatePath]);
     settings.setLocalStorageDatabasePath([preferences _localStorageDatabasePath]);
index 7d6e9b5..c242c91 100644 (file)
@@ -1,3 +1,17 @@
+2015-01-29  Sam Weinig  <sam@webkit.org>
+
+        Remove support for screen font substitution
+        https://bugs.webkit.org/show_bug.cgi?id=141038
+
+        Reviewed by Tim Horton.
+
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::screenFontSubstitutionEnabled):
+        (WebPreferences::setScreenFontSubstitutionEnabled):
+        Remove implementations. Have this setting set on windows didn't have any effect before,
+        so this doesn't change behavior.
+
 2015-01-29  Chris Dumez  <cdumez@apple.com>
 
         Clean up / modernize PageCache class
index 74b08f5..31ec494 100644 (file)
 
 #define WebKitMockScrollbarsEnabledPreferenceKey "WebKitMockScrollbarsEnabled"
 
-#define WebKitScreenFontSubstitutionEnabledPreferenceKey "WebKitScreenFontSubstitutionEnabledPreferenceKey"
-
 #define WebKitEnableInheritURIQueryComponentPreferenceKey "WebKitEnableInheritURIQueryComponent"
index 10dddb5..a7434f2 100644 (file)
@@ -1278,15 +1278,13 @@ HRESULT WebPreferences::setMockScrollbarsEnabled(BOOL enabled)
     return S_OK;
 }
 
-HRESULT WebPreferences::screenFontSubstitutionEnabled(BOOL* enabled)
+HRESULT WebPreferences::screenFontSubstitutionEnabled(BOOL*)
 {
-    *enabled = boolValueForKey(WebKitScreenFontSubstitutionEnabledPreferenceKey);
     return S_OK;
 }
 
-HRESULT WebPreferences::setScreenFontSubstitutionEnabled(BOOL enabled)
+HRESULT WebPreferences::setScreenFontSubstitutionEnabled(BOOL)
 {
-    setBoolValue(WebKitScreenFontSubstitutionEnabledPreferenceKey, enabled);
     return S_OK;
 }
 
index 44c72f5..abd2950 100644 (file)
@@ -1,3 +1,36 @@
+2015-01-29  Sam Weinig  <sam@webkit.org>
+
+        Remove support for screen font substitution
+        https://bugs.webkit.org/show_bug.cgi?id=141038
+
+        Reviewed by Tim Horton.
+
+        * Shared/API/c/WKDeprecatedFunctions.cpp:
+        (WKPreferencesSetScreenFontSubstitutionEnabled):
+        (WKPreferencesGetScreenFontSubstitutionEnabled):
+        Move now empty preferences SPI to WKDeprecatedFunctions.
+        
+        * Shared/WebPreferencesDefinitions.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetScreenFontSubstitutionEnabled): Deleted.
+        (WKPreferencesGetScreenFontSubstitutionEnabled): Deleted.
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::presenterApplicationPid):
+        (WebKit::WebProcess::shouldForceScreenFontSubstitution): Deleted.
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        Stop piping screen font substitution setting to the web process.
+
 2015-01-29  Alexey Proskuryakov  <ap@apple.com>
 
         Frequent kernel panics when running WebKit regression tests
index fb13880..a6a9e54 100644 (file)
@@ -53,6 +53,9 @@ WK_EXPORT bool WKPreferencesGetRegionBasedColumnsEnabled(WKPreferencesRef);
 WK_EXPORT void WKPreferencesSetMultithreadedWebGLEnabled(WKPreferencesRef, bool);
 WK_EXPORT bool WKPreferencesGetMultithreadedWebGLEnabled(WKPreferencesRef);
 
+WK_EXPORT void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef);
+
 WK_EXPORT bool WKInspectorIsDebuggingJavaScript(WKInspectorRef);
 WK_EXPORT void WKInspectorToggleJavaScriptDebugging(WKInspectorRef);
 
@@ -106,6 +109,15 @@ bool WKPreferencesGetMultithreadedWebGLEnabled(WKPreferencesRef)
     return false;
 }
 
+void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef, bool)
+{
+}
+
+bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef)
+{
+    return false;
+}
+
 bool WKInspectorIsDebuggingJavaScript(WKInspectorRef)
 {
     return false;
index 778bf08..0e3b567 100644 (file)
 #define DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED false
 #endif
 
-#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)
-#define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED false
-#else
-#define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED true
-#endif
-
 #if PLATFORM(COCOA)
 #define DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED true
 #define DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED true
     macro(ScrollingPerformanceLoggingEnabled, scrollingPerformanceLoggingEnabled, Bool, bool, false) \
     macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED) \
     macro(ForceUpdateScrollbarsOnMainThreadForPerformanceTesting, forceUpdateScrollbarsOnMainThreadForPerformanceTesting, Bool, bool, false) \
-    macro(ScreenFontSubstitutionEnabled, screenFontSubstitutionEnabled, Bool, bool, DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED) \
     macro(CookieEnabled, cookieEnabled, Bool, bool, true) \
     macro(PlugInSnapshottingEnabled, plugInSnapshottingEnabled, Bool, bool, false) \
     macro(SnapshotAllPlugIns, snapshotAllPlugIns, Bool, bool, false) \
index a0e6e4a..4ced721 100644 (file)
@@ -38,7 +38,6 @@ WebProcessCreationParameters::WebProcessCreationParameters()
 #if PLATFORM(COCOA)
     , nsURLCacheMemoryCapacity(0)
     , nsURLCacheDiskCapacity(0)
-    , shouldForceScreenFontSubstitution(false)
     , shouldEnableKerningAndLigaturesByDefault(false)
     , shouldEnableJIT(false)
     , shouldEnableFTLJIT(false)
@@ -118,7 +117,6 @@ void WebProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) const
     encoder << acceleratedCompositingPort;
     encoder << uiProcessBundleResourcePath;
     encoder << uiProcessBundleResourcePathExtensionHandle;
-    encoder << shouldForceScreenFontSubstitution;
     encoder << shouldEnableKerningAndLigaturesByDefault;
     encoder << shouldEnableJIT;
     encoder << shouldEnableFTLJIT;
@@ -253,8 +251,6 @@ bool WebProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebProc
         return false;
     if (!decoder.decode(parameters.uiProcessBundleResourcePathExtensionHandle))
         return false;
-    if (!decoder.decode(parameters.shouldForceScreenFontSubstitution))
-        return false;
     if (!decoder.decode(parameters.shouldEnableKerningAndLigaturesByDefault))
         return false;
     if (!decoder.decode(parameters.shouldEnableJIT))
index b3ffe6a..ffe323c 100644 (file)
@@ -139,7 +139,6 @@ struct WebProcessCreationParameters {
     String uiProcessBundleResourcePath;
     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
 
-    bool shouldForceScreenFontSubstitution;
     bool shouldEnableKerningAndLigaturesByDefault;
     bool shouldEnableJIT;
     bool shouldEnableFTLJIT;
index 359d368..c058921 100644 (file)
@@ -298,15 +298,6 @@ uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->minimumFontSize();
 }
 
-void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesRef, bool enabled)
-{
-    toImpl(preferencesRef)->setScreenFontSubstitutionEnabled(enabled);
-}
-
-bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->screenFontSubstitutionEnabled();
-}
 
 void WKPreferencesSetCookieEnabled(WKPreferencesRef preferencesRef, bool enabled)
 {
index bca0739..eabce14 100644 (file)
@@ -225,10 +225,6 @@ WK_EXPORT void WKPreferencesSetScrollingPerformanceLoggingEnabled(WKPreferencesR
 WK_EXPORT bool WKPreferencesGetScrollingPerformanceLoggingEnabled(WKPreferencesRef preferencesRef);
 
 // Defaults to true
-WK_EXPORT void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferences, bool enabled);
-WK_EXPORT bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferences);
-
-// Defaults to true
 WK_EXPORT void WKPreferencesSetCookieEnabled(WKPreferencesRef preferences, bool enabled);
 WK_EXPORT bool WKPreferencesGetCookieEnabled(WKPreferencesRef preferences);
 
index 2d25ec8..94efa0b 100644 (file)
@@ -189,9 +189,6 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
     parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
     parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity];
 
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-    parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"];
-#endif
     parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey];
     parameters.shouldEnableJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCJITEnabledDefaultsKey];
     parameters.shouldEnableFTLJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCFTLJITEnabledDefaultsKey];
index 5810aba..d86d726 100644 (file)
@@ -2743,11 +2743,6 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings.setMinimumLogicalFontSize(store.getDoubleValueForKey(WebPreferencesKey::minimumLogicalFontSizeKey()));
     settings.setDefaultFontSize(store.getDoubleValueForKey(WebPreferencesKey::defaultFontSizeKey()));
     settings.setDefaultFixedFontSize(store.getDoubleValueForKey(WebPreferencesKey::defaultFixedFontSizeKey()));
-    settings.setScreenFontSubstitutionEnabled(store.getBoolValueForKey(WebPreferencesKey::screenFontSubstitutionEnabledKey())
-#if PLATFORM(COCOA)
-        || WebProcess::shared().shouldForceScreenFontSubstitution()
-#endif
-    );
     settings.setLayoutFallbackWidth(store.getUInt32ValueForKey(WebPreferencesKey::layoutFallbackWidthKey()));
     settings.setDeviceWidth(store.getUInt32ValueForKey(WebPreferencesKey::deviceWidthKey()));
     settings.setDeviceHeight(store.getUInt32ValueForKey(WebPreferencesKey::deviceHeightKey()));
index df94ee7..f9cf37c 100644 (file)
@@ -136,7 +136,6 @@ public:
 
 #if PLATFORM(COCOA)
     pid_t presenterApplicationPid() const { return m_presenterApplicationPid; }
-    bool shouldForceScreenFontSubstitution() const { return m_shouldForceScreenFontSubstitution; }
 #endif
     
     const TextCheckerState& textCheckerState() const { return m_textCheckerState; }
@@ -327,7 +326,6 @@ private:
     WebCore::MachSendRight m_compositingRenderServerPort;
     pid_t m_presenterApplicationPid;
     dispatch_group_t m_clearResourceCachesDispatchGroup;
-    bool m_shouldForceScreenFontSubstitution;
 #endif
 
     bool m_fullKeyboardAccessEnabled;
index 45adc09..aeae808 100644 (file)
@@ -193,7 +193,6 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& par
 
     m_compositingRenderServerPort = WTF::move(parameters.acceleratedCompositingPort);
     m_presenterApplicationPid = parameters.presenterApplicationPid;
-    m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
     FontCascade::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
 
     MemoryPressureHandler::ReliefLogger::setLoggingEnabled(parameters.shouldEnableMemoryPressureReliefLogging);
index 960a79f..6afcf79 100644 (file)
@@ -1,3 +1,14 @@
+2015-01-29  Sam Weinig  <sam@webkit.org>
+
+        Remove support for screen font substitution
+        https://bugs.webkit.org/show_bug.cgi?id=141038
+
+        Reviewed by Tim Horton.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetWebPreferencesToConsistentValues):
+        Remove call to now setScreenFontSubstitutionEnabled() which is a no-op.
+
 2015-01-29  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Make run-jsc-stress-tests --remote work on Linux too
index 546f467..3dcecf7 100644 (file)
@@ -842,7 +842,6 @@ static void resetWebPreferencesToConsistentValues(IWebPreferences* preferences)
     prefsPrivate->setMockScrollbarsEnabled(TRUE);
 
     preferences->setFontSmoothing(FontSmoothingTypeStandard);
-    prefsPrivate->setScreenFontSubstitutionEnabled(TRUE);
 
     setAlwaysAcceptCookies(false);
 }