Chromium Code Reviews| Index: Source/core/css/StylePropertySerializer.cpp |
| diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp |
| index cc600be7409478e8f9127891d98ece28ed323c22..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() |
| + && toCSSPrimitiveValue(m_propertySet.propertyAt(foundPropertyIndex).value())->getValueID() == CSSValueNormal) { |
|
davve
2015/06/29 08:12:47
This is not a removal but a replacement. You repla
meade_UTC10
2015/06/30 08:03:17
Done.
|
| 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()); |
| @@ -732,27 +731,22 @@ String StylePropertySerializer::getShorthandValue(const StylePropertyShorthand& |
| String commonValue; |
| StringBuilder result; |
| for (unsigned i = 0; i < shorthand.length(); ++i) { |
| - if (!m_propertySet.isPropertyImplicit(shorthand.properties()[i])) { |
|
davve
2015/06/29 08:12:47
Hm, what has this to do with fonts? From what I ca
meade_UTC10
2015/06/30 08:03:17
...unintentional semi-related change. Moved it to
|
| - const CSSValue* value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]); |
| - if (!value) |
| - return String(); |
| - String valueText = value->cssText(); |
| - if (!i) |
| - commonValue = valueText; |
| - else if (!commonValue.isNull() && commonValue != valueText) |
| - commonValue = String(); |
| - if (value->isInitialValue()) |
| - continue; |
| - if (!result.isEmpty()) |
| - result.append(separator); |
| - result.append(valueText); |
| - } else |
| + const CSSValue* value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]); |
| + if (!value) |
| + return String(); |
| + String valueText = value->cssText(); |
| + if (!i) |
| + commonValue = valueText; |
| + else if (!commonValue.isNull() && commonValue != valueText) |
| commonValue = String(); |
| + if (value->isInitialValue()) |
| + continue; |
| + if (!result.isEmpty()) |
| + result.append(separator); |
| + result.append(valueText); |
| } |
| if (isInitialOrInherit(commonValue)) |
| return commonValue; |
| - if (result.isEmpty()) |
| - return String(); |
| return result.toString(); |
| } |