Bug 1092351 - Mark most of nsCSSBorderRenderer as private to make it easier to reason about and refactor. r=dholbert
authorJonathan Watt <jwatt@jwatt.org>
Mon, 03 Nov 2014 10:03:14 +0000
changeset 240090 95bf06069a31a3bb5a8e5c2461ae0b2bb1d04875
parent 240089 5377fb12be727a697f8c713f4d16e93c749054f8
child 240091 8d56722cff6c3f38ddeece4356e4c115630fc955
push id660
push userraliiev@mozilla.com
push dateWed, 18 Feb 2015 20:30:48 +0000
treeherdermozilla-release@49e493494178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1092351
milestone36.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 1092351 - Mark most of nsCSSBorderRenderer as private to make it easier to reason about and refactor. r=dholbert
layout/base/nsCSSRenderingBorders.h
--- a/layout/base/nsCSSRenderingBorders.h
+++ b/layout/base/nsCSSRenderingBorders.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NS_CSS_RENDERING_BORDERS_H
 #define NS_CSS_RENDERING_BORDERS_H
 
 #include "gfxRect.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/PathHelpers.h"
 #include "mozilla/RefPtr.h"
 #include "nsColor.h"
 #include "nsCOMPtr.h"
 #include "nsStyleConsts.h"
 
 class gfxContext;
@@ -70,33 +71,54 @@ class GradientStops;
 
 typedef enum {
   BorderColorStyleNone,
   BorderColorStyleSolid,
   BorderColorStyleLight,
   BorderColorStyleDark
 } BorderColorStyle;
 
-struct nsCSSBorderRenderer {
+class nsCSSBorderRenderer MOZ_FINAL
+{
   typedef mozilla::gfx::ColorPattern ColorPattern;
   typedef mozilla::gfx::DrawTarget DrawTarget;
   typedef mozilla::gfx::Float Float;
   typedef mozilla::gfx::Path Path;
   typedef mozilla::gfx::Rect Rect;
   typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
 
+public:
+
   nsCSSBorderRenderer(gfxContext* aDestContext,
                       Rect& aOuterRect,
                       const uint8_t* aBorderStyles,
                       const Float* aBorderWidths,
                       RectCornerRadii& aBorderRadii,
                       const nscolor* aBorderColors,
                       nsBorderColors* const* aCompositeColors,
                       nscolor aBackgroundColor);
 
+  // draw the entire border
+  void DrawBorders();
+
+  // utility function used for background painting as well as borders
+  static void ComputeInnerRadii(const RectCornerRadii& aRadii,
+                                const Float* aBorderSizes,
+                                RectCornerRadii* aInnerRadiiRet);
+
+  // Given aRadii as the border radii for a rectangle, compute the
+  // appropriate radii for another rectangle *outside* that rectangle
+  // by increasing the radii, except keeping sharp corners sharp.
+  // Used for spread box-shadows
+  static void ComputeOuterRadii(const RectCornerRadii& aRadii,
+                                const Float* aBorderSizes,
+                                RectCornerRadii* aOuterRadiiRet);
+
+private:
+
   RectCornerRadii mBorderCornerDimensions;
 
   // destination context
   DrawTarget* mDrawTarget;
   gfxContext* mContext;
 
   // the rectangle of the outside and the inside of the border
   Rect mOuterRect;
@@ -203,32 +225,16 @@ struct nsCSSBorderRenderer {
 
   // Draw any border which is solid on all sides and does not use
   // CompositeColors.
   void DrawNoCompositeColorSolidBorder();
 
   // Draw a solid border that has no border radius (i.e. is rectangular) and
   // uses CompositeColors.
   void DrawRectangularCompositeColors();
-
-  // draw the entire border
-  void DrawBorders ();
-
-  // utility function used for background painting as well as borders
-  static void ComputeInnerRadii(const RectCornerRadii& aRadii,
-                                const Float* aBorderSizes,
-                                RectCornerRadii* aInnerRadiiRet);
-
-  // Given aRadii as the border radii for a rectangle, compute the
-  // appropriate radii for another rectangle *outside* that rectangle
-  // by increasing the radii, except keeping sharp corners sharp.
-  // Used for spread box-shadows
-  static void ComputeOuterRadii(const RectCornerRadii& aRadii,
-                                const Float* aBorderSizes,
-                                RectCornerRadii* aOuterRadiiRet);
 };
 
 namespace mozilla {
 #ifdef DEBUG_NEW_BORDERS
 #include <stdarg.h>
 
 static inline void PrintAsString(const mozilla::gfx::Point& p) {
   fprintf (stderr, "[%f,%f]", p.x, p.y);