Bug 1329381 - (Part 1) Computed value of background-repeat should be a list, each item consisting of: two keywords, one per dimension. r?heycam
MozReview-Commit-ID: J8jB1VJIBe
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -2245,50 +2245,31 @@ nsComputedDOMStyle::DoGetImageLayerPosit
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetImageLayerRepeat(const nsStyleImageLayers& aLayers)
{
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
for (uint32_t i = 0, i_end = aLayers.mRepeatCount; i < i_end; ++i) {
RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);
RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
+ RefPtr<nsROCSSPrimitiveValue> valY = new nsROCSSPrimitiveValue;
const uint8_t& xRepeat = aLayers.mLayers[i].mRepeat.mXRepeat;
const uint8_t& yRepeat = aLayers.mLayers[i].mRepeat.mYRepeat;
- bool hasContraction = true;
- unsigned contraction;
- if (xRepeat == yRepeat) {
- contraction = xRepeat;
- } else if (xRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT &&
- yRepeat == NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT) {
- contraction = NS_STYLE_IMAGELAYER_REPEAT_REPEAT_X;
- } else if (xRepeat == NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT &&
- yRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT) {
- contraction = NS_STYLE_IMAGELAYER_REPEAT_REPEAT_Y;
- } else {
- hasContraction = false;
- }
-
- RefPtr<nsROCSSPrimitiveValue> valY;
- if (hasContraction) {
- valX->SetIdent(nsCSSProps::ValueToKeywordEnum(contraction,
- nsCSSProps::kImageLayerRepeatKTable));
- } else {
- valY = new nsROCSSPrimitiveValue;
-
- valX->SetIdent(nsCSSProps::ValueToKeywordEnum(xRepeat,
+ // dimension x
+ valX->SetIdent(nsCSSProps::ValueToKeywordEnum(xRepeat,
nsCSSProps::kImageLayerRepeatKTable));
- valY->SetIdent(nsCSSProps::ValueToKeywordEnum(yRepeat,
+ itemList->AppendCSSValue(valX.forget());
+
+ // dimension y
+ valY->SetIdent(nsCSSProps::ValueToKeywordEnum(yRepeat,
nsCSSProps::kImageLayerRepeatKTable));
- }
- itemList->AppendCSSValue(valX.forget());
- if (valY) {
- itemList->AppendCSSValue(valY.forget());
- }
+ itemList->AppendCSSValue(valY.forget());
+
valueList->AppendCSSValue(itemList.forget());
}
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetImageLayerSize(const nsStyleImageLayers& aLayers)