mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Format style component.
This commit is contained in:
parent
31fc6cd565
commit
8dab4d659a
120 changed files with 2207 additions and 1417 deletions
|
@ -52,7 +52,8 @@ impl nsStyleCoord_CalcValue {
|
|||
|
||||
impl PartialEq for nsStyleCoord_CalcValue {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.mLength == other.mLength && self.mPercent == other.mPercent &&
|
||||
self.mLength == other.mLength &&
|
||||
self.mPercent == other.mPercent &&
|
||||
self.mHasPercent == other.mHasPercent
|
||||
}
|
||||
}
|
||||
|
@ -409,9 +410,12 @@ pub unsafe trait CoordData {
|
|||
unsafe fn get_float(&self) -> f32 {
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
debug_assert!(
|
||||
self.unit() == eStyleUnit_Percent || self.unit() == eStyleUnit_Factor ||
|
||||
self.unit() == eStyleUnit_Degree || self.unit() == eStyleUnit_Grad ||
|
||||
self.unit() == eStyleUnit_Radian || self.unit() == eStyleUnit_Turn ||
|
||||
self.unit() == eStyleUnit_Percent ||
|
||||
self.unit() == eStyleUnit_Factor ||
|
||||
self.unit() == eStyleUnit_Degree ||
|
||||
self.unit() == eStyleUnit_Grad ||
|
||||
self.unit() == eStyleUnit_Radian ||
|
||||
self.unit() == eStyleUnit_Turn ||
|
||||
self.unit() == eStyleUnit_FlexFraction
|
||||
);
|
||||
*self.union().mFloat.as_ref()
|
||||
|
@ -422,7 +426,8 @@ pub unsafe trait CoordData {
|
|||
unsafe fn get_integer(&self) -> i32 {
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
debug_assert!(
|
||||
self.unit() == eStyleUnit_Coord || self.unit() == eStyleUnit_Integer ||
|
||||
self.unit() == eStyleUnit_Coord ||
|
||||
self.unit() == eStyleUnit_Integer ||
|
||||
self.unit() == eStyleUnit_Enumerated
|
||||
);
|
||||
*self.union().mInt.as_ref()
|
||||
|
|
|
@ -321,8 +321,4 @@ unsafe fn addref_atom(atom: *mut structs::nsAtom) {
|
|||
unsafe fn release_atom(atom: *mut structs::nsAtom) {
|
||||
let _ = Atom::from_addrefed(atom);
|
||||
}
|
||||
impl_threadsafe_refcount!(
|
||||
structs::nsAtom,
|
||||
addref_atom,
|
||||
release_atom
|
||||
);
|
||||
impl_threadsafe_refcount!(structs::nsAtom, addref_atom, release_atom);
|
||||
|
|
|
@ -59,7 +59,7 @@ impl From<ComputedColor> for StyleComplexColor {
|
|||
mFgRatio: ratios.fg,
|
||||
mTag: Tag::eComplex,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,11 +70,11 @@ impl From<StyleComplexColor> for ComputedColor {
|
|||
Tag::eNumeric => {
|
||||
debug_assert!(other.mBgRatio == 1. && other.mFgRatio == 0.);
|
||||
GenericColor::Numeric(convert_nscolor_to_rgba(other.mColor))
|
||||
}
|
||||
},
|
||||
Tag::eForeground => {
|
||||
debug_assert!(other.mBgRatio == 0. && other.mFgRatio == 1.);
|
||||
GenericColor::Foreground
|
||||
}
|
||||
},
|
||||
Tag::eComplex => {
|
||||
debug_assert!(other.mBgRatio != 1. || other.mFgRatio != 0.);
|
||||
debug_assert!(other.mBgRatio != 0. || other.mFgRatio != 1.);
|
||||
|
@ -85,7 +85,7 @@ impl From<StyleComplexColor> for ComputedColor {
|
|||
fg: other.mFgRatio,
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
Tag::eAuto => unreachable!("Unsupport StyleComplexColor with tag eAuto"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue