mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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;
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue