Chromium Code Reviews| Index: Source/core/css/StylePropertySerializer.cpp |
| diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp |
| index 93a7993b43e942240943cc36b69a8a15a7273bdd..cc597c678ff33e2cc18f16f515439be4d0a5c8bb 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()) { |
| + if (m_propertySet.propertyAt(foundPropertyIndex).value()->isPrimitiveValue() |
|
Timothy Loh
2015/06/30 08:11:42
Maybe store the value as a temporary instead of ha
meade_UTC10
2015/06/30 08:26:47
Done.
|
| + && toCSSPrimitiveValue(m_propertySet.propertyAt(foundPropertyIndex).value())->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()); |