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

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: You people refactor too quickly. (Sync ;) 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
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());

Powered by Google App Engine
This is Rietveld 408576698