mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Adjust code style in clientrect
This commit is contained in:
parent
84189202ad
commit
c74249aee5
1 changed files with 17 additions and 10 deletions
|
@ -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;
|
use dom::bindings::utils::WrapperCache;
|
||||||
|
|
||||||
pub struct ClientRect {
|
pub struct ClientRect {
|
||||||
|
@ -9,37 +12,41 @@ pub struct ClientRect {
|
||||||
right: f32,
|
right: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl ClientRect {
|
impl ClientRect {
|
||||||
fn new(top: f32, bottom: f32, left: f32, right: f32) -> @mut ClientRect {
|
pub fn new(top: f32, bottom: f32, left: f32, right: f32) -> @mut ClientRect {
|
||||||
let rect = @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()
|
wrapper: WrapperCache::new()
|
||||||
};
|
};
|
||||||
rect.init_wrapper();
|
rect.init_wrapper();
|
||||||
rect
|
rect
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Top(&self) -> f32 {
|
pub fn Top(&self) -> f32 {
|
||||||
self.top
|
self.top
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Bottom(&self) -> f32 {
|
pub fn Bottom(&self) -> f32 {
|
||||||
self.bottom
|
self.bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Left(&self) -> f32 {
|
pub fn Left(&self) -> f32 {
|
||||||
self.left
|
self.left
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Right(&self) -> f32 {
|
pub fn Right(&self) -> f32 {
|
||||||
self.right
|
self.right
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Width(&self) -> f32 {
|
pub fn Width(&self) -> f32 {
|
||||||
f32::abs(self.right - self.left)
|
f32::abs(self.right - self.left)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Height(&self) -> f32 {
|
pub fn Height(&self) -> f32 {
|
||||||
f32::abs(self.bottom - self.top)
|
f32::abs(self.bottom - self.top)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue