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

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: 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 | « no previous file | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »
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..585da7ce8074f4ca24e6152dfb4b09bde042bab7 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.
+ CSSPropertyValue properties[] = {
+ CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle),
+ CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle),
+ CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle),
+ CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle),
+ CSSPropertyValue(CSSPropertyFontSize, *parsedStyle),
+ CSSPropertyValue(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, WTF_ARRAY_LENGTH(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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698