Move nsCSSCornerSizes from nsCSSStruct.h/cpp to nsCSSValue.h/cpp. (Bug 645620, patch 3) r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Mon, 28 Mar 2011 16:07:26 -0700
changeset 64076 ebb436e2d8d0c6464b5157ccd3b9ff1c6c3d1d57
parent 64075 967f25420b71b9105f3b48e33f7ae042a735f6d3
child 64077 e76c7e9b17cf9da7154275648b54416b81d82a5e
push idunknown
push userunknown
push dateunknown
reviewersbzbarsky
bugs645620
milestone2.2a1pre
Move nsCSSCornerSizes from nsCSSStruct.h/cpp to nsCSSValue.h/cpp. (Bug 645620, patch 3) r=bzbarsky
layout/style/nsCSSStruct.cpp
layout/style/nsCSSStruct.h
layout/style/nsCSSValue.cpp
layout/style/nsCSSValue.h
--- a/layout/style/nsCSSStruct.cpp
+++ b/layout/style/nsCSSStruct.cpp
@@ -77,56 +77,16 @@ nsCSSText::nsCSSText(void)
   MOZ_COUNT_CTOR(nsCSSText);
 }
 
 nsCSSText::~nsCSSText(void)
 {
   MOZ_COUNT_DTOR(nsCSSText);
 }
 
-// --- nsCSSCornerSizes -----------------
-
-nsCSSCornerSizes::nsCSSCornerSizes(void)
-{
-  MOZ_COUNT_CTOR(nsCSSCornerSizes);
-}
-
-nsCSSCornerSizes::nsCSSCornerSizes(const nsCSSCornerSizes& aCopy)
-  : mTopLeft(aCopy.mTopLeft),
-    mTopRight(aCopy.mTopRight),
-    mBottomRight(aCopy.mBottomRight),
-    mBottomLeft(aCopy.mBottomLeft)
-{
-  MOZ_COUNT_CTOR(nsCSSCornerSizes);
-}
-
-nsCSSCornerSizes::~nsCSSCornerSizes()
-{
-  MOZ_COUNT_DTOR(nsCSSCornerSizes);
-}
-
-void
-nsCSSCornerSizes::Reset()
-{
-  NS_FOR_CSS_FULL_CORNERS(corner) {
-    this->GetCorner(corner).Reset();
-  }
-}
-
-PR_STATIC_ASSERT(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 && \
-    NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3);
-
-/* static */ const nsCSSCornerSizes::corner_type
-nsCSSCornerSizes::corners[4] = {
-  &nsCSSCornerSizes::mTopLeft,
-  &nsCSSCornerSizes::mTopRight,
-  &nsCSSCornerSizes::mBottomRight,
-  &nsCSSCornerSizes::mBottomLeft,
-};
-
 // --- nsCSSDisplay -----------------
 
 nsCSSDisplay::nsCSSDisplay(void)
 {
   MOZ_COUNT_CTOR(nsCSSDisplay);
 }
 
 nsCSSDisplay::~nsCSSDisplay(void)
--- a/layout/style/nsCSSStruct.h
+++ b/layout/style/nsCSSStruct.h
@@ -41,66 +41,16 @@
  * within a CSS declaration using during parsing and mutation, and
  * representation of complex values for CSS properties
  */
 
 #ifndef nsCSSStruct_h___
 #define nsCSSStruct_h___
 
 #include "nsCSSValue.h"
-#include "nsStyleConsts.h"
-
-struct nsCSSCornerSizes {
-  nsCSSCornerSizes(void);
-  nsCSSCornerSizes(const nsCSSCornerSizes& aCopy);
-  ~nsCSSCornerSizes();
-
-  // argument is a "full corner" constant from nsStyleConsts.h
-  nsCSSValue const & GetCorner(PRUint32 aCorner) const {
-    return this->*corners[aCorner];
-  }
-  nsCSSValue & GetCorner(PRUint32 aCorner) {
-    return this->*corners[aCorner];
-  }
-
-  PRBool operator==(const nsCSSCornerSizes& aOther) const {
-    NS_FOR_CSS_FULL_CORNERS(corner) {
-      if (this->GetCorner(corner) != aOther.GetCorner(corner))
-        return PR_FALSE;
-    }
-    return PR_TRUE;
-  }
-
-  PRBool operator!=(const nsCSSCornerSizes& aOther) const {
-    NS_FOR_CSS_FULL_CORNERS(corner) {
-      if (this->GetCorner(corner) != aOther.GetCorner(corner))
-        return PR_TRUE;
-    }
-    return PR_FALSE;
-  }
-
-  PRBool HasValue() const {
-    NS_FOR_CSS_FULL_CORNERS(corner) {
-      if (this->GetCorner(corner).GetUnit() != eCSSUnit_Null)
-        return PR_TRUE;
-    }
-    return PR_FALSE;
-  }
-
-  void Reset();
-
-  nsCSSValue mTopLeft;
-  nsCSSValue mTopRight;
-  nsCSSValue mBottomRight;
-  nsCSSValue mBottomLeft;
-
-protected:
-  typedef nsCSSValue nsCSSCornerSizes::*corner_type;
-  static const corner_type corners[4];
-};
 
 /****************************************************************************/
 
 struct nsCSSStruct {
   // EMPTY on purpose.  ABSTRACT with no virtuals (typedef void nsCSSStruct?)
 };
 
 // We use the nsCSS* structures for storing css::Declaration's
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -1312,8 +1312,49 @@ nsCSSValueGradient::nsCSSValueGradient(P
   : mIsRadial(aIsRadial),
     mIsRepeating(aIsRepeating),
     mBgPos(eCSSUnit_None),
     mAngle(eCSSUnit_None),
     mRadialShape(eCSSUnit_None),
     mRadialSize(eCSSUnit_None)
 {
 }
+
+// --- nsCSSCornerSizes -----------------
+
+nsCSSCornerSizes::nsCSSCornerSizes(void)
+{
+  MOZ_COUNT_CTOR(nsCSSCornerSizes);
+}
+
+nsCSSCornerSizes::nsCSSCornerSizes(const nsCSSCornerSizes& aCopy)
+  : mTopLeft(aCopy.mTopLeft),
+    mTopRight(aCopy.mTopRight),
+    mBottomRight(aCopy.mBottomRight),
+    mBottomLeft(aCopy.mBottomLeft)
+{
+  MOZ_COUNT_CTOR(nsCSSCornerSizes);
+}
+
+nsCSSCornerSizes::~nsCSSCornerSizes()
+{
+  MOZ_COUNT_DTOR(nsCSSCornerSizes);
+}
+
+void
+nsCSSCornerSizes::Reset()
+{
+  NS_FOR_CSS_FULL_CORNERS(corner) {
+    this->GetCorner(corner).Reset();
+  }
+}
+
+PR_STATIC_ASSERT(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 && \
+    NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3);
+
+/* static */ const nsCSSCornerSizes::corner_type
+nsCSSCornerSizes::corners[4] = {
+  &nsCSSCornerSizes::mTopLeft,
+  &nsCSSCornerSizes::mTopRight,
+  &nsCSSCornerSizes::mBottomRight,
+  &nsCSSCornerSizes::mBottomLeft,
+};
+
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -45,16 +45,17 @@
 #include "nsCSSKeywords.h"
 #include "nsCSSProperty.h"
 #include "nsColor.h"
 #include "nsCoord.h"
 #include "nsString.h"
 #include "nsStringBuffer.h"
 #include "nsTArray.h"
 #include "mozilla/mozalloc.h"
+#include "nsStyleConsts.h"
 
 class imgIRequest;
 class nsIDocument;
 class nsIPrincipal;
 class nsPresContext;
 class nsIURI;
 
 // Deletes a linked list iteratively to avoid blowing up the stack (bug 456196).
@@ -968,10 +969,59 @@ struct nsCSSValueGradient {
   NS_INLINE_DECL_REFCOUNTING(nsCSSValueGradient)
 
 private:
   // not to be implemented
   nsCSSValueGradient(const nsCSSValueGradient& aOther);
   nsCSSValueGradient& operator=(const nsCSSValueGradient& aOther);
 };
 
+struct nsCSSCornerSizes {
+  nsCSSCornerSizes(void);
+  nsCSSCornerSizes(const nsCSSCornerSizes& aCopy);
+  ~nsCSSCornerSizes();
+
+  // argument is a "full corner" constant from nsStyleConsts.h
+  nsCSSValue const & GetCorner(PRUint32 aCorner) const {
+    return this->*corners[aCorner];
+  }
+  nsCSSValue & GetCorner(PRUint32 aCorner) {
+    return this->*corners[aCorner];
+  }
+
+  PRBool operator==(const nsCSSCornerSizes& aOther) const {
+    NS_FOR_CSS_FULL_CORNERS(corner) {
+      if (this->GetCorner(corner) != aOther.GetCorner(corner))
+        return PR_FALSE;
+    }
+    return PR_TRUE;
+  }
+
+  PRBool operator!=(const nsCSSCornerSizes& aOther) const {
+    NS_FOR_CSS_FULL_CORNERS(corner) {
+      if (this->GetCorner(corner) != aOther.GetCorner(corner))
+        return PR_TRUE;
+    }
+    return PR_FALSE;
+  }
+
+  PRBool HasValue() const {
+    NS_FOR_CSS_FULL_CORNERS(corner) {
+      if (this->GetCorner(corner).GetUnit() != eCSSUnit_Null)
+        return PR_TRUE;
+    }
+    return PR_FALSE;
+  }
+
+  void Reset();
+
+  nsCSSValue mTopLeft;
+  nsCSSValue mTopRight;
+  nsCSSValue mBottomRight;
+  nsCSSValue mBottomLeft;
+
+protected:
+  typedef nsCSSValue nsCSSCornerSizes::*corner_type;
+  static const corner_type corners[4];
+};
+
 #endif /* nsCSSValue_h___ */