Have CoordDataValue derive Debug and PartialEq. r?manishearth
draft
Have CoordDataValue derive Debug and PartialEq. r?manishearth
MozReview-Commit-ID: F0hedsiuhHT
--- 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