diff --git a/complete.rs b/complete.rs index f7ebe04..c748fa9 100644 --- a/complete.rs +++ b/complete.rs @@ -96,6 +96,22 @@ impl<'self> CompleteStyle<'self> { strip(self.inner.margin_left()) } + pub fn padding_top(&self) -> CSSPadding { + strip(self.inner.padding_top()) + } + + pub fn padding_right(&self) -> CSSPadding { + strip(self.inner.padding_right()) + } + + pub fn padding_bottom(&self) -> CSSPadding { + strip(self.inner.padding_bottom()) + } + + pub fn padding_left(&self) -> CSSPadding { + strip(self.inner.padding_left()) + } + pub fn border_top_width(&self) -> CSSBorderWidth { strip(self.inner.border_top_width()) } diff --git a/computed.rs b/computed.rs index b87b318..5f0d54b 100644 --- a/computed.rs +++ b/computed.rs @@ -33,6 +33,22 @@ pub impl<'self> ComputedStyle<'self> { convert_net_margin(self.inner.margin_left()) } + pub fn padding_top(&self) -> CSSValue { + convert_net_padding(self.inner.padding_top()) + } + + pub fn padding_right(&self) -> CSSValue { + convert_net_padding(self.inner.padding_right()) + } + + pub fn padding_bottom(&self) -> CSSValue { + convert_net_padding(self.inner.padding_bottom()) + } + + pub fn padding_left(&self) -> CSSValue { + convert_net_padding(self.inner.padding_left()) + } + pub fn border_top_width(&self) -> CSSValue { convert_net_border_width(self.inner.border_top_width()) } @@ -176,6 +192,13 @@ fn convert_net_margin(margin: n::v::CssMarginValue) -> CSSValue { } } +fn convert_net_padding(padding: n::v::CssPaddingValue) -> CSSValue { + match padding { + n::v::CssPaddingInherit => Inherit, + n::v::CssPaddingSet(length) => Specified(CSSPaddingLength(convert_net_unit_to_length(length))) + } +} + fn convert_net_width_value(value: n::v::CssWidthValue) -> CSSValue { match value { n::v::CssWidthInherit => Inherit,