Index: Source/core/css/FontLoader.cpp |
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp |
index 66a604cc7943265330562569e878b3b660780029..d1ab7b9ec3ee77c6b9c67e1b67928ccea19818a6 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. |
+ CSSPropertyValue properties[] = { |
+ CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle), |
+ CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle), |
+ CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle), |
+ CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle), |
+ CSSPropertyValue(CSSPropertyFontSize, *parsedStyle), |
+ CSSPropertyValue(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()); |
esprehn
2013/07/12 20:15:27
Can we do this now? We usually use WTF_ARRAY_SIZE.
Jeffrey Yasskin
2013/07/12 20:49:08
I see ~7 uses in WebKit, although codesearch seems
Jeffrey Yasskin
2013/07/12 21:10:13
Switched to WTF_ARRAY_LENGTH.
|
font = style->font(); |
font.update(styleResolver->fontSelector()); |