mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
style: Add FFI function for parsing IntersectionObserver rootMargin values.
This commit is contained in:
parent
eecee32a0b
commit
ef28ccb1a3
3 changed files with 120 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue