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

Unified Diff: Source/core/css/StylePropertySerializer.cpp

Issue 1219643002: Remove "isImplicit" checks on fonts. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/StylePropertySerializer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/StylePropertySerializer.cpp
diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp
index 93a7993b43e942240943cc36b69a8a15a7273bdd..9e68e609c48ccba72814a3820b38d1edf3e04bdb 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -478,13 +478,14 @@ String StylePropertySerializer::borderSpacingValue(const StylePropertyShorthand&
return horizontalValueCSSText + ' ' + verticalValueCSSText;
}
-void StylePropertySerializer::appendFontLonghandValueIfExplicit(CSSPropertyID propertyID, StringBuilder& result, String& commonValue) const
+void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID propertyID, StringBuilder& result, String& commonValue) const
{
int foundPropertyIndex = m_propertySet.findPropertyIndex(propertyID);
if (foundPropertyIndex == -1)
- return; // All longhands must have at least implicit values if "font" is specified.
+ return;
- if (m_propertySet.propertyAt(foundPropertyIndex).isImplicit()) {
+ const CSSValue* val = m_propertySet.propertyAt(foundPropertyIndex).value();
+ if (val->isPrimitiveValue() && toCSSPrimitiveValue(val)->getValueID() == CSSValueNormal) {
commonValue = String();
return;
}
@@ -523,19 +524,17 @@ String StylePropertySerializer::fontValue() const
PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontSizePropertyIndex);
PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fontFamilyPropertyIndex);
- if (fontSizeProperty.isImplicit() || fontFamilyProperty.isImplicit())
- return emptyString();
String commonValue = fontSizeProperty.value()->cssText();
StringBuilder result;
- appendFontLonghandValueIfExplicit(CSSPropertyFontStyle, result, commonValue);
- appendFontLonghandValueIfExplicit(CSSPropertyFontVariant, result, commonValue);
- appendFontLonghandValueIfExplicit(CSSPropertyFontWeight, result, commonValue);
- appendFontLonghandValueIfExplicit(CSSPropertyFontStretch, result, commonValue);
+ appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result, commonValue);
+ appendFontLonghandValueIfNotNormal(CSSPropertyFontVariant, result, commonValue);
+ appendFontLonghandValueIfNotNormal(CSSPropertyFontWeight, result, commonValue);
+ appendFontLonghandValueIfNotNormal(CSSPropertyFontStretch, result, commonValue);
if (!result.isEmpty())
result.append(' ');
result.append(fontSizeProperty.value()->cssText());
- appendFontLonghandValueIfExplicit(CSSPropertyLineHeight, result, commonValue);
+ appendFontLonghandValueIfNotNormal(CSSPropertyLineHeight, result, commonValue);
if (!result.isEmpty())
result.append(' ');
result.append(fontFamilyProperty.value()->cssText());
« no previous file with comments | « Source/core/css/StylePropertySerializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698