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

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

Issue 303993003: Handle initial values in background-repeat introduced by the background shorthand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review changes Created 6 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
« no previous file with comments | « LayoutTests/fast/css/background-repeat-serialize.html ('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 9716395a6de383d2197d84f1c7ca9884348c3afd..4c8a63ff5b42ad15f0a8a33acff123fb990f6757 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -702,20 +702,24 @@ String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) c
return result.isEmpty() ? String() : result.toString();
}
-static void buildSingleBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXValue, const CSSValue& repeatYValue)
+static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue)
{
- CSSValueID repeatXValueId = toCSSPrimitiveValue(repeatXValue).getValueID();
- CSSValueID repeatYValueId = toCSSPrimitiveValue(repeatYValue).getValueID();
+ // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS.
rune 2014/05/31 22:36:01 Shouldn't this be fixed instead? This seems to be
alancutter (OOO until 2018) 2014/06/01 03:57:37 That was my initial approach but the change was ge
rune 2014/06/02 06:54:50 I cannot access the issue for this CL in bugs.chro
+ DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, initialRepeatValue, CSSPrimitiveValue::create(CSSValueRepeat));
+ const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? *initialRepeatValue : toCSSPrimitiveValue(repeatXCSSValue);
+ const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? *initialRepeatValue : toCSSPrimitiveValue(repeatYCSSValue);
+ CSSValueID repeatXValueId = repeatX.getValueID();
+ CSSValueID repeatYValueId = repeatY.getValueID();
if (repeatXValueId == repeatYValueId) {
- builder.append(repeatXValue.cssText());
+ builder.append(repeatX.cssText());
} else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueRepeat) {
builder.append("repeat-y");
} else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoRepeat) {
builder.append("repeat-x");
} else {
- builder.append(repeatXValue.cssText());
+ builder.append(repeatX.cssText());
builder.append(" ");
- builder.append(repeatYValue.cssText());
+ builder.append(repeatY.cssText());
}
}
@@ -757,7 +761,7 @@ String StylePropertySerializer::backgroundRepeatPropertyValue() const
for (size_t i = 0; i < shorthandLength; ++i) {
if (i)
builder.append(", ");
- buildSingleBackgroundRepeatValue(builder,
+ appendBackgroundRepeatValue(builder,
*repeatXList->item(i % repeatXList->length()),
*repeatYList->item(i % repeatYList->length()));
}
« no previous file with comments | « LayoutTests/fast/css/background-repeat-serialize.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698