Bug 1289049 Part 1 - Use shape source instead of clip path in naming. draft
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 19 Sep 2017 16:59:38 +0800
changeset 667506 7f524ba25d035b5c3e0252467f1eee2601dd0bc9
parent 667303 a0eb21bf55e1c1ae0ba311e6f2273da05c712799
child 667507 721ad98c70d8c29a31717088ec2cd11184a3f683
push id80736
push userbmo:tlin@mozilla.com
push dateWed, 20 Sep 2017 06:30:49 +0000
bugs1289049
milestone57.0a1
Bug 1289049 Part 1 - Use shape source instead of clip path in naming. This function can be used to implement animation for <basic-shape> for shape-outside, so I remove the clip path in naming to make it more general. MozReview-Commit-ID: LwVe0Dk5Web
layout/style/StyleAnimationValue.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -4147,23 +4147,23 @@ ExtractImageLayerSizePairList(const nsSt
         break;
     }
   }
 
   aComputedValue.SetAndAdoptCSSValuePairListValue(result.forget());
 }
 
 static bool
-StyleClipBasicShapeToCSSArray(const StyleShapeSource& aClipPath,
-                              nsCSSValue::Array* aResult)
+StyleShapeSourceToCSSArray(const StyleShapeSource& aShapeSource,
+                           nsCSSValue::Array* aResult)
 {
   MOZ_ASSERT(aResult->Count() == 2,
              "Expected array to be presized for a function and the sizing-box");
 
-  const StyleBasicShape* shape = aClipPath.GetBasicShape();
+  const StyleBasicShape* shape = aShapeSource.GetBasicShape();
   nsCSSKeyword functionName = shape->GetShapeTypeName();
   RefPtr<nsCSSValue::Array> functionArray;
   switch (shape->GetShapeType()) {
     case StyleBasicShapeType::Circle:
     case StyleBasicShapeType::Ellipse: {
       const nsTArray<nsStyleCoord>& coords = shape->Coordinates();
       MOZ_ASSERT(coords.Length() == ShapeArgumentCount(functionName) - 1,
                  "Unexpected radii count");
@@ -4231,17 +4231,17 @@ StyleClipBasicShapeToCSSArray(const Styl
       functionArray->Item(functionArray->Count() - 1).
                        SetArrayValue(radiusArray, eCSSUnit_Array);
       break;
     }
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown shape type");
       return false;
   }
-  aResult->Item(1).SetEnumValue(aClipPath.GetReferenceBox());
+  aResult->Item(1).SetEnumValue(aShapeSource.GetReferenceBox());
   return true;
 }
 
 static void
 SetFallbackValue(nsCSSValuePair* aPair, const nsStyleSVGPaint& aPaint)
 {
   if (aPaint.GetFallbackType() == eStyleSVGFallbackType_Color) {
     aPair->mYValue.SetColorValue(aPaint.GetFallbackColor());
@@ -4555,17 +4555,17 @@ StyleAnimationValue::ExtractComputedValu
           if (type == StyleShapeSourceType::URL) {
             auto result = MakeUnique<nsCSSValue>();
             result->SetURLValue(clipPath.GetURL());
             aComputedValue.SetAndAdoptCSSValueValue(result.release(), eUnit_URL);
           } else if (type == StyleShapeSourceType::Box) {
             aComputedValue.SetEnumValue(clipPath.GetReferenceBox());
           } else if (type == StyleShapeSourceType::Shape) {
             RefPtr<nsCSSValue::Array> result = nsCSSValue::Array::Create(2);
-            if (!StyleClipBasicShapeToCSSArray(clipPath, result)) {
+            if (!StyleShapeSourceToCSSArray(clipPath, result)) {
               return false;
             }
             aComputedValue.SetCSSValueArrayValue(result, eUnit_Shape);
 
           } else {
             MOZ_ASSERT(type == StyleShapeSourceType::None, "unknown type");
             aComputedValue.SetNoneValue();
           }