mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Share transform function lists between set_transform and clone_transform
This will also fix https://bugzilla.mozilla.org/show_bug.cgi?id=1405881
This commit is contained in:
parent
6631594e28
commit
079b25db93
2 changed files with 57 additions and 25 deletions
|
@ -13,7 +13,7 @@ use std::marker::PhantomData;
|
|||
use std::mem;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::slice;
|
||||
use values::computed::{Angle, LengthOrPercentage, Percentage};
|
||||
use values::computed::{Angle, Length, LengthOrPercentage, Percentage};
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
impl nsCSSValue {
|
||||
|
@ -104,7 +104,6 @@ impl nsCSSValue {
|
|||
|
||||
/// Returns LengthOrPercentage value.
|
||||
pub unsafe fn get_lop(&self) -> LengthOrPercentage {
|
||||
use values::computed::Length;
|
||||
match self.mUnit {
|
||||
nsCSSUnit::eCSSUnit_Pixel => {
|
||||
LengthOrPercentage::Length(Length::new(bindings::Gecko_CSSValue_GetNumber(self)))
|
||||
|
@ -119,6 +118,16 @@ impl nsCSSValue {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns Length value.
|
||||
pub unsafe fn get_length(&self) -> Length {
|
||||
match self.mUnit {
|
||||
nsCSSUnit::eCSSUnit_Pixel => {
|
||||
Length::new(bindings::Gecko_CSSValue_GetNumber(self))
|
||||
},
|
||||
x => panic!("The unit should not be {:?}", x),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_valueless_unit(&mut self, unit: nsCSSUnit) {
|
||||
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_Null);
|
||||
debug_assert!(unit as u32 <= nsCSSUnit::eCSSUnit_DummyInherit as u32, "Not a valueless unit");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue