Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the "tree" API and clean up flow a bit #412

Merged
merged 6 commits into from May 3, 2013

Adjust code style in clientrect

  • Loading branch information
pcwalton committed May 3, 2013
commit c74249aee5f1f3d13949ed8d88eb540276638006
@@ -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)
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.