Index: Source/core/css/FontLoader.cpp |
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp |
index 66a604cc7943265330562569e878b3b660780029..46bb2f8cfa170f641410832b90e59e46c6403e54 100644 |
--- a/Source/core/css/FontLoader.cpp |
+++ b/Source/core/css/FontLoader.cpp |
@@ -312,11 +312,6 @@ bool FontLoader::checkFont(const String& fontString, const String&) |
return true; |
} |
-static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropertyID id, const RefPtr<StylePropertySet>& parsedStyle) |
-{ |
- styleResolver->applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSValue(id).get()); |
-} |
- |
bool FontLoader::resolveFontStyle(const String& fontString, Font& font) |
{ |
// Interpret fontString in the same way as the 'font' attribute of CanvasRenderingContext2D. |
@@ -344,19 +339,16 @@ bool FontLoader::resolveFontStyle(const String& fontString, Font& font) |
style->font().update(style->font().fontSelector()); |
// Now map the font property longhands into the style. |
+ StyleResolver::PropertyValue properties[] = { |
+ StyleResolver::PropertyValue(CSSPropertyFontFamily, *parsedStyle), |
+ StyleResolver::PropertyValue(CSSPropertyFontStyle, *parsedStyle), |
+ StyleResolver::PropertyValue(CSSPropertyFontVariant, *parsedStyle), |
+ StyleResolver::PropertyValue(CSSPropertyFontWeight, *parsedStyle), |
+ StyleResolver::PropertyValue(CSSPropertyFontSize, *parsedStyle), |
+ StyleResolver::PropertyValue(CSSPropertyLineHeight, *parsedStyle), |
+ }; |
StyleResolver* styleResolver = m_document->styleResolver(); |
- styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getPropertyCSSValue(CSSPropertyFontFamily).get(), style.get()); |
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontStyle, parsedStyle); |
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontVariant, parsedStyle); |
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontWeight, parsedStyle); |
- |
- // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call, |
- // which assumes the fontMetrics are available for the affected font, otherwise a crash occurs (see http://trac.webkit.org/changeset/96122). |
- // The updateFont() calls below update the fontMetrics and ensure the proper setting of font-size and line-height. |
- styleResolver->updateFont(); |
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle); |
- styleResolver->updateFont(); |
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyle); |
+ styleResolver->applyPropertiesToStyle(properties, arraysize(properties), style.get()); |
font = style->font(); |
font.update(styleResolver->fontSelector()); |