Have CoordDataValue derive Debug and PartialEq. r?manishearth draft
authorXidorn Quan <me@upsuper.org>
Tue, 01 Aug 2017 11:07:52 +1000
changeset 618996 eb2cab7c494937d0e73dfe7470f07369a89867e6
parent 618995 a87334e3993311c1189a2a630126193bab462c31
child 618997 447a82b35e031426f06dc980a969d80282177fef
child 619455 7900f82f89114df5ba33fdf5b652c0f21ea33eb3
push id71529
push userxquan@mozilla.com
push dateTue, 01 Aug 2017 10:17:59 +0000
reviewersmanishearth
milestone56.0a1
Have CoordDataValue derive Debug and PartialEq. r?manishearth MozReview-Commit-ID: F0hedsiuhHT
servo/components/style/gecko_bindings/sugar/ns_style_coord.rs
--- a/servo/components/style/gecko_bindings/sugar/ns_style_coord.rs
+++ b/servo/components/style/gecko_bindings/sugar/ns_style_coord.rs
@@ -49,16 +49,24 @@ impl nsStyleCoord_CalcValue {
         nsStyleCoord_CalcValue {
             mLength: 0,
             mPercent: 0.0,
             mHasPercent: false,
         }
     }
 }
 
+impl PartialEq for nsStyleCoord_CalcValue {
+    fn eq(&self, other: &Self) -> bool {
+        self.mLength == other.mLength &&
+            self.mPercent == other.mPercent &&
+            self.mHasPercent == other.mHasPercent
+    }
+}
+
 impl nsStyleSides {
     /// Immutably get the `nsStyleCoord`-like object representing the side at
     /// index `index`.
     #[inline]
     pub fn data_at(&self, index: usize) -> SidesData {
         SidesData {
             sides: self,
             index: index,
@@ -187,21 +195,21 @@ impl<'a> CoordData for CornersDataMut<'a
 impl<'a> CoordDataMut for CornersDataMut<'a> {
     unsafe fn values_mut(&mut self) -> (&mut nsStyleUnit, &mut nsStyleUnion) {
         let unit = &mut self.corners.get_mUnits_mut()[self.index] as *mut _;
         let value = &mut self.corners.get_mValues_mut()[self.index] as *mut _;
         (&mut *unit, &mut *value)
     }
 }
 
-#[derive(Copy, Clone)]
 /// Enum representing the tagged union that is CoordData.
 ///
 /// In release mode this should never actually exist in the code, and will be
 /// optimized out by threading matches and inlining.
+#[derive(Copy, Clone, Debug, PartialEq)]
 pub enum CoordDataValue {
     /// eStyleUnit_Null
     Null,
     /// eStyleUnit_Normal
     Normal,
     /// eStyleUnit_Auto
     Auto,
     /// eStyleUnit_None