Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
index 659bad1f26b125e4af7d3383a492b0c5fe8b4c27..b79ccc12297312223128af6950b264ef9eff0063 100644 |
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
@@ -1990,19 +1990,17 @@ void CanvasRenderingContext2D::setFont(const String& newFont) |
newStyle->font().update(newStyle->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 = 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, arraysize(properties), newStyle.get()); |
modifiableState().m_font = newStyle->font(); |
modifiableState().m_font.update(styleResolver->fontSelector()); |