Backed out changeset a035c2b6ae72 (bug 1325940)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 13 Mar 2017 11:38:36 +0100
changeset 497521 a266292784906fc4d18640b7e653d606b4825147
parent 497520 a035c2b6ae72b394debf576a29a97a1274232597
child 497522 9c7d9aa4c2f368d2bedca0c91cc9b9d384005a14
push id48933
push userbmo:james@hoppipolla.co.uk
push dateMon, 13 Mar 2017 13:53:04 +0000
bugs1325940
milestone55.0a1
backs outa035c2b6ae72b394debf576a29a97a1274232597
Backed out changeset a035c2b6ae72 (bug 1325940)
layout/painting/nsCSSRendering.cpp
layout/painting/nsCSSRendering.h
layout/style/nsCSSDataBlock.cpp
layout/style/nsCSSParser.cpp
layout/style/nsCSSProps.cpp
layout/style/nsRuleNode.cpp
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -4317,17 +4317,17 @@ DrawBorderImage(nsPresContext*       aPr
   // default sizing algorithm) to renderer as the viewport size.
   Maybe<nsSize> svgViewportSize = intrinsicSize.CanComputeConcreteSize() ?
     Nothing() : Some(imageSize);
   bool hasIntrinsicRatio = intrinsicSize.HasRatio();
   renderer.PurgeCacheForViewportChange(svgViewportSize, hasIntrinsicRatio);
 
   for (int i = LEFT; i <= RIGHT; i++) {
     for (int j = TOP; j <= BOTTOM; j++) {
-      StyleBorderImageRepeat fillStyleH, fillStyleV;
+      uint8_t fillStyleH, fillStyleV;
       nsSize unitSize;
 
       if (i == MIDDLE && j == MIDDLE) {
         // Discard the middle portion unless set to fill.
         if (NS_STYLE_BORDER_IMAGE_SLICE_NOFILL ==
             aStyleBorder.mBorderImageFill) {
           continue;
         }
@@ -4373,36 +4373,36 @@ DrawBorderImage(nsPresContext*       aPr
         if (0 < borderHeight[j] && 0 < sliceHeight[j])
           factor = gfxFloat(borderHeight[j])/sliceHeight[j];
         else
           factor = 1;
 
         unitSize.width = sliceWidth[i]*factor;
         unitSize.height = borderHeight[j];
         fillStyleH = aStyleBorder.mBorderImageRepeatH;
-        fillStyleV = StyleBorderImageRepeat::Stretch;
+        fillStyleV = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
 
       } else if (j == MIDDLE) { // left, right
         gfxFloat factor;
         if (0 < borderWidth[i] && 0 < sliceWidth[i])
           factor = gfxFloat(borderWidth[i])/sliceWidth[i];
         else
           factor = 1;
 
         unitSize.width = borderWidth[i];
         unitSize.height = sliceHeight[j]*factor;
-        fillStyleH = StyleBorderImageRepeat::Stretch;
+        fillStyleH = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
         fillStyleV = aStyleBorder.mBorderImageRepeatV;
 
       } else {
         // Corners are always stretched to fit the corner.
         unitSize.width = borderWidth[i];
         unitSize.height = borderHeight[j];
-        fillStyleH = StyleBorderImageRepeat::Stretch;
-        fillStyleV = StyleBorderImageRepeat::Stretch;
+        fillStyleH = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
+        fillStyleV = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
       }
 
       nsRect destArea(borderX[i], borderY[j], borderWidth[i], borderHeight[j]);
       nsRect subArea(sliceX[i], sliceY[j], sliceWidth[i], sliceHeight[j]);
       if (subArea.IsEmpty())
         continue;
 
       nsIntRect intSubArea = subArea.ToOutsidePixels(nsPresContext::AppUnitsPerCSSPixel());
@@ -5965,71 +5965,71 @@ nsImageRenderer::DrawLayer(nsPresContext
  * Compute the size and position of the master copy of the image. I.e., a single
  * tile used to fill the dest rect.
  * aFill The destination rect to be filled
  * aHFill and aVFill are the repeat patterns for the component -
  * NS_STYLE_BORDER_IMAGE_REPEAT_* - i.e., how a tiling unit is used to fill aFill
  * aUnitSize The size of the source rect in dest coords.
  */
 static nsRect
-ComputeTile(nsRect&                 aFill,
-            StyleBorderImageRepeat  aHFill,
-            StyleBorderImageRepeat  aVFill,
-            const nsSize&           aUnitSize,
-            nsSize&                 aRepeatSize)
+ComputeTile(nsRect&              aFill,
+            uint8_t              aHFill,
+            uint8_t              aVFill,
+            const nsSize&        aUnitSize,
+            nsSize&              aRepeatSize)
 {
   nsRect tile;
   switch (aHFill) {
-  case StyleBorderImageRepeat::Stretch:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH:
     tile.x = aFill.x;
     tile.width = aFill.width;
     aRepeatSize.width = tile.width;
     break;
-  case StyleBorderImageRepeat::Repeat:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT:
     tile.x = aFill.x + aFill.width/2 - aUnitSize.width/2;
     tile.width = aUnitSize.width;
     aRepeatSize.width = tile.width;
     break;
-  case StyleBorderImageRepeat::Round:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
     tile.x = aFill.x;
     tile.width = ComputeRoundedSize(aUnitSize.width, aFill.width);
     aRepeatSize.width = tile.width;
     break;
-  case StyleBorderImageRepeat::Space:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
     {
       nscoord space;
       aRepeatSize.width =
         ComputeBorderSpacedRepeatSize(aUnitSize.width, aFill.width, space);
       tile.x = aFill.x + space;
       tile.width = aUnitSize.width;
       aFill.x = tile.x;
       aFill.width = aFill.width - space * 2;
     }
     break;
   default:
     NS_NOTREACHED("unrecognized border-image fill style");
   }
 
   switch (aVFill) {
-  case StyleBorderImageRepeat::Stretch:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH:
     tile.y = aFill.y;
     tile.height = aFill.height;
     aRepeatSize.height = tile.height;
     break;
-  case StyleBorderImageRepeat::Repeat:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT:
     tile.y = aFill.y + aFill.height/2 - aUnitSize.height/2;
     tile.height = aUnitSize.height;
     aRepeatSize.height = tile.height;
     break;
-  case StyleBorderImageRepeat::Round:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
     tile.y = aFill.y;
     tile.height = ComputeRoundedSize(aUnitSize.height, aFill.height);
     aRepeatSize.height = tile.height;
     break;
-  case StyleBorderImageRepeat::Space:
+  case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
     {
       nscoord space;
       aRepeatSize.height =
         ComputeBorderSpacedRepeatSize(aUnitSize.height, aFill.height, space);
       tile.y = aFill.y + space;
       tile.height = aUnitSize.height;
       aFill.y = tile.y;
       aFill.height = aFill.height - space * 2;
@@ -6043,41 +6043,41 @@ ComputeTile(nsRect&                 aFil
 }
 
 /**
  * Returns true if the given set of arguments will require the tiles which fill
  * the dest rect to be scaled from the source tile. See comment on ComputeTile
  * for argument descriptions.
  */
 static bool
-RequiresScaling(const nsRect&           aFill,
-                StyleBorderImageRepeat  aHFill,
-                StyleBorderImageRepeat  aVFill,
-                const nsSize&           aUnitSize)
+RequiresScaling(const nsRect&        aFill,
+                uint8_t              aHFill,
+                uint8_t              aVFill,
+                const nsSize&        aUnitSize)
 {
   // If we have no tiling in either direction, we can skip the intermediate
   // scaling step.
-  return (aHFill != StyleBorderImageRepeat::Stretch ||
-          aVFill != StyleBorderImageRepeat::Stretch) &&
+  return (aHFill != NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH ||
+          aVFill != NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH) &&
          (aUnitSize.width != aFill.width ||
           aUnitSize.height != aFill.height);
 }
 
 DrawResult
-nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
-                                          nsRenderingContext& aRenderingContext,
-                                          const nsRect& aDirtyRect,
-                                          const nsRect& aFill,
-                                          const CSSIntRect& aSrc,
-                                          StyleBorderImageRepeat aHFill,
-                                          StyleBorderImageRepeat aVFill,
-                                          const nsSize& aUnitSize,
-                                          uint8_t aIndex,
+nsImageRenderer::DrawBorderImageComponent(nsPresContext*       aPresContext,
+                                          nsRenderingContext&  aRenderingContext,
+                                          const nsRect&        aDirtyRect,
+                                          const nsRect&        aFill,
+                                          const CSSIntRect&    aSrc,
+                                          uint8_t              aHFill,
+                                          uint8_t              aVFill,
+                                          const nsSize&        aUnitSize,
+                                          uint8_t              aIndex,
                                           const Maybe<nsSize>& aSVGViewportSize,
-                                          const bool aHasIntrinsicRatio)
+                                          const bool           aHasIntrinsicRatio)
 {
   if (!IsReady()) {
     NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
     return DrawResult::BAD_ARGS;
   }
   if (aFill.IsEmpty() || aSrc.IsEmpty()) {
     return DrawResult::SUCCESS;
   }
--- a/layout/painting/nsCSSRendering.h
+++ b/layout/painting/nsCSSRendering.h
@@ -237,27 +237,27 @@ public:
    * aSVGViewportSize The image size evaluated by default sizing algorithm.
    * Pass Nothing() if we can read a valid viewport size or aspect-ratio from
    * the drawing image directly, otherwise, pass Some() with viewport size
    * evaluated from default sizing algorithm.
    * aHasIntrinsicRatio is used to record if the source image has fixed
    * intrinsic ratio.
    */
   DrawResult
-  DrawBorderImageComponent(nsPresContext*                   aPresContext,
-                           nsRenderingContext&              aRenderingContext,
-                           const nsRect&                    aDirtyRect,
-                           const nsRect&                    aFill,
-                           const mozilla::CSSIntRect&       aSrc,
-                           mozilla::StyleBorderImageRepeat  aHFill,
-                           mozilla::StyleBorderImageRepeat  aVFill,
-                           const nsSize&                    aUnitSize,
-                           uint8_t                          aIndex,
-                           const mozilla::Maybe<nsSize>&    aSVGViewportSize,
-                           const bool                       aHasIntrinsicRatio);
+  DrawBorderImageComponent(nsPresContext*       aPresContext,
+                           nsRenderingContext&  aRenderingContext,
+                           const nsRect&        aDirtyRect,
+                           const nsRect&        aFill,
+                           const mozilla::CSSIntRect& aSrc,
+                           uint8_t              aHFill,
+                           uint8_t              aVFill,
+                           const nsSize&        aUnitSize,
+                           uint8_t              aIndex,
+                           const mozilla::Maybe<nsSize>& aSVGViewportSize,
+                           const bool           aHasIntrinsicRatio);
 
   bool IsRasterImage();
   bool IsAnimatedImage();
 
   /// Retrieves the image associated with this nsImageRenderer, if there is one.
   already_AddRefed<imgIContainer> GetImage();
 
   bool IsReady() const { return mPrepareResult == DrawResult::SUCCESS; }
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -450,17 +450,18 @@ nsCSSCompressedDataBlock::HasDefaultBord
   return outset.AllSidesEqualTo(nsCSSValue(0.0f, eCSSUnit_Number));
 }
 
 bool
 nsCSSCompressedDataBlock::HasDefaultBorderImageRepeat() const
 {
   const nsCSSValuePair &repeat =
     ValueFor(eCSSProperty_border_image_repeat)->GetPairValue();
-  return repeat.BothValuesEqualTo(nsCSSValue(StyleBorderImageRepeat::Stretch));
+  return repeat.BothValuesEqualTo(
+    nsCSSValue(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, eCSSUnit_Enumerated));
 }
 
 /*****************************************************************************/
 
 nsCSSExpandedDataBlock::nsCSSExpandedDataBlock()
 {
   AssertInitialState();
 }
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -13141,17 +13141,18 @@ CSSParserImpl::SetBorderImageInitialValu
   nsCSSValue outset;
   nsCSSRect& outsetBox = outset.SetRectValue();
   outsetBox.SetAllSidesTo(nsCSSValue(0.0f, eCSSUnit_Number));
   AppendValue(eCSSProperty_border_image_outset, outset);
 
   // border-image-repeat: repeat
   nsCSSValue repeat;
   nsCSSValuePair repeatPair;
-  repeatPair.SetBothValuesTo(nsCSSValue(StyleBorderImageRepeat::Stretch));
+  repeatPair.SetBothValuesTo(nsCSSValue(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH,
+                                        eCSSUnit_Enumerated));
   repeat.SetPairValue(&repeatPair);
   AppendValue(eCSSProperty_border_image_repeat, repeat);
 }
 
 bool
 CSSParserImpl::ParseBorderImageSlice(bool aAcceptsInherit,
                                      bool* aConsumedTokens)
 {
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1000,20 +1000,20 @@ const KTableEntry nsCSSProps::kBlendMode
 
 const KTableEntry nsCSSProps::kBorderCollapseKTable[] = {
   { eCSSKeyword_collapse,  NS_STYLE_BORDER_COLLAPSE },
   { eCSSKeyword_separate,  NS_STYLE_BORDER_SEPARATE },
   { eCSSKeyword_UNKNOWN,   -1 }
 };
 
 const KTableEntry nsCSSProps::kBorderImageRepeatKTable[] = {
-  { eCSSKeyword_stretch, StyleBorderImageRepeat::Stretch },
-  { eCSSKeyword_repeat, StyleBorderImageRepeat::Repeat },
-  { eCSSKeyword_round, StyleBorderImageRepeat::Round },
-  { eCSSKeyword_space, StyleBorderImageRepeat::Space },
+  { eCSSKeyword_stretch, NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH },
+  { eCSSKeyword_repeat, NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT },
+  { eCSSKeyword_round, NS_STYLE_BORDER_IMAGE_REPEAT_ROUND },
+  { eCSSKeyword_space, NS_STYLE_BORDER_IMAGE_REPEAT_SPACE },
   { eCSSKeyword_UNKNOWN, -1 }
 };
 
 const KTableEntry nsCSSProps::kBorderImageSliceKTable[] = {
   { eCSSKeyword_fill, NS_STYLE_BORDER_IMAGE_SLICE_FILL },
   { eCSSKeyword_UNKNOWN, -1 }
 };
 
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1451,17 +1451,16 @@ struct SetEnumValueHelper
   DEFINE_ENUM_CLASS_SETTER(StyleHyphens, None, Auto)
   DEFINE_ENUM_CLASS_SETTER(StyleTextJustify, None, InterCharacter)
   DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu)
   DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText)
   DEFINE_ENUM_CLASS_SETTER(StyleUserInput, None, Auto)
   DEFINE_ENUM_CLASS_SETTER(StyleUserModify, ReadOnly, WriteOnly)
   DEFINE_ENUM_CLASS_SETTER(StyleWindowDragging, Default, NoDrag)
   DEFINE_ENUM_CLASS_SETTER(StyleOrient, Inline, Vertical)
-  DEFINE_ENUM_CLASS_SETTER(StyleBorderImageRepeat, Stretch, Space)
 #ifdef MOZ_XUL
   DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None, MozPopup)
 #else
   DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None, InlineBox)
 #endif
 
 #undef DEF_SET_ENUMERATED_VALUE
 };
@@ -7879,24 +7878,24 @@ nsRuleNode::ComputeBorderData(void* aSta
   SetBorderImagePair(*aRuleData->ValueForBorderImageRepeat(),
                      borderImageRepeat);
 
   SetValue(borderImageRepeat.mXValue,
            border->mBorderImageRepeatH,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
            parentBorder->mBorderImageRepeatH,
-           StyleBorderImageRepeat::Stretch);
+           NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH);
 
   SetValue(borderImageRepeat.mYValue,
            border->mBorderImageRepeatV,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
            parentBorder->mBorderImageRepeatV,
-           StyleBorderImageRepeat::Stretch);
+           NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH);
 
   COMPUTE_END_RESET(Border, border)
 }
 
 const void*
 nsRuleNode::ComputePaddingData(void* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -384,23 +384,21 @@ enum class FillMode : uint8_t;
 #define NS_STYLE_BORDER_STYLE_DASHED            4
 #define NS_STYLE_BORDER_STYLE_SOLID             5
 #define NS_STYLE_BORDER_STYLE_DOUBLE            6
 #define NS_STYLE_BORDER_STYLE_INSET             7
 #define NS_STYLE_BORDER_STYLE_OUTSET            8
 #define NS_STYLE_BORDER_STYLE_HIDDEN            9
 #define NS_STYLE_BORDER_STYLE_AUTO              10 // for outline-style only
 
-// border-image-repeat
-enum class StyleBorderImageRepeat : uint8_t {
-  Stretch,
-  Repeat,
-  Round,
-  Space
-};
+// See nsStyleBorder mBorderImage
+#define NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH    0
+#define NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT     1
+#define NS_STYLE_BORDER_IMAGE_REPEAT_ROUND      2
+#define NS_STYLE_BORDER_IMAGE_REPEAT_SPACE      3
 
 #define NS_STYLE_BORDER_IMAGE_SLICE_NOFILL      0
 #define NS_STYLE_BORDER_IMAGE_SLICE_FILL        1
 
 // See nsStyleContent
 #define NS_STYLE_CONTENT_OPEN_QUOTE             0
 #define NS_STYLE_CONTENT_CLOSE_QUOTE            1
 #define NS_STYLE_CONTENT_NO_OPEN_QUOTE          2
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -297,18 +297,18 @@ nsStylePadding::CalcDifference(const nsS
   // reflow of the frame's children (see how
   // ReflowInput::InitResizeFlags initializes the inline-resize flag).
   return NS_STYLE_HINT_REFLOW & ~nsChangeHint_ClearDescendantIntrinsics;
 }
 
 nsStyleBorder::nsStyleBorder(const nsPresContext* aContext)
   : mBorderColors(nullptr)
   , mBorderImageFill(NS_STYLE_BORDER_IMAGE_SLICE_NOFILL)
-  , mBorderImageRepeatH(StyleBorderImageRepeat::Stretch)
-  , mBorderImageRepeatV(StyleBorderImageRepeat::Stretch)
+  , mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
+  , mBorderImageRepeatV(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
   , mFloatEdge(StyleFloatEdge::ContentBox)
   , mBoxDecorationBreak(StyleBoxDecorationBreak::Slice)
   , mComputedBorder(0, 0, 0, 0)
 {
   MOZ_COUNT_CTOR(nsStyleBorder);
 
   NS_FOR_CSS_HALF_CORNERS (corner) {
     mBorderRadius.Set(corner, nsStyleCoord(0, nsStyleCoord::CoordConstructor));
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1332,18 +1332,18 @@ public:
   nsBorderColors** mBorderColors;     // [reset] composite (stripe) colors
   nsStyleCorners mBorderRadius;       // [reset] coord, percent
   nsStyleImage   mBorderImageSource;  // [reset]
   nsStyleSides   mBorderImageSlice;   // [reset] factor, percent
   nsStyleSides   mBorderImageWidth;   // [reset] length, factor, percent, auto
   nsStyleSides   mBorderImageOutset;  // [reset] length, factor
 
   uint8_t        mBorderImageFill;    // [reset]
-  mozilla::StyleBorderImageRepeat mBorderImageRepeatH; // [reset]
-  mozilla::StyleBorderImageRepeat mBorderImageRepeatV; // [reset]
+  uint8_t        mBorderImageRepeatH; // [reset] see nsStyleConsts.h
+  uint8_t        mBorderImageRepeatV; // [reset]
   mozilla::StyleFloatEdge mFloatEdge; // [reset]
   mozilla::StyleBoxDecorationBreak mBoxDecorationBreak; // [reset]
 
 protected:
   uint8_t       mBorderStyle[4];  // [reset] See nsStyleConsts.h
 
 public:
   // [reset] the colors to use for a simple border.