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

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

Issue 1519643002: Serialize font shorthand as empty string if any longhand is not specified (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « third_party/WebKit/LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
diff --git a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
index 4f3f20dcfe88d55a6ffaf83c2d95349e4a952024..a38e5386ed09d7dbed9854bdc1d21a685cc008c2 100644
--- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
+++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
@@ -509,8 +509,7 @@ String StylePropertySerializer::borderSpacingValue(const StylePropertyShorthand&
void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID propertyID, StringBuilder& result, String& commonValue) const
{
int foundPropertyIndex = m_propertySet.findPropertyIndex(propertyID);
- if (foundPropertyIndex == -1)
- return;
+ ASSERT(foundPropertyIndex != -1);
const CSSValue* val = m_propertySet.propertyAt(foundPropertyIndex).value();
if (val->isPrimitiveValue() && toCSSPrimitiveValue(val)->getValueID() == CSSValueNormal) {
@@ -545,10 +544,12 @@ void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID p
String StylePropertySerializer::fontValue() const
{
+ if (!isPropertyShorthandAvailable(fontShorthand()) && !shorthandHasOnlyInitialOrInheritedValue(fontShorthand()))
+ return emptyString();
+
int fontSizePropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontSize);
int fontFamilyPropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontFamily);
- if (fontSizePropertyIndex == -1 || fontFamilyPropertyIndex == -1)
- return emptyString();
+ ASSERT(fontSizePropertyIndex != -1 && fontFamilyPropertyIndex != -1);
PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontSizePropertyIndex);
PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fontFamilyPropertyIndex);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698