Bug 1288626 Part 3 - Rename nsStyleBasicShape to StyleBasicShape. r=heycam draft
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 27 Jul 2016 18:14:36 +0800
changeset 398402 327bc257e6eb716fcf8ebaebb231cfb46e85ce79
parent 398401 6debb710f079c5413fc07599c927c4cbb327bc5d
child 398403 4084ff063b2201b5bbfdc3395b26a9e521d32aa9
push id25517
push userbmo:tlin@mozilla.com
push dateTue, 09 Aug 2016 03:27:51 +0000
reviewersheycam
bugs1288626
milestone51.0a1
Bug 1288626 Part 3 - Rename nsStyleBasicShape to StyleBasicShape. r=heycam MozReview-Commit-ID: 9NUKpZ4s4kG
layout/style/StyleAnimationValue.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/nsRuleNode.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/svg/nsCSSClipPathInstance.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -3494,17 +3494,17 @@ ExtractImageLayerSizePairList(const nsSt
 
 static bool
 StyleClipBasicShapeToCSSArray(const nsStyleClipPath& aClipPath,
                               nsCSSValue::Array* aResult)
 {
   MOZ_ASSERT(aResult->Count() == 2,
              "Expected array to be presized for a function and the sizing-box");
 
-  const nsStyleBasicShape* shape = aClipPath.GetBasicShape();
+  const StyleBasicShape* shape = aClipPath.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");
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -5911,17 +5911,17 @@ nsComputedDOMStyle::BasicShapeRadiiToStr
     return;
   }
   aCssText.AppendLiteral(" / ");
   aCssText.Append(verticalString);
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::CreatePrimitiveValueForBasicShape(
-  const nsStyleBasicShape* aStyleBasicShape)
+  const StyleBasicShape* aStyleBasicShape)
 {
   MOZ_ASSERT(aStyleBasicShape, "Expect a valid basic shape pointer!");
 
   StyleBasicShapeType type = aStyleBasicShape->GetShapeType();
   // Shape function name and opening parenthesis.
   nsAutoString shapeFunctionString;
   AppendASCIItoUTF16(nsCSSKeywords::GetStringValue(
                        aStyleBasicShape->GetShapeTypeName()),
@@ -5991,17 +5991,17 @@ nsComputedDOMStyle::CreatePrimitiveValue
   shapeFunctionString.Append(')');
   RefPtr<nsROCSSPrimitiveValue> functionValue = new nsROCSSPrimitiveValue;
   functionValue->SetString(shapeFunctionString);
   return functionValue.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::CreatePrimitiveValueForClipPath(
-  const nsStyleBasicShape* aStyleBasicShape,
+  const StyleBasicShape* aStyleBasicShape,
   StyleClipShapeSizing aSizingBox)
 {
   RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
   if (aStyleBasicShape) {
     valueList->AppendCSSValue(
       CreatePrimitiveValueForBasicShape(aStyleBasicShape));
   }
 
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -641,22 +641,22 @@ private:
   bool GetFrameBorderRectHeight(nscoord& aHeight);
 
   /* Helper functions for computing the filter property style. */
   void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
   already_AddRefed<CSSValue> CreatePrimitiveValueForStyleFilter(
     const nsStyleFilter& aStyleFilter);
 
   already_AddRefed<CSSValue> CreatePrimitiveValueForClipPath(
-    const mozilla::nsStyleBasicShape* aStyleBasicShape,
+    const mozilla::StyleBasicShape* aStyleBasicShape,
     mozilla::StyleClipShapeSizing aSizingBox);
 
   // Helper function for computing basic shape styles.
   already_AddRefed<CSSValue> CreatePrimitiveValueForBasicShape(
-    const mozilla::nsStyleBasicShape* aStyleBasicShape);
+    const mozilla::StyleBasicShape* aStyleBasicShape);
   void BoxValuesToString(nsAString& aString,
                          const nsTArray<nsStyleCoord>& aBoxValues);
   void BasicShapeRadiiToString(nsAString& aCssText,
                                const nsStyleCorners& aCorners);
 
 
   static nsComputedStyleMap* GetComputedStyleMap();
 
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -9576,31 +9576,31 @@ nsRuleNode::ComputeSVGData(void* aStartS
            svg->mTextAnchor, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
            parentSVG->mTextAnchor,
            NS_STYLE_TEXT_ANCHOR_START);
 
   COMPUTE_END_INHERITED(SVG, svg)
 }
 
-static already_AddRefed<nsStyleBasicShape>
+static already_AddRefed<StyleBasicShape>
 GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
                                nsStyleContext* aStyleContext,
                                nsPresContext* aPresContext,
                                RuleNodeCacheConditions& aConditions)
 {
-  RefPtr<nsStyleBasicShape> basicShape;
+  RefPtr<StyleBasicShape> basicShape;
 
   nsCSSValue::Array* shapeFunction = aValue.GetArrayValue();
   nsCSSKeyword functionName =
     (nsCSSKeyword)shapeFunction->Item(0).GetIntValue();
 
   if (functionName == eCSSKeyword_polygon) {
     MOZ_ASSERT(!basicShape, "did not expect value");
-    basicShape = new nsStyleBasicShape(StyleBasicShapeType::Polygon);
+    basicShape = new StyleBasicShape(StyleBasicShapeType::Polygon);
     MOZ_ASSERT(shapeFunction->Count() > 1,
                "polygon has wrong number of arguments");
     size_t j = 1;
     if (shapeFunction->Item(j).GetUnit() == eCSSUnit_Enumerated) {
       basicShape->SetFillRule(shapeFunction->Item(j).GetIntValue());
       ++j;
     }
     const int32_t mask = SETCOORD_PERCENT | SETCOORD_LENGTH |
@@ -9625,17 +9625,17 @@ GetStyleBasicShapeFromCSSValue(const nsC
       curPair = curPair->mNext;
     }
   } else if (functionName == eCSSKeyword_circle ||
              functionName == eCSSKeyword_ellipse) {
     StyleBasicShapeType type = functionName == eCSSKeyword_circle ?
       StyleBasicShapeType::Circle :
       StyleBasicShapeType::Ellipse;
     MOZ_ASSERT(!basicShape, "did not expect value");
-    basicShape = new nsStyleBasicShape(type);
+    basicShape = new StyleBasicShape(type);
     const int32_t mask = SETCOORD_PERCENT | SETCOORD_LENGTH |
       SETCOORD_STORE_CALC | SETCOORD_ENUMERATED;
     size_t count = type == StyleBasicShapeType::Circle ? 2 : 3;
     MOZ_ASSERT(shapeFunction->Count() == count + 1,
                "unexpected arguments count");
     MOZ_ASSERT(type == StyleBasicShapeType::Circle ||
                (shapeFunction->Item(1).GetUnit() == eCSSUnit_Null) ==
                (shapeFunction->Item(2).GetUnit() == eCSSUnit_Null),
@@ -9661,17 +9661,17 @@ GetStyleBasicShapeFromCSSValue(const nsC
                            basicShape->GetPosition(),
                            aConditions);
     } else {
       MOZ_ASSERT(positionVal.GetUnit() == eCSSUnit_Null,
                  "expected no value");
     }
   } else if (functionName == eCSSKeyword_inset) {
     MOZ_ASSERT(!basicShape, "did not expect value");
-    basicShape = new nsStyleBasicShape(StyleBasicShapeType::Inset);
+    basicShape = new StyleBasicShape(StyleBasicShapeType::Inset);
     MOZ_ASSERT(shapeFunction->Count() == 6,
                "inset function has wrong number of arguments");
     MOZ_ASSERT(shapeFunction->Item(1).GetUnit() != eCSSUnit_Null,
                "no shape arguments defined");
     const int32_t mask = SETCOORD_PERCENT | SETCOORD_LENGTH |
       SETCOORD_STORE_CALC;
     nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
     for (size_t j = 1; j <= 4; ++j) {
@@ -9740,17 +9740,17 @@ SetStyleClipPathToCSSValue(nsStyleClipPa
   MOZ_ASSERT(aValue->GetUnit() == eCSSUnit_Array,
              "expected a basic shape or reference box");
 
   const nsCSSValue::Array* array = aValue->GetArrayValue();
   MOZ_ASSERT(array->Count() == 1 || array->Count() == 2,
              "Expect one or both of a shape function and geometry-box");
 
   StyleClipShapeSizing sizingBox = StyleClipShapeSizing::NoBox;
-  RefPtr<nsStyleBasicShape> basicShape;
+  RefPtr<StyleBasicShape> basicShape;
   for (size_t i = 0; i < array->Count(); ++i) {
     if (array->Item(i).GetUnit() == eCSSUnit_Enumerated) {
       int32_t type = array->Item(i).GetIntValue();
       if (type > uint8_t(StyleClipShapeSizing::View) ||
           type < uint8_t(StyleClipShapeSizing::NoBox)) {
         NS_NOTREACHED("unexpected reference box");
         return;
       }
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1081,20 +1081,20 @@ nsStyleSVG::CalcDifference(const nsStyle
        mContextFlags          != aNewData.mContextFlags) {
     return hint | nsChangeHint_RepaintFrame;
   }
 
   return hint;
 }
 
 // --------------------
-// nsStyleBasicShape
+// StyleBasicShape
 
 nsCSSKeyword
-nsStyleBasicShape::GetShapeTypeName() const
+StyleBasicShape::GetShapeTypeName() const
 {
   switch (mType) {
     case StyleBasicShapeType::Polygon:
       return eCSSKeyword_polygon;
     case StyleBasicShapeType::Circle:
       return eCSSKeyword_circle;
     case StyleBasicShapeType::Ellipse:
       return eCSSKeyword_ellipse;
@@ -1209,17 +1209,17 @@ nsStyleClipPath::SetURL(const nsCSSValue
 
   mURL = new FragmentOrURL();
   mURL->SetValue(aValue);
   mType = StyleClipPathType::URL;
   return true;
 }
 
 void
-nsStyleClipPath::SetBasicShape(nsStyleBasicShape* aBasicShape,
+nsStyleClipPath::SetBasicShape(StyleBasicShape* aBasicShape,
                                StyleClipShapeSizing aSizingBox)
 {
   NS_ASSERTION(aBasicShape, "expected pointer");
   ReleaseRef();
   mBasicShape = aBasicShape;
   mBasicShape->AddRef();
   mSizingBox = aSizingBox;
   mType = StyleClipPathType::Shape;
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3433,20 +3433,20 @@ private:
     STROKE_OPACITY_SOURCE_SHIFT = 2,
   };
 
   uint8_t          mContextFlags;     // [inherited]
 };
 
 namespace mozilla {
 
-class nsStyleBasicShape final
+class StyleBasicShape final
 {
 public:
-  explicit nsStyleBasicShape(StyleBasicShapeType type)
+  explicit StyleBasicShape(StyleBasicShapeType type)
     : mType(type),
       mFillRule(NS_STYLE_FILL_RULE_NONZERO)
   {
     mPosition.SetInitialPercentValues(0.5f);
   }
 
   StyleBasicShapeType GetShapeType() const { return mType; }
   nsCSSKeyword GetShapeTypeName() const;
@@ -3499,32 +3499,32 @@ public:
     return mCoordinates;
   }
 
   const nsTArray<nsStyleCoord>& Coordinates() const
   {
     return mCoordinates;
   }
 
-  bool operator==(const nsStyleBasicShape& aOther) const
+  bool operator==(const StyleBasicShape& aOther) const
   {
     return mType == aOther.mType &&
            mFillRule == aOther.mFillRule &&
            mCoordinates == aOther.mCoordinates &&
            mPosition == aOther.mPosition &&
            mRadius == aOther.mRadius;
   }
-  bool operator!=(const nsStyleBasicShape& aOther) const {
+  bool operator!=(const StyleBasicShape& aOther) const {
     return !(*this == aOther);
   }
 
-  NS_INLINE_DECL_REFCOUNTING(nsStyleBasicShape);
+  NS_INLINE_DECL_REFCOUNTING(StyleBasicShape);
 
 private:
-  ~nsStyleBasicShape() {}
+  ~StyleBasicShape() {}
 
   StyleBasicShapeType mType;
   int32_t mFillRule;
 
   // mCoordinates has coordinates for polygon or radii for
   // ellipse and circle.
   nsTArray<nsStyleCoord> mCoordinates;
   Position mPosition;
@@ -3549,36 +3549,36 @@ struct nsStyleClipPath
   }
 
   FragmentOrURL* GetURL() const {
     NS_ASSERTION(mType == StyleClipPathType::URL, "wrong clip-path type");
     return mURL;
   }
   bool SetURL(const nsCSSValue* aValue);
 
-  nsStyleBasicShape* GetBasicShape() const {
+  StyleBasicShape* GetBasicShape() const {
     NS_ASSERTION(mType == StyleClipPathType::Shape, "wrong clip-path type");
     return mBasicShape;
   }
 
-  void SetBasicShape(nsStyleBasicShape* mBasicShape,
+  void SetBasicShape(StyleBasicShape* mBasicShape,
                      StyleClipShapeSizing aSizingBox =
                      StyleClipShapeSizing::NoBox);
 
   StyleClipShapeSizing GetSizingBox() const { return mSizingBox; }
   void SetSizingBox(StyleClipShapeSizing aSizingBox);
 
 private:
   void ReleaseRef();
   void CopyURL(const nsStyleClipPath& aOther);
 
   void* operator new(size_t) = delete;
 
   union {
-    nsStyleBasicShape* mBasicShape;
+    StyleBasicShape* mBasicShape;
     FragmentOrURL* mURL;
   };
   StyleClipPathType    mType;
   StyleClipShapeSizing mSizingBox;
 };
 
 } // namespace mozilla
 
--- a/layout/svg/nsCSSClipPathInstance.cpp
+++ b/layout/svg/nsCSSClipPathInstance.cpp
@@ -87,17 +87,17 @@ nsCSSClipPathInstance::CreateClipPath(Dr
     RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
     return builder->Finish();
   }
 
   nscoord appUnitsPerDevPixel =
     mTargetFrame->PresContext()->AppUnitsPerDevPixel();
   r = ToAppUnits(r.ToNearestPixels(appUnitsPerDevPixel), appUnitsPerDevPixel);
 
-  nsStyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
+  StyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
   switch (basicShape->GetShapeType()) {
     case StyleBasicShapeType::Circle:
       return CreateClipPathCircle(aDrawTarget, r);
     case StyleBasicShapeType::Ellipse:
       return CreateClipPathEllipse(aDrawTarget, r);
     case StyleBasicShapeType::Polygon:
       return CreateClipPathPolygon(aDrawTarget, r);
     case StyleBasicShapeType::Inset:
@@ -129,17 +129,17 @@ EnumerationToLength(nscoord& aCoord, int
       break;
   }
 }
 
 already_AddRefed<Path>
 nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
                                             const nsRect& aRefBox)
 {
-  nsStyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
+  StyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
 
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
 
   nsPoint topLeft, anchor;
   nsSize size = nsSize(aRefBox.width, aRefBox.height);
   nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(),
                                             size, size,
                                             &topLeft, &anchor);
@@ -172,17 +172,17 @@ nsCSSClipPathInstance::CreateClipPathCir
   builder->Close();
   return builder->Finish();
 }
 
 already_AddRefed<Path>
 nsCSSClipPathInstance::CreateClipPathEllipse(DrawTarget* aDrawTarget,
                                              const nsRect& aRefBox)
 {
-  nsStyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
+  StyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
 
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
 
   nsPoint topLeft, anchor;
   nsSize size = nsSize(aRefBox.width, aRefBox.height);
   nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(),
                                             size, size,
                                             &topLeft, &anchor);
@@ -212,17 +212,17 @@ nsCSSClipPathInstance::CreateClipPathEll
   builder->Close();
   return builder->Finish();
 }
 
 already_AddRefed<Path>
 nsCSSClipPathInstance::CreateClipPathPolygon(DrawTarget* aDrawTarget,
                                              const nsRect& aRefBox)
 {
-  nsStyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
+  StyleBasicShape* basicShape = mClipPathStyle.GetBasicShape();
   const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
   MOZ_ASSERT(coords.Length() % 2 == 0 &&
              coords.Length() >= 2, "wrong number of arguments");
 
   FillRule fillRule = basicShape->GetFillRule() == NS_STYLE_FILL_RULE_NONZERO ?
                         FillRule::FILL_WINDING : FillRule::FILL_EVEN_ODD;
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder(fillRule);