Changeset 176789 in webkit
- Timestamp:
- Dec 4, 2014, 3:50:26 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176780 r176789 1 2014-12-03 Antti Koivisto <antti@apple.com> 2 3 Remove isSpecifiedFont boolean from FontDescription 4 https://bugs.webkit.org/show_bug.cgi?id=139233 5 6 Reviewed by Andreas Kling. 7 8 It is barely used. 9 10 * css/StyleBuilderCustom.h: 11 (WebCore::StyleBuilderCustom::applyInheritFontFamily): 12 (WebCore::StyleBuilderCustom::applyValueFontFamily): 13 * platform/graphics/FontDescription.cpp: 14 (WebCore::genericFamiliesSet): 15 (WebCore::FontDescription::hasGenericFirstFamily): 16 17 Add a function to test for generic families. 18 19 * platform/graphics/FontDescription.h: 20 (WebCore::FontDescription::FontDescription): 21 (WebCore::FontDescription::setTextRenderingMode): 22 (WebCore::FontDescription::operator==): 23 (WebCore::FontDescription::isSpecifiedFont): Deleted. 24 (WebCore::FontDescription::setIsSpecifiedFont): Deleted. 25 * rendering/RenderText.cpp: 26 (WebCore::RenderText::computeUseBackslashAsYenSymbol): 27 28 This is the only client. 29 Figure out the equivalent information dynamically if needed. 30 1 31 2014-12-03 Joonghun Park <jh718.park@samsung.com> 2 32 -
trunk/Source/WebCore/css/StyleBuilderCustom.h
r176751 r176789 912 912 913 913 fontDescription.setFamilies(parentFontDescription.families()); 914 fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());915 914 styleResolver.setFontDescription(fontDescription); 916 915 } … … 930 929 auto& contentValue = downcast<CSSPrimitiveValue>(item.get()); 931 930 AtomicString family; 932 bool isGenericFamily = false;933 931 if (contentValue.isString()) 934 932 family = contentValue.getStringValue(); … … 941 939 case CSSValueSerif: 942 940 family = serifFamily; 943 isGenericFamily = true;944 941 break; 945 942 case CSSValueSansSerif: 946 943 family = sansSerifFamily; 947 isGenericFamily = true;948 944 break; 949 945 case CSSValueCursive: 950 946 family = cursiveFamily; 951 isGenericFamily = true;952 947 break; 953 948 case CSSValueFantasy: 954 949 family = fantasyFamily; 955 isGenericFamily = true;956 950 break; 957 951 case CSSValueMonospace: 958 952 family = monospaceFamily; 959 isGenericFamily = true;960 953 break; 961 954 case CSSValueWebkitPictograph: 962 955 family = pictographFamily; 963 isGenericFamily = true;964 956 break; 965 957 default: … … 967 959 } 968 960 } 969 970 961 if (family.isEmpty()) 971 962 continue; 972 if (families.isEmpty())973 fontDescription.setIsSpecifiedFont(!isGenericFamily);974 963 families.uncheckedAppend(family); 975 964 } -
trunk/Source/WebCore/platform/graphics/FontDescription.cpp
r175043 r176789 30 30 #include "config.h" 31 31 #include "FontDescription.h" 32 33 #include <wtf/HashSet.h> 34 #include <wtf/NeverDestroyed.h> 35 #include <wtf/text/AtomicStringHash.h> 32 36 33 37 namespace WebCore { … … 102 106 } 103 107 108 static const HashSet<AtomicString>& genericFamiliesSet() 109 { 110 static NeverDestroyed<HashSet<AtomicString>> set; 111 if (set.get().isEmpty()) { 112 set.get().add(cursiveFamily); 113 set.get().add(fantasyFamily); 114 set.get().add(monospaceFamily); 115 set.get().add(pictographFamily); 116 set.get().add(sansSerifFamily); 117 set.get().add(serifFamily); 118 set.get().add(standardFamily); 119 } 120 return set.get(); 121 } 122 123 bool FontDescription::hasGenericFirstFamily() const 124 { 125 auto& family = firstFamily(); 126 if (family.isNull()) 127 return false; 128 return genericFamiliesSet().contains(family); 129 } 130 104 131 #if ENABLE(IOS_TEXT_AUTOSIZING) 105 132 bool FontDescription::familiesEqualForTextAutoSizing(const FontDescription& other) const -
trunk/Source/WebCore/platform/graphics/FontDescription.h
r176751 r176789 94 94 , m_fontSmoothing(AutoSmoothing) 95 95 , m_textRendering(AutoTextRendering) 96 , m_isSpecifiedFont(false)97 96 , m_script(USCRIPT_COMMON) 98 97 { … … 128 127 TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); } 129 128 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } 129 bool hasGenericFirstFamily() const; 130 130 131 131 FontTraitsMask traitsMask() const; 132 bool isSpecifiedFont() const { return m_isSpecifiedFont; }133 132 FontOrientation orientation() const { return static_cast<FontOrientation>(m_orientation); } 134 133 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<NonCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } … … 157 156 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; } 158 157 void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; } 159 void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; }160 158 void setOrientation(FontOrientation orientation) { m_orientation = orientation; } 161 159 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = orientation; } … … 210 208 unsigned m_fontSmoothing : 2; // FontSmoothingMode 211 209 unsigned m_textRendering : 2; // TextRenderingMode 212 unsigned m_isSpecifiedFont : 1; // True if a web page specifies a non-generic font family as the first font family.213 210 unsigned m_script : 7; // Used to help choose an appropriate font for generic font families. 214 211 }; … … 232 229 && m_fontSmoothing == other.m_fontSmoothing 233 230 && m_textRendering == other.m_textRendering 234 && m_isSpecifiedFont == other.m_isSpecifiedFont235 231 && m_orientation == other.m_orientation 236 232 && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation -
trunk/Source/WebCore/rendering/RenderText.cpp
r176473 r176789 214 214 { 215 215 const RenderStyle& style = this->style(); 216 const FontDescription& fontDescription = style.font().fontDescription();217 216 if (style.font().useBackslashAsYenSymbol()) 218 217 return true; 219 if ( fontDescription.isSpecifiedFont())218 if (!document().decoder() || document().decoder()->encoding().backslashAsCurrencySymbol() == '\\') 220 219 return false; 221 const TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0; 222 if (encoding && encoding->backslashAsCurrencySymbol() != '\\') 223 return true; 224 return false; 220 return style.font().fontDescription().hasGenericFirstFamily() || style.font().primaryFontDataIsSystemFont(); 225 221 } 226 222
Note:
See TracChangeset
for help on using the changeset viewer.