diff options
Diffstat (limited to 'components/style/gecko_bindings/sugar/ns_css_value.rs')
-rw-r--r-- | components/style/gecko_bindings/sugar/ns_css_value.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/components/style/gecko_bindings/sugar/ns_css_value.rs b/components/style/gecko_bindings/sugar/ns_css_value.rs index 9c57b788ef1..8c1d83c8ffd 100644 --- a/components/style/gecko_bindings/sugar/ns_css_value.rs +++ b/components/style/gecko_bindings/sugar/ns_css_value.rs @@ -75,10 +75,10 @@ impl nsCSSValue { pub unsafe fn set_lop(&mut self, lop: LengthOrPercentage) { match lop { LengthOrPercentage::Length(px) => { - bindings::Gecko_CSSValue_SetPixelLength(self, px.px()) + self.set_px(px.px()) } LengthOrPercentage::Percentage(pc) => { - bindings::Gecko_CSSValue_SetPercentage(self, pc.0) + self.set_percentage(pc.0) } LengthOrPercentage::Calc(calc) => { bindings::Gecko_CSSValue_SetCalc(self, calc.into()) @@ -86,6 +86,16 @@ impl nsCSSValue { } } + /// Sets a px value to this nsCSSValue. + pub unsafe fn set_px(&mut self, px: f32) { + bindings::Gecko_CSSValue_SetPixelLength(self, px) + } + + /// Sets a percentage value to this nsCSSValue. + pub unsafe fn set_percentage(&mut self, unit_value: f32) { + bindings::Gecko_CSSValue_SetPercentage(self, unit_value) + } + /// Returns LengthOrPercentage value. pub unsafe fn get_lop(&self) -> LengthOrPercentage { use values::computed::Length; |