Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
index 32b708eab9773898e24dda5fe736101fe95306dc..131afc09f6493d1a5111475578723fec27354e26 100644 |
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
@@ -1994,19 +1994,17 @@ void CanvasRenderingContext2D::setFont(const String& newFont) |
newStyle->font().update(newStyle->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 = canvas()->styleResolver(); |
- styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getPropertyCSSValue(CSSPropertyFontFamily).get(), newStyle.get()); |
- styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontStyle, parsedStyle->getPropertyCSSValue(CSSPropertyFontStyle).get()); |
- styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontVariant, parsedStyle->getPropertyCSSValue(CSSPropertyFontVariant).get()); |
- styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontWeight, parsedStyle->getPropertyCSSValue(CSSPropertyFontWeight).get()); |
- |
- // 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(); |
- styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontSize, parsedStyle->getPropertyCSSValue(CSSPropertyFontSize).get()); |
- styleResolver->updateFont(); |
- styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyle->getPropertyCSSValue(CSSPropertyLineHeight).get()); |
+ styleResolver->applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties), newStyle.get()); |
modifiableState().m_font = newStyle->font(); |
modifiableState().m_font.update(styleResolver->fontSelector()); |