aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/geometry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/util/geometry.rs')
-rw-r--r--components/util/geometry.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 8be6b50dbee..2dc9fe61b4c 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -6,11 +6,12 @@ use geom::length::Length;
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
+use geom::num::Zero;
use serialize::{Encodable, Encoder};
use std::default::Default;
use std::i32;
-use std::num::{Float, NumCast, Zero};
+use std::num::{Float, NumCast};
use std::fmt;
// Units for use with geom::length and geom::scale_factor.
@@ -64,7 +65,7 @@ pub enum PagePx {}
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.
//
// FIXME: Implement Au using Length and ScaleFactor instead of a custom type.
-#[deriving(Clone, Hash, PartialEq, PartialOrd, Eq, Ord, Zero)]
+#[deriving(Clone, Hash, PartialEq, PartialOrd, Eq, Ord)]
pub struct Au(pub i32);
impl Default for Au {
@@ -74,6 +75,13 @@ impl Default for Au {
}
}
+impl Zero for Au {
+ #[inline]
+ fn zero() -> Au {
+ Au(0)
+ }
+}
+
pub static ZERO_POINT: Point2D<Au> = Point2D {
x: Au(0),
y: Au(0),