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

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

Issue 1982903002: Fix 'border' serialization to fail in cssText when it is invalid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 8192c4d02194a8ba8d6b19a852c3a5f3b84ae6b5..d04a3026d7c39a09a847650f02a0101ac516ba64 100644
--- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
+++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
@@ -278,7 +278,7 @@ String StylePropertySerializer::asText() const
// FIXME: Deal with cases where only some of border-(top|right|bottom|left) are specified.
if (!shorthandPropertyAppeared.test(CSSPropertyBorder - firstCSSProperty)) {
- value = borderPropertyValue(ReturnNullOnUncommonValues);
+ value = borderPropertyValue();
if (value.isNull())
shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
else
@@ -435,7 +435,7 @@ String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const
case CSSPropertyBackground:
return getLayeredShorthandValue(backgroundShorthand());
case CSSPropertyBorder:
- return borderPropertyValue(OmitUncommonValues);
+ return borderPropertyValue();
case CSSPropertyBorderTop:
return getShorthandValue(borderTopShorthand());
case CSSPropertyBorderRight:
@@ -893,19 +893,15 @@ String StylePropertySerializer::getCommonValue(const StylePropertyShorthand& sho
return res;
}
-String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) const
+String StylePropertySerializer::borderPropertyValue() const
{
const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() };
String commonValue;
StringBuilder result;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
String value = getCommonValue(properties[i]);
- if (value.isNull()) {
- if (valueMode == ReturnNullOnUncommonValues)
- return String();
- ASSERT(valueMode == OmitUncommonValues);
- continue;
- }
+ if (value.isNull())
+ return String();
if (!i)
commonValue = value;
else if (!commonValue.isNull() && commonValue != value)

Powered by Google App Engine
This is Rietveld 408576698