Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 5216392399814656: Clear StyleResolverState after each resolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated after levi's revert Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698