Bug 1326407 Part 7 - Rename BoxShapeInfo to RoundedBoxShapeInfo. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 16 Feb 2017 10:51:48 +0800
changeset 343241 8a514a5851a4435f772ac5030f1ef4ed7303aa90
parent 343240 0058687f781389dad42c0e01f4117859e8496202
child 343242 16c77acfaa6e2054a1188c71e07cc656ed494c5e
push id31372
push usercbook@mozilla.com
push dateThu, 16 Feb 2017 12:16:10 +0000
treeherdermozilla-central@2737f66ad6ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1326407
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1326407 Part 7 - Rename BoxShapeInfo to RoundedBoxShapeInfo. r=dbaron The radii has been cached in the BoxShapeInfo in the previous part. Hence the rename. This class will be used to implement inset() in the next part, so the rect stored isn't necessarily the rect of the <shape-box>. It could be the inset rectangle. Therefore I rename mShapeBoxRect to mRect to avoid any confusion. MozReview-Commit-ID: J0hpQDsbMyN
layout/generic/nsFloatManager.cpp
layout/generic/nsFloatManager.h
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -524,52 +524,52 @@ nsFloatManager::ClearContinues(StyleClea
           (aBreakType == StyleClear::Both ||
            aBreakType == StyleClear::Left)) ||
          ((mPushedRightFloatPastBreak || mSplitRightFloatAcrossBreak) &&
           (aBreakType == StyleClear::Both ||
            aBreakType == StyleClear::Right));
 }
 
 /////////////////////////////////////////////////////////////////////////////
-// BoxShapeInfo
+// RoundedBoxShapeInfo
 
 nscoord
-nsFloatManager::BoxShapeInfo::LineLeft(WritingMode aWM,
-                                       const nscoord aBStart,
-                                       const nscoord aBEnd) const
+nsFloatManager::RoundedBoxShapeInfo::LineLeft(WritingMode aWM,
+                                              const nscoord aBStart,
+                                              const nscoord aBEnd) const
 {
   if (!mRadii) {
-    return mShapeBoxRect.x;
+    return mRect.x;
   }
 
   nscoord lineLeftDiff =
     ComputeEllipseLineInterceptDiff(
-      mShapeBoxRect.y, mShapeBoxRect.YMost(),
+      mRect.y, mRect.YMost(),
       mRadii[eCornerTopLeftX], mRadii[eCornerTopLeftY],
       mRadii[eCornerBottomLeftX], mRadii[eCornerBottomLeftY],
       aBStart, aBEnd);
-  return mShapeBoxRect.x + lineLeftDiff;
+  return mRect.x + lineLeftDiff;
 }
 
 nscoord
-nsFloatManager::BoxShapeInfo::LineRight(WritingMode aWM,
-                                        const nscoord aBStart,
-                                        const nscoord aBEnd) const
+nsFloatManager::RoundedBoxShapeInfo::LineRight(WritingMode aWM,
+                                               const nscoord aBStart,
+                                               const nscoord aBEnd) const
 {
   if (!mRadii) {
-    return mShapeBoxRect.XMost();
+    return mRect.XMost();
   }
 
   nscoord lineRightDiff =
     ComputeEllipseLineInterceptDiff(
-      mShapeBoxRect.y, mShapeBoxRect.YMost(),
+      mRect.y, mRect.YMost(),
       mRadii[eCornerTopRightX], mRadii[eCornerTopRightY],
       mRadii[eCornerBottomRightX], mRadii[eCornerBottomRightY],
       aBStart, aBEnd);
-  return mShapeBoxRect.XMost() - lineRightDiff;
+  return mRect.XMost() - lineRightDiff;
 }
 
 /////////////////////////////////////////////////////////////////////////////
 // EllipseShapeInfo
 nscoord
 nsFloatManager::EllipseShapeInfo::LineLeft(WritingMode aWM,
                                            const nscoord aBStart,
                                            const nscoord aBEnd) const
@@ -801,22 +801,23 @@ nsFloatManager::ShapeInfo::CreateShapeBo
   const nsSize& aContainerSize)
 {
   nsRect logicalShapeBoxRect
     = ConvertToFloatLogical(aShapeBoxRect, aWM, aContainerSize);
 
   nscoord physicalRadii[8];
   bool hasRadii = aFrame->GetShapeBoxBorderRadii(physicalRadii);
   if (!hasRadii) {
-    return MakeUnique<BoxShapeInfo>(logicalShapeBoxRect,
-                                    UniquePtr<nscoord[]>());
+    return MakeUnique<RoundedBoxShapeInfo>(logicalShapeBoxRect,
+                                           UniquePtr<nscoord[]>());
   }
 
-  return MakeUnique<BoxShapeInfo>(logicalShapeBoxRect,
-                                  ConvertToFloatLogical(physicalRadii, aWM));
+  return MakeUnique<RoundedBoxShapeInfo>(logicalShapeBoxRect,
+                                         ConvertToFloatLogical(physicalRadii,
+                                                               aWM));
 }
 
 /* static */ UniquePtr<nsFloatManager::ShapeInfo>
 nsFloatManager::ShapeInfo::CreateCircleOrEllipse(
   StyleBasicShape* const aBasicShape,
   const LogicalRect& aShapeBoxRect,
   WritingMode aWM,
   const nsSize& aContainerSize)
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -416,45 +416,44 @@ private:
     // Convert the half corner radii (nscoord[8]) to the special logical
     // coordinate space used in float manager.
     static mozilla::UniquePtr<nscoord[]> ConvertToFloatLogical(
       const nscoord aRadii[8],
       mozilla::WritingMode aWM);
   };
 
   // Implements shape-outside: <shape-box>.
-  class BoxShapeInfo final : public ShapeInfo
+  class RoundedBoxShapeInfo final : public ShapeInfo
   {
   public:
-    BoxShapeInfo(const nsRect& aShapeBoxRect,
-                 mozilla::UniquePtr<nscoord[]> aRadii)
-      : mShapeBoxRect(aShapeBoxRect)
+    RoundedBoxShapeInfo(const nsRect& aRect,
+                        mozilla::UniquePtr<nscoord[]> aRadii)
+      : mRect(aRect)
       , mRadii(Move(aRadii))
     {}
 
     nscoord LineLeft(mozilla::WritingMode aWM,
                      const nscoord aBStart,
                      const nscoord aBEnd) const override;
     nscoord LineRight(mozilla::WritingMode aWM,
                       const nscoord aBStart,
                       const nscoord aBEnd) const override;
-    nscoord BStart() const override { return mShapeBoxRect.y; }
-    nscoord BEnd() const override { return mShapeBoxRect.YMost(); }
-    bool IsEmpty() const override { return mShapeBoxRect.IsEmpty(); };
+    nscoord BStart() const override { return mRect.y; }
+    nscoord BEnd() const override { return mRect.YMost(); }
+    bool IsEmpty() const override { return mRect.IsEmpty(); };
 
     void Translate(nscoord aLineLeft, nscoord aBlockStart) override
     {
-      mShapeBoxRect.MoveBy(aLineLeft, aBlockStart);
+      mRect.MoveBy(aLineLeft, aBlockStart);
     }
 
   private:
-    // This is the reference box of css shape-outside if specified, which
-    // implements the <shape-box> value in the CSS Shapes Module Level 1.
-    // The coordinate space is the same as FloatInfo::mRect.
-    nsRect mShapeBoxRect;
+    // The rect of the rounded box shape in the float manager's coordinate
+    // space.
+    nsRect mRect;
     // The half corner radii of the reference box. It's an nscoord[8] array
     // in the float manager's coordinate space. If there are no radii, it's
     // nullptr.
     mozilla::UniquePtr<nscoord[]> mRadii;
   };
 
   // Implements shape-outside: circle() and shape-outside: ellipse().
   class EllipseShapeInfo : public ShapeInfo