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

Unified Diff: Source/core/css/FontLoader.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
« no previous file with comments | « no previous file | Source/core/css/resolver/StyleResolver.h » ('j') | Source/core/css/resolver/StyleResolver.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/FontLoader.cpp
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp
index 66a604cc7943265330562569e878b3b660780029..46bb2f8cfa170f641410832b90e59e46c6403e54 100644
--- a/Source/core/css/FontLoader.cpp
+++ b/Source/core/css/FontLoader.cpp
@@ -312,11 +312,6 @@ bool FontLoader::checkFont(const String& fontString, const String&)
return true;
}
-static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropertyID id, const RefPtr<StylePropertySet>& parsedStyle)
-{
- styleResolver->applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSValue(id).get());
-}
-
bool FontLoader::resolveFontStyle(const String& fontString, Font& font)
{
// Interpret fontString in the same way as the 'font' attribute of CanvasRenderingContext2D.
@@ -344,19 +339,16 @@ bool FontLoader::resolveFontStyle(const String& fontString, Font& font)
style->font().update(style->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 = m_document->styleResolver();
- styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getPropertyCSSValue(CSSPropertyFontFamily).get(), style.get());
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontStyle, parsedStyle);
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontVariant, parsedStyle);
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontWeight, parsedStyle);
-
- // 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();
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle);
- styleResolver->updateFont();
- applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyle);
+ styleResolver->applyPropertiesToStyle(properties, arraysize(properties), style.get());
font = style->font();
font.update(styleResolver->fontSelector());
« no previous file with comments | « no previous file | Source/core/css/resolver/StyleResolver.h » ('j') | Source/core/css/resolver/StyleResolver.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698