From c74249aee5f1f3d13949ed8d88eb540276638006 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 2 May 2013 19:11:27 -0700 Subject: [PATCH] Adjust code style in clientrect --- src/servo/dom/clientrect.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/servo/dom/clientrect.rs b/src/servo/dom/clientrect.rs index 90856ca5cd3..3c9f6f9dca9 100644 --- a/src/servo/dom/clientrect.rs +++ b/src/servo/dom/clientrect.rs @@ -1,4 +1,7 @@ -//use dom::bindings::clientrect::ClientRect; +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + use dom::bindings::utils::WrapperCache; pub struct ClientRect { @@ -9,37 +12,41 @@ pub struct ClientRect { right: f32, } -pub impl ClientRect { - fn new(top: f32, bottom: f32, left: f32, right: f32) -> @mut ClientRect { +impl ClientRect { + pub fn new(top: f32, bottom: f32, left: f32, right: f32) -> @mut ClientRect { let rect = @mut ClientRect { - top: top, bottom: bottom, left: left, right: right, + top: top, + bottom: bottom, + left: left, + right: right, wrapper: WrapperCache::new() }; rect.init_wrapper(); rect } - fn Top(&self) -> f32 { + pub fn Top(&self) -> f32 { self.top } - fn Bottom(&self) -> f32 { + pub fn Bottom(&self) -> f32 { self.bottom } - fn Left(&self) -> f32 { + pub fn Left(&self) -> f32 { self.left } - fn Right(&self) -> f32 { + pub fn Right(&self) -> f32 { self.right } - fn Width(&self) -> f32 { + pub fn Width(&self) -> f32 { f32::abs(self.right - self.left) } - fn Height(&self) -> f32 { + pub fn Height(&self) -> f32 { f32::abs(self.bottom - self.top) } } +