WebKit Bugzilla
Attachment 341344 Details for
Bug 186002
: [Cocoa] Remove one of the two platform fonts inside FontPlatformData
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186002-20180525161135.patch (text/plain), 39.18 KB, created by
Myles C. Maxfield
on 2018-05-25 16:11:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-05-25 16:11:36 PDT
Size:
39.18 KB
patch
obsolete
>Subversion Revision: 232134 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 894ae700af9d610da747ec7560936e244b7e4c75..d8ee5ef7c5972a8bf5dbe2fa957cb09d588ccdfd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,67 @@ >+2018-05-25 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [Cocoa] Remove one of the two platform fonts inside FontPlatformData >+ https://bugs.webkit.org/show_bug.cgi?id=186002 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * platform/graphics/Font.cpp: >+ (WebCore::Font::applyTransforms const): >+ * platform/graphics/FontCache.h: >+ (WebCore::FontDescriptionKey::makeFlagsKey): >+ * platform/graphics/FontCascade.h: >+ (WebCore::FontCascade::weight const): >+ (WebCore::FontCascade::widthVariant const): Deleted. >+ * platform/graphics/FontDescription.cpp: >+ * platform/graphics/FontDescription.h: >+ (WebCore::FontDescription::nonCJKGlyphOrientation const): >+ (WebCore::FontDescription::setNonCJKGlyphOrientation): >+ (WebCore::FontDescription::operator== const): >+ (WebCore::FontDescription::widthVariant const): Deleted. >+ (WebCore::FontDescription::setWidthVariant): Deleted. >+ * platform/graphics/FontPlatformData.cpp: >+ (WebCore::FontPlatformData::FontPlatformData): >+ * platform/graphics/FontPlatformData.h: >+ (WebCore::FontPlatformData::orientation const): >+ (WebCore::FontPlatformData::textRenderingMode const): >+ (WebCore::FontPlatformData::operator== const): >+ (WebCore::FontPlatformData::widthVariant const): Deleted. >+ (WebCore::FontPlatformData::isForTextCombine const): Deleted. >+ * platform/graphics/cocoa/FontCacheCoreText.cpp: >+ (WebCore::preparePlatformFont): >+ (WebCore::FontCache::createFontPlatformData): >+ (WebCore::FontCache::systemFallbackForCharacters): >+ (WebCore::disablePlatformFontFallback): >+ * platform/graphics/cocoa/FontCacheCoreText.h: >+ * platform/graphics/cocoa/FontCascadeCocoa.mm: >+ (WebCore::showLetterpressedGlyphsWithAdvances): >+ (WebCore::showGlyphsWithAdvances): >+ (WebCore::MacGlyphToPathTranslator::path): >+ (WebCore::FontCascade::primaryFontIsSystemFont const): >+ * platform/graphics/cocoa/FontCocoa.mm: >+ (WebCore::Font::platformInit): >+ (WebCore::Font::platformBoundsForGlyph const): >+ (WebCore::Font::platformWidthForGlyph const): >+ * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: >+ (WebCore::FontFamilySpecificationCoreText::fontRanges const): >+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm: >+ (WebCore::FontPlatformData::FontPlatformData): >+ (WebCore::FontPlatformData::hash const): >+ (WebCore::FontPlatformData::ctFont const): >+ (WebCore::FontPlatformData::objectForEqualityCheck const): >+ (WebCore::mapFontWidthVariantToCTFeatureSelector): Deleted. >+ * platform/graphics/mac/ComplexTextControllerCoreText.mm: >+ (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): >+ * platform/graphics/mac/FontCustomPlatformData.cpp: >+ (WebCore::FontCustomPlatformData::fontPlatformData): >+ * platform/graphics/mac/GlyphPageMac.cpp: >+ (WebCore::GlyphPage::fill): >+ * platform/text/TextFlags.h: >+ * rendering/RenderCombineText.cpp: >+ (WebCore::RenderCombineText::combineTextIfNeeded): >+ > 2018-05-23 Chris Dumez <cdumez@apple.com> > > RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent >diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp >index 2e2ad390dcc9c014b41427fe0561eb2aa1730da4..4d55fb658fe34123ba2985da9a1cfd90b687963e 100644 >--- a/Source/WebCore/platform/graphics/Font.cpp >+++ b/Source/WebCore/platform/graphics/Font.cpp >@@ -370,7 +370,7 @@ bool Font::applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advance > { > #if PLATFORM(COCOA) > CTFontTransformOptions options = (enableKerning ? kCTFontTransformApplyPositioning : 0) | (requiresShaping ? kCTFontTransformApplyShaping : 0); >- return CTFontTransformGlyphs(m_platformData.ctFont(), glyphs, reinterpret_cast<CGSize*>(advances), glyphCount, options); >+ return CTFontTransformGlyphs(m_platformData.font(), glyphs, reinterpret_cast<CGSize*>(advances), glyphCount, options); > #else > UNUSED_PARAM(glyphs); > UNUSED_PARAM(advances); >diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h >index 5cd7b68fdfbb5979b8208f88ecec3f6de8b685e1..b0d86b6fc69c0730d8b4e8df275661e885a7ec45 100644 >--- a/Source/WebCore/platform/graphics/FontCache.h >+++ b/Source/WebCore/platform/graphics/FontCache.h >@@ -124,13 +124,12 @@ struct FontDescriptionKey { > private: > static std::array<unsigned, 2> makeFlagsKey(const FontDescription& description) > { >- unsigned first = static_cast<unsigned>(description.script()) << 14 >- | static_cast<unsigned>(description.shouldAllowUserInstalledFonts()) << 13 >- | static_cast<unsigned>(description.fontStyleAxis() == FontStyleAxis::slnt) << 12 >- | static_cast<unsigned>(description.opticalSizing()) << 11 >- | static_cast<unsigned>(description.textRenderingMode()) << 9 >- | static_cast<unsigned>(description.fontSynthesis()) << 6 >- | static_cast<unsigned>(description.widthVariant()) << 4 >+ unsigned first = static_cast<unsigned>(description.script()) << 12 >+ | static_cast<unsigned>(description.shouldAllowUserInstalledFonts()) << 11 >+ | static_cast<unsigned>(description.fontStyleAxis() == FontStyleAxis::slnt) << 10 >+ | static_cast<unsigned>(description.opticalSizing()) << 9 >+ | static_cast<unsigned>(description.textRenderingMode()) << 7 >+ | static_cast<unsigned>(description.fontSynthesis()) << 4 > | static_cast<unsigned>(description.nonCJKGlyphOrientation()) << 3 > | static_cast<unsigned>(description.orientation()) << 2 > | static_cast<unsigned>(description.renderingMode()); >diff --git a/Source/WebCore/platform/graphics/FontCascade.h b/Source/WebCore/platform/graphics/FontCascade.h >index e1e1b5222556ba96bcb4c24720c491e67d248aa0..56171729cfd523e6bf8d58ab7532b895fea75a11 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.h >+++ b/Source/WebCore/platform/graphics/FontCascade.h >@@ -154,7 +154,6 @@ public: > > FontSelectionValue italic() const { return m_fontDescription.italic(); } > FontSelectionValue weight() const { return m_fontDescription.weight(); } >- FontWidthVariant widthVariant() const { return m_fontDescription.widthVariant(); } > > bool isPlatformFont() const { return m_fonts->isForPlatformFont(); } > >diff --git a/Source/WebCore/platform/graphics/FontDescription.cpp b/Source/WebCore/platform/graphics/FontDescription.cpp >index 3d5dd357146077b28ae523e3a33e27bfd24569ac..f86362c7acf6ea56d0a98d4555a1c87430495312 100644 >--- a/Source/WebCore/platform/graphics/FontDescription.cpp >+++ b/Source/WebCore/platform/graphics/FontDescription.cpp >@@ -58,7 +58,6 @@ FontDescription::FontDescription() > : m_fontSelectionRequest { FontCascadeDescription::initialWeight(), FontCascadeDescription::initialStretch(), FontCascadeDescription::initialItalic() } > , m_orientation(Horizontal) > , m_nonCJKGlyphOrientation(static_cast<unsigned>(NonCJKGlyphOrientation::Mixed)) >- , m_widthVariant(RegularWidth) > , m_renderingMode(static_cast<unsigned>(FontRenderingMode::Normal)) > , m_textRendering(AutoTextRendering) > , m_script(USCRIPT_COMMON) >diff --git a/Source/WebCore/platform/graphics/FontDescription.h b/Source/WebCore/platform/graphics/FontDescription.h >index 96e286e271a0115002eb2c4f6e75be88066330fd..3cf12edd21422f19ecbe4238f348f46673e0fa63 100644 >--- a/Source/WebCore/platform/graphics/FontDescription.h >+++ b/Source/WebCore/platform/graphics/FontDescription.h >@@ -75,7 +75,6 @@ public: > > FontOrientation orientation() const { return static_cast<FontOrientation>(m_orientation); } > NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<NonCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } >- FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant>(m_widthVariant); } > const FontFeatureSettings& featureSettings() const { return m_featureSettings; } > const FontVariationSettings& variationSettings() const { return m_variationSettings; } > FontSynthesis fontSynthesis() const { return static_cast<FontSynthesis>(m_fontSynthesis); } >@@ -125,7 +124,6 @@ public: > void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; } > void setOrientation(FontOrientation orientation) { m_orientation = orientation; } > void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = static_cast<unsigned>(orientation); } >- void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; } // Make sure new callers of this sync with FontPlatformData::isForTextCombine()! > void setLocale(const AtomicString&); > void setFeatureSettings(FontFeatureSettings&& settings) { m_featureSettings = WTFMove(settings); } > #if ENABLE(VARIATION_FONTS) >@@ -163,7 +161,6 @@ private: > float m_computedSize { 0 }; // Computed size adjusted for the minimum font size and the zoom factor. > unsigned m_orientation : 1; // FontOrientation - Whether the font is rendering on a horizontal line or a vertical line. > unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used by vertical text. Determines the default orientation for non-ideograph glyphs. >- unsigned m_widthVariant : 2; // FontWidthVariant > unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows. > unsigned m_textRendering : 2; // TextRenderingMode > unsigned m_script : 7; // Used to help choose an appropriate font for generic font families. >@@ -196,7 +193,6 @@ inline bool FontDescription::operator==(const FontDescription& other) const > && m_textRendering == other.m_textRendering > && m_orientation == other.m_orientation > && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation >- && m_widthVariant == other.m_widthVariant > && m_locale == other.m_locale > && m_featureSettings == other.m_featureSettings > #if ENABLE(VARIATION_FONTS) >diff --git a/Source/WebCore/platform/graphics/FontPlatformData.cpp b/Source/WebCore/platform/graphics/FontPlatformData.cpp >index 0e3f7a7f2e5687f93981a78c446dbaf44c6c4569..9918bbf28e318cad4dd4b309e65aa97465caf1d8 100644 >--- a/Source/WebCore/platform/graphics/FontPlatformData.cpp >+++ b/Source/WebCore/platform/graphics/FontPlatformData.cpp >@@ -46,10 +46,9 @@ FontPlatformData::FontPlatformData() > { > } > >-FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant, TextRenderingMode textRenderingMode) >+FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, TextRenderingMode textRenderingMode) > : m_size(size) > , m_orientation(orientation) >- , m_widthVariant(widthVariant) > , m_textRenderingMode(textRenderingMode) > , m_syntheticBold(syntheticBold) > , m_syntheticOblique(syntheticOblique) >@@ -57,8 +56,8 @@ FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti > } > > #if USE(CG) && PLATFORM(WIN) >-FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant, TextRenderingMode textRenderingMode) >- : FontPlatformData(size, syntheticBold, syntheticOblique, orientation, widthVariant, textRenderingMode) >+FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, TextRenderingMode textRenderingMode) >+ : FontPlatformData(size, syntheticBold, syntheticOblique, orientation, textRenderingMode) > { > m_cgFont = cgFont; > ASSERT(m_cgFont); >diff --git a/Source/WebCore/platform/graphics/FontPlatformData.h b/Source/WebCore/platform/graphics/FontPlatformData.h >index c37654a6019d6fe686e84d8fd0eed0eb82ce7691..6d84fbd290abb22cf0379774b4a7ec735946abbd 100644 >--- a/Source/WebCore/platform/graphics/FontPlatformData.h >+++ b/Source/WebCore/platform/graphics/FontPlatformData.h >@@ -63,6 +63,8 @@ interface IDWriteFont; > interface IDWriteFontFace; > #endif > >+#define CAN_DISALLOW_USER_INSTALLED_FONTS ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)) >+ > namespace WebCore { > > class FontDescription; >@@ -76,10 +78,10 @@ public: > FontPlatformData(); > > FontPlatformData(const FontDescription&, const AtomicString& family); >- FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, TextRenderingMode = AutoTextRendering); >+ FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation = Horizontal, TextRenderingMode = AutoTextRendering); > > #if PLATFORM(COCOA) >- WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, TextRenderingMode = AutoTextRendering); >+ WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, TextRenderingMode = AutoTextRendering); > #endif > > static FontPlatformData cloneWithOrientation(const FontPlatformData&, FontOrientation); >@@ -87,7 +89,7 @@ public: > static FontPlatformData cloneWithSize(const FontPlatformData&, float); > > #if USE(CG) && PLATFORM(WIN) >- FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, FontWidthVariant, TextRenderingMode); >+ FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, TextRenderingMode); > #endif > > #if PLATFORM(WIN) >@@ -153,9 +155,7 @@ public: > bool syntheticOblique() const { return m_syntheticOblique; } > bool isColorBitmapFont() const { return m_isColorBitmapFont; } > FontOrientation orientation() const { return m_orientation; } >- FontWidthVariant widthVariant() const { return m_widthVariant; } > TextRenderingMode textRenderingMode() const { return m_textRenderingMode; } >- bool isForTextCombine() const { return widthVariant() != RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant(). > > #if USE(CAIRO) > cairo_scaled_font_t* scaledFont() const { return m_scaledFont.get(); } >@@ -177,7 +177,6 @@ public: > && m_syntheticOblique == other.m_syntheticOblique > && m_isColorBitmapFont == other.m_isColorBitmapFont > && m_orientation == other.m_orientation >- && m_widthVariant == other.m_widthVariant > && m_textRenderingMode == other.m_textRenderingMode; > } > >@@ -219,9 +218,10 @@ private: > #endif > > #if PLATFORM(COCOA) >- // FIXME: Get rid of one of these. These two fonts are subtly different, and it is not obvious which one to use where. > RetainPtr<CTFontRef> m_font; >+#if !CAN_DISALLOW_USER_INSTALLED_FONTS > mutable RetainPtr<CTFontRef> m_ctFont; >+#endif > #elif PLATFORM(WIN) > RefPtr<SharedGDIObject<HFONT>> m_font; > #endif >@@ -249,7 +249,6 @@ private: > float m_size { 0 }; > > FontOrientation m_orientation { Horizontal }; >- FontWidthVariant m_widthVariant { RegularWidth }; > TextRenderingMode m_textRenderingMode { AutoTextRendering }; > > bool m_syntheticBold { false }; >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >index c4f994610321430705d1acc3713cfb8b42ba4705..e3a02065b70b184f8dd0700aa4862668f9eb322e 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >@@ -36,7 +36,6 @@ > #include <wtf/NeverDestroyed.h> > > #define HAS_CORE_TEXT_WIDTH_ATTRIBUTE ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)) >-#define CAN_DISALLOW_USER_INSTALLED_FONTS ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)) > > namespace WebCore { > >@@ -543,8 +542,13 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescr > auto textRenderingMode = fontDescription.textRenderingMode(); > > if (!originalFont || (!features.size() && (!alwaysAddVariations && variations.isEmpty()) && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal() >- && (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal()))) >+ && (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal()))) { >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+ return adoptCF(CTFontCreateWithFontDescriptor(disablePlatformFontFallback(adoptCF(CTFontCopyFontDescriptor(originalFont)).get()).get(), size, nullptr)); >+#else > return originalFont; >+#endif >+ } > > // This algorithm is described at http://www.w3.org/TR/css3-fonts/#feature-precedence > FeaturesMap featuresToBeApplied; >@@ -658,6 +662,15 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescr > auto sizeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &size)); > CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, sizeNumber.get()); > } >+ >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+ { >+ CTFontFallbackOption fallbackOption = kCTFontFallbackOptionNone; >+ auto fallbackOptionNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &fallbackOption)); >+ CFDictionaryAddValue(attributes.get(), kCTFontFallbackOptionAttribute, fallbackOptionNumber.get()); >+ } >+#endif >+ > auto descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())); > auto result = adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get())); > return result; >@@ -1264,7 +1277,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe > bool syntheticBold, syntheticOblique; > std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(font.get(), fontDescription).boldObliquePair(); > >- return std::make_unique<FontPlatformData>(font.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode()); >+ return std::make_unique<FontPlatformData>(font.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.textRenderingMode()); > } > > typedef HashSet<RetainPtr<CTFontRef>, WTF::RetainPtrObjectHash<CTFontRef>, WTF::RetainPtrObjectHashTraits<CTFontRef>> FallbackDedupSet; >@@ -1359,7 +1372,7 @@ RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& descr > bool syntheticBold, syntheticOblique; > std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(substituteFont, description, isPlatformFont).boldObliquePair(); > >- FontPlatformData alternateFont(substituteFont, platformData.size(), syntheticBold, syntheticOblique, platformData.orientation(), platformData.widthVariant(), platformData.textRenderingMode()); >+ FontPlatformData alternateFont(substituteFont, platformData.size(), syntheticBold, syntheticOblique, platformData.orientation(), platformData.textRenderingMode()); > > return fontForPlatformData(alternateFont); > } >@@ -1491,4 +1504,16 @@ Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescripti > return *fontForFamily(fontDescription, AtomicString("Lucida Grande", AtomicString::ConstructFromLiteral), nullptr, nullptr, { }, false); > } > >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+RetainPtr<CTFontDescriptorRef> disablePlatformFontFallback(CTFontDescriptorRef fontDescriptor) >+{ >+ CTFontFallbackOption fallbackOption = kCTFontFallbackOptionNone; >+ auto fallbackOptionNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &fallbackOption)); >+ CFTypeRef keys[] = { kCTFontFallbackOptionAttribute }; >+ CFTypeRef values[] = { fallbackOptionNumber.get() }; >+ auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >+ return adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, attributes.get())); >+} >+#endif >+ > } >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h >index 5cf6cd29ef539b97fe53f172582f6ed0bf8b5cf4..6376057b4ec517b14fa3cd432c504df231ab9d2d 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h >+++ b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h >@@ -61,5 +61,6 @@ RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontDescriptorRef, CGFloat si > RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontRef, AllowUserInstalledFonts); > void addAttributesForWebFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts); > RetainPtr<CFSetRef> installedFontMandatoryAttributes(AllowUserInstalledFonts); >+RetainPtr<CTFontDescriptorRef> disablePlatformFontFallback(CTFontDescriptorRef); > > } >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >index 29d30e443bedad907dd118a73892b20faee05e30..ef959022502641d77b2e9c217f272f887b4a1860 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >@@ -104,7 +104,7 @@ static void showLetterpressedGlyphsWithAdvances(const FloatPoint& point, const F > Vector<CGPoint, 256> positions(count); > fillVectorWithHorizontalGlyphPositions(positions, context, advances, count); > >- CTFontRef ctFont = platformData.ctFont(); >+ CTFontRef ctFont = platformData.font(); > CGContextSetFontSize(context, CTFontGetSize(ctFont)); > > static CUICatalog *catalog = _UIKitGetTextEffectsCatalog(); >@@ -150,7 +150,7 @@ static void showGlyphsWithAdvances(const FloatPoint& point, const Font& font, CG > ScopedTextMatrix savedMatrix(runMatrix, context); > > Vector<CGSize, 256> translations(count); >- CTFontGetVerticalTranslationsForGlyphs(platformData.ctFont(), glyphs, translations.data(), count); >+ CTFontGetVerticalTranslationsForGlyphs(platformData.font(), glyphs, translations.data(), count); > > CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context)); > >@@ -161,10 +161,10 @@ static void showGlyphsWithAdvances(const FloatPoint& point, const Font& font, CG > position.x += advances[i].width; > position.y += advances[i].height; > } >- CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context); >+ CTFontDrawGlyphs(platformData.font(), glyphs, positions.data(), count, context); > } else { > fillVectorWithHorizontalGlyphPositions(positions, context, advances, count); >- CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context); >+ CTFontDrawGlyphs(platformData.font(), glyphs, positions.data(), count, context); > } > } > >@@ -406,7 +406,7 @@ private: > > Path MacGlyphToPathTranslator::path() > { >- RetainPtr<CGPathRef> result = adoptCF(CTFontCreatePathForGlyph(m_fontData->platformData().ctFont(), m_glyphBuffer.glyphAt(m_index), &m_translation)); >+ RetainPtr<CGPathRef> result = adoptCF(CTFontCreatePathForGlyph(m_fontData->platformData().font(), m_glyphBuffer.glyphAt(m_index), &m_translation)); > return adoptCF(CGPathCreateMutableCopy(result.get())); > } > >@@ -487,7 +487,7 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const > bool FontCascade::primaryFontIsSystemFont() const > { > const auto& fontData = primaryFont(); >- return CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get()); >+ return CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().font())).get()); > } > > // FIXME: Use this on all ports. >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm >index 13518a051075d02ce07af0cfcfdf1cc7efe0bee0..a8b1ced54a8cb50a5ec5c3dcd1b484961d2e87ac 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm >@@ -131,7 +131,7 @@ void Font::platformInit() > // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows: > // "If set, it is strongly recommended to use OS/2.sTypoAscender - OS/2.sTypoDescender+ OS/2.sTypoLineGap as a value for default line spacing for this font." > // On OS X, we only apply this rule in the important case of fonts with a MATH table. >- if (OpenType::fontHasMathTable(m_platformData.ctFont())) { >+ if (OpenType::fontHasMathTable(m_platformData.font())) { > short typoAscent, typoDescent, typoLineGap; > if (OpenType::tryGetTypoMetrics(m_platformData.font(), typoAscent, typoDescent, typoLineGap)) { > ascent = scaleEmToUnits(typoAscent, unitsPerEm) * pointSize; >@@ -164,7 +164,7 @@ void Font::platformInit() > #endif > > if (platformData().orientation() == Vertical && !isTextOrientationFallback()) >- m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.ctFont()); >+ m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.font()); > > #if PLATFORM(IOS) > CGFloat adjustment = shouldUseAdjustment(m_platformData.font()) ? ceil((ascent + descent) * kLineHeightAdjustment) : 0; >@@ -572,7 +572,7 @@ void Font::determinePitch() > FloatRect Font::platformBoundsForGlyph(Glyph glyph) const > { > FloatRect boundingBox; >- boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == Vertical ? kCTFontOrientationVertical : kCTFontOrientationHorizontal, &glyph, 0, 1); >+ boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.font(), platformData().orientation() == Vertical ? kCTFontOrientationVertical : kCTFontOrientationHorizontal, &glyph, 0, 1); > boundingBox.setY(-boundingBox.maxY()); > if (m_syntheticBoldOffset) > boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset); >@@ -589,10 +589,10 @@ float Font::platformWidthForGlyph(Glyph glyph) const > if (platformData().size()) { > CTFontOrientation orientation = horizontal || m_isBrokenIdeographFallback ? kCTFontOrientationHorizontal : kCTFontOrientationVertical; > // FIXME: Remove this special-casing when <rdar://problem/28197291> and <rdar://problem/28662086> are fixed. >- if (CTFontIsAppleColorEmoji(m_platformData.ctFont()) || m_platformData.hasVariations()) >- CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), orientation, &glyph, &advance, 1); >+ if (CTFontIsAppleColorEmoji(m_platformData.font()) || m_platformData.hasVariations()) >+ CTFontGetAdvancesForGlyphs(m_platformData.font(), orientation, &glyph, &advance, 1); > else >- CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.ctFont(), orientation, style, &glyph, &advance, 1); >+ CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.font(), orientation, style, &glyph, &advance, 1); > } > return advance.width + m_syntheticBoldOffset; > } >diff --git a/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp >index 9e711e3d6c1479b5cc48f9787ca59a0fa0c8a33c..d71393c7f77ca8f4cf75191a5a3463d25f402442 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp >@@ -58,7 +58,7 @@ FontRanges FontFamilySpecificationCoreText::fontRanges(const FontDescription& fo > bool syntheticBold, syntheticOblique; > std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(fontForSynthesisComputation.get(), fontDescription).boldObliquePair(); > >- FontPlatformData fontPlatformData(font.get(), size, false, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode()); >+ FontPlatformData fontPlatformData(font.get(), size, false, syntheticOblique, fontDescription.orientation(), fontDescription.textRenderingMode()); > > return FontRanges(FontCache::singleton().fontForPlatformData(fontPlatformData)); > } >diff --git a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm >index 5594ef44ac51d2e6d8887c4a10fdd3184135d2dc..1a567ee37de8a1c0cacede9271d84eefda0b0a3a 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm >@@ -38,8 +38,8 @@ 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 syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant, TextRenderingMode textRenderingMode) >- : FontPlatformData(size, syntheticBold, syntheticOblique, orientation, widthVariant, textRenderingMode) >+FontPlatformData::FontPlatformData(CTFontRef font, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, TextRenderingMode textRenderingMode) >+ : FontPlatformData(size, syntheticBold, syntheticOblique, orientation, textRenderingMode) > { > ASSERT_ARG(font, font); > m_font = font; >@@ -55,7 +55,7 @@ FontPlatformData::FontPlatformData(CTFontRef font, float size, bool syntheticBol > > unsigned FontPlatformData::hash() const > { >- uintptr_t flags = static_cast<uintptr_t>(m_widthVariant << 6 | m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique); >+ uintptr_t flags = static_cast<uintptr_t>(m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique); > uintptr_t fontHash = reinterpret_cast<uintptr_t>(CFHash(m_font.get())); > uintptr_t hashCodes[] = { fontHash, flags }; > return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); >@@ -77,26 +77,7 @@ CTFontRef FontPlatformData::registeredFont() const > return nullptr; > } > >-inline int mapFontWidthVariantToCTFeatureSelector(FontWidthVariant variant) >-{ >- switch(variant) { >- case RegularWidth: >- return TextSpacingProportional; >- >- case HalfWidth: >- return TextSpacingHalfWidth; >- >- case ThirdWidth: >- return TextSpacingThirdWidth; >- >- case QuarterWidth: >- return TextSpacingQuarterWidth; >- } >- >- ASSERT_NOT_REACHED(); >- return TextSpacingProportional; >-} >- >+#if !CAN_DISALLOW_USER_INSTALLED_FONTS > static CFDictionaryRef cascadeToLastResortAttributesDictionary() > { > static CFDictionaryRef attributes = nullptr; >@@ -142,29 +123,21 @@ static RetainPtr<CTFontDescriptorRef> cascadeToLastResortAndVariationsFontDescri > #endif > #undef WORKAROUND_CORETEXT_VARIATIONS_WITH_FALLBACK_LIST_BUG > } >+#endif > > CTFontRef FontPlatformData::ctFont() const > { >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+ return font(); >+#else > if (m_ctFont) > return m_ctFont.get(); > > ASSERT(m_font); > m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_font.get(), m_size, 0, cascadeToLastResortAndVariationsFontDescriptor(m_font.get()).get())); > >- if (m_widthVariant != RegularWidth) { >- int featureTypeValue = kTextSpacingType; >- int featureSelectorValue = mapFontWidthVariantToCTFeatureSelector(m_widthVariant); >- RetainPtr<CTFontDescriptorRef> sourceDescriptor = adoptCF(CTFontCopyFontDescriptor(m_ctFont.get())); >- RetainPtr<CFNumberRef> featureType = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeValue)); >- RetainPtr<CFNumberRef> featureSelector = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorValue)); >- RetainPtr<CTFontDescriptorRef> newDescriptor = adoptCF(CTFontDescriptorCreateCopyWithFeature(sourceDescriptor.get(), featureType.get(), featureSelector.get())); >- RetainPtr<CTFontRef> newFont = adoptCF(CTFontCreateWithFontDescriptor(newDescriptor.get(), m_size, 0)); >- >- if (newFont) >- m_ctFont = newFont; >- } >- > return m_ctFont.get(); >+#endif > } > > RetainPtr<CFTypeRef> FontPlatformData::objectForEqualityCheck(CTFontRef ctFont) >@@ -179,7 +152,7 @@ RetainPtr<CFTypeRef> FontPlatformData::objectForEqualityCheck(CTFontRef ctFont) > > RetainPtr<CFTypeRef> FontPlatformData::objectForEqualityCheck() const > { >- return objectForEqualityCheck(ctFont()); >+ return objectForEqualityCheck(font()); > } > > RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const >diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >index 4c01b6553adc69979a724e502ddd2f6f5e894bfd..6789a9916a74a31be111ab74675e887939b8fbcd 100644 >--- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >+++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >@@ -257,7 +257,12 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, > m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, runRange.location, runRange.location + runRange.length, m_run.ltr())); > continue; > } >- FontPlatformData runFontPlatformData(runCTFont, CTFontGetSize(runCTFont)); >+ auto size = CTFontGetSize(runCTFont); >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+ auto fontWithoutFallback = adoptCF(CTFontCreateWithFontDescriptor(disablePlatformFontFallback(adoptCF(CTFontCopyFontDescriptor(runCTFont)).get()).get(), size, nullptr)); >+ runCTFont = fontWithoutFallback.get(); >+#endif >+ FontPlatformData runFontPlatformData(runCTFont, size); > runFont = FontCache::singleton().fontForPlatformData(runFontPlatformData).ptr(); > } > if (m_fallbackFonts && runFont != &m_font.primaryFont()) >diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >index 749a585057434fa3cff4bddd5617622339f87f1a..f1be9fcf9304b1356b7e2205b2988e7c43930da6 100644 >--- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >+++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >@@ -44,11 +44,10 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& > > int size = fontDescription.computedPixelSize(); > FontOrientation orientation = fontDescription.orientation(); >- FontWidthVariant widthVariant = fontDescription.widthVariant(); > RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(modifiedFontDescriptor.get(), size, nullptr)); > font = preparePlatformFont(font.get(), fontDescription, &fontFaceFeatures, &fontFaceVariantSettings, fontFaceCapabilities, fontDescription.computedSize()); > ASSERT(font); >- return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode()); >+ return FontPlatformData(font.get(), size, bold, italic, orientation, fontDescription.textRenderingMode()); > } > > std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer, const String& itemInCollection) >diff --git a/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp b/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp >index 0e7e600ed3dd10661664ca22ad6c19747013271a..45ec4ab1facbcdee280a1f661fa1852755a85cd5 100644 >--- a/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp >+++ b/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp >@@ -56,9 +56,9 @@ bool GlyphPage::fill(UChar* buffer, unsigned bufferLength) > unsigned glyphStep = bufferLength / GlyphPage::size; > > if (shouldFillWithVerticalGlyphs(buffer, bufferLength, font)) >- CTFontGetVerticalGlyphsForCharacters(font.platformData().ctFont(), buffer, glyphs.data(), bufferLength); >+ CTFontGetVerticalGlyphsForCharacters(font.platformData().font(), buffer, glyphs.data(), bufferLength); > else >- CTFontGetGlyphsForCharacters(font.platformData().ctFont(), buffer, glyphs.data(), bufferLength); >+ CTFontGetGlyphsForCharacters(font.platformData().font(), buffer, glyphs.data(), bufferLength); > > bool haveGlyphs = false; > for (unsigned i = 0; i < GlyphPage::size; ++i) { >diff --git a/Source/WebCore/platform/text/TextFlags.h b/Source/WebCore/platform/text/TextFlags.h >index e295661a66227572d25fada96c895507082242b5..22470f8c947572de4db0d5802a20ef3f37b49767 100644 >--- a/Source/WebCore/platform/text/TextFlags.h >+++ b/Source/WebCore/platform/text/TextFlags.h >@@ -328,18 +328,6 @@ struct FontVariantEastAsianValues { > FontVariantEastAsianRuby ruby; > }; > >-enum FontWidthVariant { >- RegularWidth, >- HalfWidth, >- ThirdWidth, >- QuarterWidth, >- LastFontWidthVariant = QuarterWidth >-}; >- >-const unsigned FontWidthVariantWidth = 2; >- >-COMPILE_ASSERT(!(LastFontWidthVariant >> FontWidthVariantWidth), FontWidthVariantWidth_is_correct); >- > enum FontSmallCaps { > FontSmallCapsOff = 0, > FontSmallCapsOn = 1 >diff --git a/Source/WebCore/rendering/RenderCombineText.cpp b/Source/WebCore/rendering/RenderCombineText.cpp >index 9cf4fb8edc2a258737d4300617f8e9b362186e2d..f0ec6e83504ba2328b48edc37b5d2a2ae1a178da 100644 >--- a/Source/WebCore/rendering/RenderCombineText.cpp >+++ b/Source/WebCore/rendering/RenderCombineText.cpp >@@ -140,9 +140,12 @@ void RenderCombineText::combineTextIfNeeded() > shouldUpdateFont = m_combineFontStyle->setFontDescription(description); // Need to change font orientation to horizontal. > else { > // Need to try compressed glyphs. >- static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth }; >+ static const FontTaggedSetting<int> widthVariants[] = { FontTaggedSetting<int>(fontFeatureTag("hwid"), 1), FontTaggedSetting<int>(fontFeatureTag("twid"), 1), FontTaggedSetting<int>(fontFeatureTag("qwid"), 1) }; >+ FontFeatureSettings featureSettings = description.featureSettings(); > for (auto widthVariant : widthVariants) { >- description.setWidthVariant(widthVariant); // When modifying this, make sure to keep it in sync with FontPlatformData::isForTextCombine()! >+ auto featureSettingsWithWidthVariant = featureSettings; >+ featureSettingsWithWidthVariant.insert(WTFMove(widthVariant)); >+ description.setFeatureSettings(WTFMove(featureSettingsWithWidthVariant)); > > FontCascade compressedFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing()); > compressedFont.update(fontSelector);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186002
: 341344 |
341362
|
341365
|
341367
|
341371
|
341740