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:
Manish Goregaokar 2017-10-04 15:55:37 -07:00
parent 6631594e28
commit 079b25db93
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
2 changed files with 57 additions and 25 deletions

View file

@ -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");