WebKit Bugzilla
Attachment 341391 Details for
Bug 185998
: [Cocoa] Use real font features instead of widthVariant
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185998-20180525224429.patch (text/plain), 31.80 KB, created by
Myles C. Maxfield
on 2018-05-25 22:44:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-05-25 22:44:30 PDT
Size:
31.80 KB
patch
obsolete
>Subversion Revision: 232134 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 894ae700af9d610da747ec7560936e244b7e4c75..848bd172a9597383755bf380d895bd3b9513bcd8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,57 @@ >+2018-05-25 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [Cocoa] Use real font features instead of widthVariant >+ https://bugs.webkit.org/show_bug.cgi?id=185998 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ widthVariant was implemented before we had support for real font features, and it uses font >+ features under the hood. We should just migrate it on top of our real support for font >+ features. This frees up some bits inside every FontDescription object, and also gets us one >+ step closer to eliminating one of the two CTFonts inside every FontPlatformData object. >+ >+ This is implemented by adding a new value to the font-variant-east-asian: <east-asian-width-values> >+ enum. However, this new value isn't parsed from Web content or emitted fromgetComputedStyle(), so >+ it's just an implementation detail. >+ >+ No new tests because there is no behavior change. >+ >+ * 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::FontCache::createFontPlatformData): >+ (WebCore::FontCache::systemFallbackForCharacters): >+ * 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::mapFontWidthVariantToCTFeatureSelector): Deleted. >+ * platform/graphics/mac/FontCustomPlatformData.cpp: >+ (WebCore::FontCustomPlatformData::fontPlatformData): >+ * 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/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 38ad56c151fc41fdeb353641d899b1967004bb17..56ee8b396d312284c7ce16109854eafb9dbd3469 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -1503,6 +1503,11 @@ static Ref<CSSValue> fontVariantEastAsianPropertyValue(FontVariantEastAsianVaria > case FontVariantEastAsianWidth::Proportional: > valueList->append(cssValuePool.createIdentifierValue(CSSValueProportionalWidth)); > break; >+ case FontVariantEastAsianWidth::Half: >+ case FontVariantEastAsianWidth::Third: >+ case FontVariantEastAsianWidth::Quarter: >+ ASSERT_NOT_REACHED(); >+ break; > } > > if (ruby == FontVariantEastAsianRuby::Yes) >@@ -2219,6 +2224,11 @@ static Ref<CSSValue> fontVariantFromStyle(const RenderStyle& style) > case FontVariantEastAsianWidth::Proportional: > list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalWidth)); > break; >+ case FontVariantEastAsianWidth::Half: >+ case FontVariantEastAsianWidth::Third: >+ case FontVariantEastAsianWidth::Quarter: >+ ASSERT_NOT_REACHED(); >+ break; > } > > switch (style.fontDescription().variantEastAsianRuby()) { >diff --git a/Source/WebCore/css/FontVariantBuilder.cpp b/Source/WebCore/css/FontVariantBuilder.cpp >index 54648ae113864079cb163775e2a4c9834b454376..38bd10b62caf31af3c563022a78ef13d7c586353 100644 >--- a/Source/WebCore/css/FontVariantBuilder.cpp >+++ b/Source/WebCore/css/FontVariantBuilder.cpp >@@ -358,6 +358,11 @@ Ref<CSSValue> computeFontVariant(const FontVariantSettings& variantSettings) > case FontVariantEastAsianWidth::Proportional: > list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalWidth)); > break; >+ case FontVariantEastAsianWidth::Half: >+ case FontVariantEastAsianWidth::Third: >+ case FontVariantEastAsianWidth::Quarter: >+ ASSERT_NOT_REACHED(); >+ break; > } > > switch (variantSettings.eastAsianRuby) { >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp >index bcece703db0fcf264ec83d6de0b5fe3b6607dbab..6ed8c6fd34703e3ba728d68ab147b6427f57af5c 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -734,6 +734,11 @@ static RefPtr<CSSValue> consumeFontVariantEastAsian(CSSParserTokenRange& range) > case FontVariantEastAsianWidth::Proportional: > values->append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalWidth)); > break; >+ case FontVariantEastAsianWidth::Half: >+ case FontVariantEastAsianWidth::Third: >+ case FontVariantEastAsianWidth::Quarter: >+ ASSERT_NOT_REACHED(); >+ break; > } > > switch (ruby) { >diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h >index 5cd7b68fdfbb5979b8208f88ecec3f6de8b685e1..e80c9331b18e1b24d2ea5edffc168252364f8d3f 100644 >--- a/Source/WebCore/platform/graphics/FontCache.h >+++ b/Source/WebCore/platform/graphics/FontCache.h >@@ -124,17 +124,16 @@ 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()); >- unsigned second = static_cast<unsigned>(description.variantEastAsianRuby()) << 27 >+ unsigned second = static_cast<unsigned>(description.variantEastAsianRuby()) << 28 > | static_cast<unsigned>(description.variantEastAsianWidth()) << 25 > | static_cast<unsigned>(description.variantEastAsianVariant()) << 22 > | static_cast<unsigned>(description.variantAlternates()) << 21 >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..748ab8137b3fc772a126f6b062b122f44c1e508e 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. >@@ -181,7 +178,7 @@ private: > unsigned m_variantNumericSlashedZero : 1; // FontVariantNumericSlashedZero > unsigned m_variantAlternates : 1; // FontVariantAlternates > unsigned m_variantEastAsianVariant : 3; // FontVariantEastAsianVariant >- unsigned m_variantEastAsianWidth : 2; // FontVariantEastAsianWidth >+ unsigned m_variantEastAsianWidth : 3; // FontVariantEastAsianWidth > unsigned m_variantEastAsianRuby : 1; // FontVariantEastAsianRuby > unsigned m_opticalSizing : 1; // FontOpticalSizing > unsigned m_fontStyleAxis : 1; // Whether "font-style: italic" or "font-style: oblique 20deg" was specified >@@ -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..bf8191dc03c80ba25541091eddde816a52610535 100644 >--- a/Source/WebCore/platform/graphics/FontPlatformData.h >+++ b/Source/WebCore/platform/graphics/FontPlatformData.h >@@ -76,10 +76,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 +87,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 +153,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 +175,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; > } > >@@ -249,7 +246,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..8c3325c05e4bba062fd9488ccb46ca7cabbad7b0 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >@@ -130,6 +130,12 @@ static inline void appendTrueTypeFeature(CFMutableArrayRef features, const FontF > appendRawTrueTypeFeature(features, kTextSpacingType, kMonospacedTextSelector); > else if (tagEquals(feature.tag(), "pwid") && feature.enabled()) > appendRawTrueTypeFeature(features, kTextSpacingType, kProportionalTextSelector); >+ else if (tagEquals(feature.tag(), "hwid") && feature.enabled()) >+ appendRawTrueTypeFeature(features, kTextSpacingType, kHalfWidthTextSelector); >+ else if (tagEquals(feature.tag(), "twid") && feature.enabled()) >+ appendRawTrueTypeFeature(features, kTextSpacingType, kThirdWidthTextSelector); >+ else if (tagEquals(feature.tag(), "qwid") && feature.enabled()) >+ appendRawTrueTypeFeature(features, kTextSpacingType, kQuarterWidthTextSelector); > else if (tagEquals(feature.tag(), "ruby") && feature.enabled()) > appendRawTrueTypeFeature(features, kRubyKanaType, kRubyKanaOnSelector); > } >@@ -349,6 +355,15 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings& > case FontVariantEastAsianWidth::Proportional: > result.add(fontFeatureTag("pwid"), 1); > break; >+ case FontVariantEastAsianWidth::Half: >+ result.add(fontFeatureTag("hwid"), 1); >+ break; >+ case FontVariantEastAsianWidth::Third: >+ result.add(fontFeatureTag("twid"), 1); >+ break; >+ case FontVariantEastAsianWidth::Quarter: >+ result.add(fontFeatureTag("qwid"), 1); >+ break; > default: > ASSERT_NOT_REACHED(); > } >@@ -1264,7 +1279,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 +1374,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); > } >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..a5c772ce5fbf0480f88a64f7acc6b5cfbca9eae4 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,6 @@ 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; >-} >- > static CFDictionaryRef cascadeToLastResortAttributesDictionary() > { > static CFDictionaryRef attributes = nullptr; >@@ -151,19 +131,6 @@ CTFontRef FontPlatformData::ctFont() const > 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(); > } > >diff --git a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp >index 19af6761358c9a1a34cf42d9459f762c6da9ad5e..ad43556f25c52bc8d91c768ec750ddd2af4f89d0 100644 >--- a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp >+++ b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp >@@ -183,7 +183,6 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other) > > m_size = other.m_size; > m_orientation = other.m_orientation; >- m_widthVariant = other.m_widthVariant; > m_textRenderingMode = other.m_textRenderingMode; > > m_syntheticBold = other.m_syntheticBold; >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/text/TextFlags.h b/Source/WebCore/platform/text/TextFlags.h >index e295661a66227572d25fada96c895507082242b5..a25cce42a471c3ce9dd0bf3704e9aff906a72f96 100644 >--- a/Source/WebCore/platform/text/TextFlags.h >+++ b/Source/WebCore/platform/text/TextFlags.h >@@ -133,7 +133,10 @@ enum class FontVariantEastAsianVariant { > enum class FontVariantEastAsianWidth { > Normal, > Full, >- Proportional >+ Proportional, >+ Half, >+ Third, >+ Quarter > }; > > enum class FontVariantEastAsianRuby { >@@ -237,19 +240,19 @@ struct FontVariantSettings { > > unsigned uniqueValue() const > { >- return static_cast<unsigned>(commonLigatures) << 26 >- | static_cast<unsigned>(discretionaryLigatures) << 24 >- | static_cast<unsigned>(historicalLigatures) << 22 >- | static_cast<unsigned>(contextualAlternates) << 20 >- | static_cast<unsigned>(position) << 18 >- | static_cast<unsigned>(caps) << 15 >- | static_cast<unsigned>(numericFigure) << 13 >- | static_cast<unsigned>(numericSpacing) << 11 >- | static_cast<unsigned>(numericFraction) << 9 >- | static_cast<unsigned>(numericOrdinal) << 8 >- | static_cast<unsigned>(numericSlashedZero) << 7 >- | static_cast<unsigned>(alternates) << 6 >- | static_cast<unsigned>(eastAsianVariant) << 3 >+ return static_cast<unsigned>(commonLigatures) << 27 >+ | static_cast<unsigned>(discretionaryLigatures) << 25 >+ | static_cast<unsigned>(historicalLigatures) << 23 >+ | static_cast<unsigned>(contextualAlternates) << 21 >+ | static_cast<unsigned>(position) << 19 >+ | static_cast<unsigned>(caps) << 16 >+ | static_cast<unsigned>(numericFigure) << 14 >+ | static_cast<unsigned>(numericSpacing) << 12 >+ | static_cast<unsigned>(numericFraction) << 10 >+ | static_cast<unsigned>(numericOrdinal) << 9 >+ | static_cast<unsigned>(numericSlashedZero) << 8 >+ | static_cast<unsigned>(alternates) << 7 >+ | static_cast<unsigned>(eastAsianVariant) << 4 > | static_cast<unsigned>(eastAsianWidth) << 1 > | static_cast<unsigned>(eastAsianRuby) << 0; > } >@@ -328,18 +331,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..0611729480448d9906222fe6a7a7c40624fe2706 100644 >--- a/Source/WebCore/rendering/RenderCombineText.cpp >+++ b/Source/WebCore/rendering/RenderCombineText.cpp >@@ -140,9 +140,9 @@ 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 FontVariantEastAsianWidth widthVariants[] = { FontVariantEastAsianWidth::Half, FontVariantEastAsianWidth::Third, FontVariantEastAsianWidth::Quarter }; > for (auto widthVariant : widthVariants) { >- description.setWidthVariant(widthVariant); // When modifying this, make sure to keep it in sync with FontPlatformData::isForTextCombine()! >+ description.setVariantEastAsianWidth(widthVariant) > > 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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185998
:
341333
|
341349
|
341352
|
341357
|
341359
| 341391