Adjust code style in clientrect

This commit is contained in:
Patrick Walton 2013-05-02 19:11:27 -07:00
parent 84189202ad
commit c74249aee5

View file

@ -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)
}
}