Bug 1295895 - Correctly capitalize StyleFillRule; r?heycam draft
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 17 Aug 2016 12:13:26 +0530
changeset 401590 9a6b189d98d087c3c93ac3d3c6967732ddb79b03
parent 401500 fe895421dfbe1f1f8f1fc6a39bb20774423a6d74
child 528526 6ce2e27a0e5e96a07be8656c491fd0d305f7c35b
push id26503
push userbmo:manishearth@gmail.com
push dateWed, 17 Aug 2016 06:41:17 +0000
reviewersheycam
bugs1295895
milestone51.0a1
Bug 1295895 - Correctly capitalize StyleFillRule; r?heycam MozReview-Commit-ID: ZfHrllA9QV
dom/svg/nsSVGPathGeometryElement.cpp
layout/style/nsCSSProps.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsRuleNode.cpp
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/svg/nsCSSClipPathInstance.cpp
layout/svg/nsSVGUtils.h
--- a/dom/svg/nsSVGPathGeometryElement.cpp
+++ b/dom/svg/nsSVGPathGeometryElement.cpp
@@ -105,27 +105,27 @@ already_AddRefed<Path>
 nsSVGPathGeometryElement::GetOrBuildPathForMeasuring()
 {
   return nullptr;
 }
 
 FillRule
 nsSVGPathGeometryElement::GetFillRule()
 {
-  FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::NonZero
+  FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
 
   RefPtr<nsStyleContext> styleContext =
     nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
                                                          nullptr);
   
   if (styleContext) {
-    MOZ_ASSERT(styleContext->StyleSVG()->mFillRule == StyleFillRule::NonZero ||
-               styleContext->StyleSVG()->mFillRule == StyleFillRule::EvenOdd);
+    MOZ_ASSERT(styleContext->StyleSVG()->mFillRule == StyleFillRule::Nonzero ||
+               styleContext->StyleSVG()->mFillRule == StyleFillRule::Evenodd);
 
-    if (styleContext->StyleSVG()->mFillRule == StyleFillRule::EvenOdd) {
+    if (styleContext->StyleSVG()->mFillRule == StyleFillRule::Evenodd) {
       fillRule = FillRule::FILL_EVEN_ODD;
     }
   } else {
     // ReportToConsole
     NS_WARNING("Couldn't get style context for content in GetFillRule");
   }
 
   return fillRule;
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -2286,18 +2286,18 @@ const KTableEntry nsCSSProps::kDominantB
   { eCSSKeyword_central, NS_STYLE_DOMINANT_BASELINE_CENTRAL },
   { eCSSKeyword_middle, NS_STYLE_DOMINANT_BASELINE_MIDDLE },
   { eCSSKeyword_text_after_edge, NS_STYLE_DOMINANT_BASELINE_TEXT_AFTER_EDGE },
   { eCSSKeyword_text_before_edge, NS_STYLE_DOMINANT_BASELINE_TEXT_BEFORE_EDGE },
   { eCSSKeyword_UNKNOWN, -1 }
 };
 
 const KTableEntry nsCSSProps::kFillRuleKTable[] = {
-  { eCSSKeyword_nonzero, StyleFillRule::NonZero },
-  { eCSSKeyword_evenodd, StyleFillRule::EvenOdd },
+  { eCSSKeyword_nonzero, StyleFillRule::Nonzero },
+  { eCSSKeyword_evenodd, StyleFillRule::Evenodd },
   { eCSSKeyword_UNKNOWN, -1 }
 };
 
 const KTableEntry nsCSSProps::kClipPathGeometryBoxKTable[] = {
   { eCSSKeyword_content_box, StyleClipPathGeometryBox::Content },
   { eCSSKeyword_padding_box, StyleClipPathGeometryBox::Padding },
   { eCSSKeyword_border_box, StyleClipPathGeometryBox::Border },
   { eCSSKeyword_margin_box, StyleClipPathGeometryBox::Margin },
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -5925,17 +5925,17 @@ nsComputedDOMStyle::CreatePrimitiveValue
   nsAutoString shapeFunctionString;
   AppendASCIItoUTF16(nsCSSKeywords::GetStringValue(
                        aStyleBasicShape->GetShapeTypeName()),
                      shapeFunctionString);
   shapeFunctionString.Append('(');
   switch (type) {
     case StyleBasicShapeType::Polygon: {
       bool hasEvenOdd = aStyleBasicShape->GetFillRule() ==
-        StyleFillRule::EvenOdd;
+        StyleFillRule::Evenodd;
       if (hasEvenOdd) {
         shapeFunctionString.AppendLiteral("evenodd");
       }
       for (size_t i = 0;
            i < aStyleBasicShape->Coordinates().Length(); i += 2) {
         nsAutoString coordString;
         if (i > 0 || hasEvenOdd) {
           shapeFunctionString.AppendLiteral(", ");
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1310,17 +1310,17 @@ struct SetEnumValueHelper
     auto value = aValue.GetIntValue(); \
     MOZ_ASSERT(value >= static_cast<decltype(value)>(type_::min_) && \
                value <= static_cast<decltype(value)>(type_::max_), \
                "inappropriate value"); \
     aField = static_cast<type_>(value); \
   }
 
   DEFINE_ENUM_CLASS_SETTER(StyleBoxSizing, Content, Border)
-  DEFINE_ENUM_CLASS_SETTER(StyleFillRule, NonZero, EvenOdd)
+  DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
   DEFINE_ENUM_CLASS_SETTER(StyleFloat, None_, InlineEnd)
   DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
   DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None_, SelectMenu)
   DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None_, MozText)
 
 #undef DEF_SET_ENUMERATED_VALUE
 };
 
@@ -9367,17 +9367,17 @@ nsRuleNode::ComputeSVGData(void* aStartS
 {
   COMPUTE_START_INHERITED(SVG, svg, parentSVG)
 
   // clip-rule: enum, inherit, initial
   SetValue(*aRuleData->ValueForClipRule(),
            svg->mClipRule, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
            parentSVG->mClipRule,
-           StyleFillRule::NonZero);
+           StyleFillRule::Nonzero);
 
   // color-interpolation: enum, inherit, initial
   SetValue(*aRuleData->ValueForColorInterpolation(),
            svg->mColorInterpolation, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
            parentSVG->mColorInterpolation,
            NS_STYLE_COLOR_INTERPOLATION_SRGB);
 
@@ -9401,17 +9401,17 @@ nsRuleNode::ComputeSVGData(void* aStartS
                 parentSVG->mFillOpacity, parentSVG->FillOpacitySource());
   svg->SetFillOpacitySource(contextFillOpacity);
 
   // fill-rule: enum, inherit, initial
   SetValue(*aRuleData->ValueForFillRule(),
            svg->mFillRule, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
            parentSVG->mFillRule,
-           StyleFillRule::NonZero);
+           StyleFillRule::Nonzero);
 
   // marker-end: url, none, inherit
   const nsCSSValue* markerEndValue = aRuleData->ValueForMarkerEnd();
   if (eCSSUnit_URL == markerEndValue->GetUnit()) {
     svg->mMarkerEnd.SetValue(markerEndValue);
   } else if (eCSSUnit_None == markerEndValue->GetUnit() ||
              eCSSUnit_Initial == markerEndValue->GetUnit()) {
     svg->mMarkerEnd.SetNull();
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -82,18 +82,18 @@ enum class StyleClipPathGeometryBox : ui
   Margin,
   Fill,
   Stroke,
   View,
 };
 
 // fill-rule
 enum class StyleFillRule : uint8_t {
-  NonZero,
-  EvenOdd,
+  Nonzero,
+  Evenodd,
 };
 
 // float
 // https://developer.mozilla.org/en-US/docs/Web/CSS/float
 enum class StyleFloat : uint8_t {
   None_,
   Left,
   Right,
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -952,20 +952,20 @@ nsStyleColumn::CalcDifference(const nsSt
 nsStyleSVG::nsStyleSVG(StyleStructContext aContext)
   : mFill(eStyleSVGPaintType_Color) // Will be initialized to NS_RGB(0, 0, 0)
   , mStroke(eStyleSVGPaintType_None)
   , mStrokeDashoffset(0, nsStyleCoord::CoordConstructor)
   , mStrokeWidth(nsPresContext::CSSPixelsToAppUnits(1), nsStyleCoord::CoordConstructor)
   , mFillOpacity(1.0f)
   , mStrokeMiterlimit(4.0f)
   , mStrokeOpacity(1.0f)
-  , mClipRule(StyleFillRule::NonZero)
+  , mClipRule(StyleFillRule::Nonzero)
   , mColorInterpolation(NS_STYLE_COLOR_INTERPOLATION_SRGB)
   , mColorInterpolationFilters(NS_STYLE_COLOR_INTERPOLATION_LINEARRGB)
-  , mFillRule(StyleFillRule::NonZero)
+  , mFillRule(StyleFillRule::Nonzero)
   , mPaintOrder(NS_STYLE_PAINT_ORDER_NORMAL)
   , mShapeRendering(NS_STYLE_SHAPE_RENDERING_AUTO)
   , mStrokeLinecap(NS_STYLE_STROKE_LINECAP_BUTT)
   , mStrokeLinejoin(NS_STYLE_STROKE_LINEJOIN_MITER)
   , mTextAnchor(NS_STYLE_TEXT_ANCHOR_START)
   , mContextFlags((eStyleSVGOpacitySource_Normal << FILL_OPACITY_SOURCE_SHIFT) |
                   (eStyleSVGOpacitySource_Normal << STROKE_OPACITY_SOURCE_SHIFT))
 {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2523,17 +2523,17 @@ private:
   float mIterationCount; // mozilla::PositiveInfinity<float>() means infinite
 };
 
 class StyleBasicShape final
 {
 public:
   explicit StyleBasicShape(StyleBasicShapeType type)
     : mType(type),
-      mFillRule(StyleFillRule::NonZero)
+      mFillRule(StyleFillRule::Nonzero)
   {
     mPosition.SetInitialPercentValues(0.5f);
   }
 
   StyleBasicShapeType GetShapeType() const { return mType; }
   nsCSSKeyword GetShapeTypeName() const;
 
   StyleFillRule GetFillRule() const { return mFillRule; }
--- a/layout/svg/nsCSSClipPathInstance.cpp
+++ b/layout/svg/nsCSSClipPathInstance.cpp
@@ -217,17 +217,17 @@ already_AddRefed<Path>
 nsCSSClipPathInstance::CreateClipPathPolygon(DrawTarget* aDrawTarget,
                                              const nsRect& aRefBox)
 {
   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() == StyleFillRule::NonZero ?
+  FillRule fillRule = basicShape->GetFillRule() == StyleFillRule::Nonzero ?
                         FillRule::FILL_WINDING : FillRule::FILL_EVEN_ODD;
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder(fillRule);
 
   nscoord x = nsRuleNode::ComputeCoordPercentCalc(coords[0], aRefBox.width);
   nscoord y = nsRuleNode::ComputeCoordPercentCalc(coords[1], aRefBox.height);
   nscoord appUnitsPerDevPixel =
     mTargetFrame->PresContext()->AppUnitsPerDevPixel();
   builder->MoveTo(Point(aRefBox.x + x, aRefBox.y + y) / appUnitsPerDevPixel);
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -534,17 +534,17 @@ public:
    * This function returns a set of bit flags indicating which parts of the
    * element (fill, stroke, bounds) should intercept pointer events. It takes
    * into account the type of element and the value of the 'pointer-events'
    * property on the element.
    */
   static uint16_t GetGeometryHitTestFlags(nsIFrame* aFrame);
 
   static FillRule ToFillRule(mozilla::StyleFillRule aFillRule) {
-    return aFillRule == mozilla::StyleFillRule::EvenOdd ?
+    return aFillRule == mozilla::StyleFillRule::Evenodd ?
              FillRule::FILL_EVEN_ODD : FillRule::FILL_WINDING;
   }
 
   static AntialiasMode ToAntialiasMode(uint8_t aTextRendering) {
     return aTextRendering == NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED ?
              AntialiasMode::NONE : AntialiasMode::SUBPIXEL;
   }