diff options
author | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2015-03-25 01:16:08 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2015-03-25 10:45:30 +0900 |
commit | 9cd1b2c158f6a92aa48ed2702f591109b7a32eaa (patch) | |
tree | c4a76b71d56f4759b099c4e34b70889b76553e0e /components/script/dom/domrect.rs | |
parent | 4c96732077d8152055a8988403f07db1277b50a7 (diff) | |
download | servo-9cd1b2c158f6a92aa48ed2702f591109b7a32eaa.tar.gz servo-9cd1b2c158f6a92aa48ed2702f591109b7a32eaa.zip |
Use Finite<T> for our dom code (excluding CanvasRenderingContext2D)
Diffstat (limited to 'components/script/dom/domrect.rs')
-rw-r--r-- | components/script/dom/domrect.rs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 513e96ef28d..08cacc09be2 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -6,6 +6,7 @@ use dom::bindings::codegen::Bindings::DOMRectBinding; use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JSRef, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::window::Window; use util::geometry::Au; @@ -41,28 +42,30 @@ impl DOMRect { } impl<'a> DOMRectMethods for JSRef<'a, DOMRect> { - fn Top(self) -> f32 { - self.top + fn Top(self) -> Finite<f32> { + Finite::wrap(self.top) } - fn Bottom(self) -> f32 { - self.bottom + fn Bottom(self) -> Finite<f32> { + Finite::wrap(self.bottom) } - fn Left(self) -> f32 { - self.left + fn Left(self) -> Finite<f32> { + Finite::wrap(self.left) } - fn Right(self) -> f32 { - self.right + fn Right(self) -> Finite<f32> { + Finite::wrap(self.right) } - fn Width(self) -> f32 { - (self.right - self.left).abs() + fn Width(self) -> Finite<f32> { + let result = (self.right - self.left).abs(); + Finite::wrap(result) } - fn Height(self) -> f32 { - (self.bottom - self.top).abs() + fn Height(self) -> Finite<f32> { + let result = (self.bottom - self.top).abs(); + Finite::wrap(result) } } |