Add margin style property

This commit is contained in:
Brian Anderson 2012-11-04 02:41:57 -08:00
parent 0866359a10
commit 735ce3ba5a
3 changed files with 23 additions and 2 deletions

@ -1 +1 @@
Subproject commit 41d232fe56314d0406a3d846b70182405811865b
Subproject commit 990820867176bb2fa4d92ee8aa385a8f1e1525af

@ -1 +1 @@
Subproject commit 2865a9282299ee21f70e2ebf409e6804767db160
Subproject commit 91c4b73e990971de5c9232a889787a7c5859eedd

View file

@ -9,11 +9,16 @@ use dom::node::Node;
use newcss::color::{Color, rgba};
use newcss::units::{Length, Px};
use newcss::values::{CSSValue, Specified, Inherit};
use newcss::values::{CSSMargin, CSSMarginLength};
use newcss::values::{CSSBorderWidth, CSSBorderWidthLength};
use newcss::computed::ComputedStyle;
pub trait ComputeStyles {
fn compute_background_color(&self) -> Color;
fn compute_margin_top(&self) -> CSSMargin;
fn compute_margin_right(&self) -> CSSMargin;
fn compute_margin_bottom(&self) -> CSSMargin;
fn compute_margin_left(&self) -> CSSMargin;
fn compute_border_top_width(&self) -> CSSBorderWidth;
fn compute_border_right_width(&self) -> CSSBorderWidth;
fn compute_border_bottom_width(&self) -> CSSBorderWidth;
@ -29,6 +34,22 @@ impl Node: ComputeStyles {
resolve(self, rgba(0, 0, 0, 0.0), |cs| cs.background_color() )
}
fn compute_margin_top(&self) -> CSSMargin {
resolve(self, CSSMarginLength(Px(0.0)), |cs| cs.margin_top() )
}
fn compute_margin_right(&self) -> CSSMargin {
resolve(self, CSSMarginLength(Px(0.0)), |cs| cs.margin_right() )
}
fn compute_margin_bottom(&self) -> CSSMargin {
resolve(self, CSSMarginLength(Px(0.0)), |cs| cs.margin_bottom() )
}
fn compute_margin_left(&self) -> CSSMargin {
resolve(self, CSSMarginLength(Px(0.0)), |cs| cs.margin_left() )
}
fn compute_border_top_width(&self) -> CSSBorderWidth {
resolve(self, CSSBorderWidthLength(Px(0.0)), |cs| cs.border_top_width() )
}