Bug 1329381 - (Part 1) Computed value of background-repeat should be a list, each item consisting of: two keywords, one per dimension. r?heycam draft
authorKuoE0 <kuoe0.tw@gmail.com>
Mon, 09 Jan 2017 15:17:38 +0800
changeset 458401 a4fb152eb0b0a556a9f8bf4421aec5bbaa1fbf50
parent 457446 d192a99be4b436f2dc839435319f7630d5d8f4b0
child 458402 d41196b0e0d4f448f174f5326138efdb44a37413
push id40944
push userbmo:kuoe0@mozilla.com
push dateTue, 10 Jan 2017 07:55:56 +0000
reviewersheycam
bugs1329381
milestone53.0a1
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
layout/style/nsComputedDOMStyle.cpp
--- 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)