Bug 1265342 Part 5d: Move EllipseShapeInfo class definition ahead of RoundedBoxShapeInfo so it can be referenced by rounded boxes. r=dholbert
authorBrad Werth <bwerth@mozilla.com>
Tue, 17 Apr 2018 11:59:11 -0700
changeset 469095 64161554cd20cac22690c5e05962bcb06132896b
parent 469094 29c3c172caa00b1db0d3ba28ec5200f85ca4cddc
child 469096 8d8361873abe44ec51e097db1f463bb179e75684
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1265342
milestone61.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 1265342 Part 5d: Move EllipseShapeInfo class definition ahead of RoundedBoxShapeInfo so it can be referenced by rounded boxes. r=dholbert MozReview-Commit-ID: G8qdPlnh8kY
layout/generic/nsFloatManager.cpp
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -631,87 +631,16 @@ protected:
   // on increasing y values. This function uses a binary search to find the
   // first interval that contains aTargetY. If no such interval exists, this
   // function returns aIntervals.Length().
   static size_t MinIntervalIndexContainingY(const nsTArray<nsRect>& aIntervals,
                                             const nscoord aTargetY);
 };
 
 /////////////////////////////////////////////////////////////////////////////
-// RoundedBoxShapeInfo
-//
-// Implements shape-outside: <shape-box> and shape-outside: inset().
-//
-class nsFloatManager::RoundedBoxShapeInfo final : public nsFloatManager::ShapeInfo
-{
-public:
-  RoundedBoxShapeInfo(const nsRect& aRect,
-                      UniquePtr<nscoord[]> aRadii)
-    : mRect(aRect)
-    , mRadii(Move(aRadii))
-  {}
-
-  nscoord LineLeft(const nscoord aBStart,
-                   const nscoord aBEnd) const override;
-  nscoord LineRight(const nscoord aBStart,
-                    const nscoord aBEnd) const override;
-  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
-  {
-    mRect.MoveBy(aLineLeft, aBlockStart);
-  }
-
-private:
-  // 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.
-  UniquePtr<nscoord[]> mRadii;
-};
-
-nscoord
-nsFloatManager::RoundedBoxShapeInfo::LineLeft(const nscoord aBStart,
-                                              const nscoord aBEnd) const
-{
-  if (!mRadii) {
-    return mRect.x;
-  }
-
-  nscoord lineLeftDiff =
-    ComputeEllipseLineInterceptDiff(
-      mRect.y, mRect.YMost(),
-      mRadii[eCornerTopLeftX], mRadii[eCornerTopLeftY],
-      mRadii[eCornerBottomLeftX], mRadii[eCornerBottomLeftY],
-      aBStart, aBEnd);
-  return mRect.x + lineLeftDiff;
-}
-
-nscoord
-nsFloatManager::RoundedBoxShapeInfo::LineRight(const nscoord aBStart,
-                                               const nscoord aBEnd) const
-{
-  if (!mRadii) {
-    return mRect.XMost();
-  }
-
-  nscoord lineRightDiff =
-    ComputeEllipseLineInterceptDiff(
-      mRect.y, mRect.YMost(),
-      mRadii[eCornerTopRightX], mRadii[eCornerTopRightY],
-      mRadii[eCornerBottomRightX], mRadii[eCornerBottomRightY],
-      aBStart, aBEnd);
-  return mRect.XMost() - lineRightDiff;
-}
-
-/////////////////////////////////////////////////////////////////////////////
 // EllipseShapeInfo
 //
 // Implements shape-outside: circle() and shape-outside: ellipse().
 //
 class nsFloatManager::EllipseShapeInfo final : public nsFloatManager::ShapeInfo
 {
 public:
   // Construct the float area using math to calculate the shape boundary.
@@ -1069,16 +998,87 @@ nsFloatManager::EllipseShapeInfo::LineLe
 nscoord
 nsFloatManager::EllipseShapeInfo::LineRight(const nscoord aBStart,
                                             const nscoord aBEnd) const
 {
   return LineEdge(aBStart, aBEnd, false);
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// RoundedBoxShapeInfo
+//
+// Implements shape-outside: <shape-box> and shape-outside: inset().
+//
+class nsFloatManager::RoundedBoxShapeInfo final : public nsFloatManager::ShapeInfo
+{
+public:
+  RoundedBoxShapeInfo(const nsRect& aRect,
+                      UniquePtr<nscoord[]> aRadii)
+    : mRect(aRect)
+    , mRadii(Move(aRadii))
+  {}
+
+  nscoord LineLeft(const nscoord aBStart,
+                   const nscoord aBEnd) const override;
+  nscoord LineRight(const nscoord aBStart,
+                    const nscoord aBEnd) const override;
+  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
+  {
+    mRect.MoveBy(aLineLeft, aBlockStart);
+  }
+
+private:
+  // 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.
+  UniquePtr<nscoord[]> mRadii;
+};
+
+nscoord
+nsFloatManager::RoundedBoxShapeInfo::LineLeft(const nscoord aBStart,
+                                              const nscoord aBEnd) const
+{
+  if (!mRadii) {
+    return mRect.x;
+  }
+
+  nscoord lineLeftDiff =
+    ComputeEllipseLineInterceptDiff(
+      mRect.y, mRect.YMost(),
+      mRadii[eCornerTopLeftX], mRadii[eCornerTopLeftY],
+      mRadii[eCornerBottomLeftX], mRadii[eCornerBottomLeftY],
+      aBStart, aBEnd);
+  return mRect.x + lineLeftDiff;
+}
+
+nscoord
+nsFloatManager::RoundedBoxShapeInfo::LineRight(const nscoord aBStart,
+                                               const nscoord aBEnd) const
+{
+  if (!mRadii) {
+    return mRect.XMost();
+  }
+
+  nscoord lineRightDiff =
+    ComputeEllipseLineInterceptDiff(
+      mRect.y, mRect.YMost(),
+      mRadii[eCornerTopRightX], mRadii[eCornerTopRightY],
+      mRadii[eCornerBottomRightX], mRadii[eCornerBottomRightY],
+      aBStart, aBEnd);
+  return mRect.XMost() - lineRightDiff;
+}
+
+/////////////////////////////////////////////////////////////////////////////
 // PolygonShapeInfo
 //
 // Implements shape-outside: polygon().
 //
 class nsFloatManager::PolygonShapeInfo final : public nsFloatManager::ShapeInfo
 {
 public:
   explicit PolygonShapeInfo(nsTArray<nsPoint>&& aVertices);