| 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..f25116730676fef17d965206f30e888bf2761f66 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.
|
| + 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());
|
|
|