mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Reuse to_simple_shadow() for box-shadow as well.
This commit is contained in:
parent
e0b834033d
commit
4665d6dd15
1 changed files with 11 additions and 10 deletions
|
@ -23,12 +23,7 @@ impl nsCSSShadowItem {
|
|||
#[inline]
|
||||
pub fn to_box_shadow(&self) -> BoxShadow {
|
||||
BoxShadow {
|
||||
base: SimpleShadow {
|
||||
color: Color::rgba(convert_nscolor_to_rgba(self.mColor)),
|
||||
horizontal: Au(self.mXOffset),
|
||||
vertical: Au(self.mYOffset),
|
||||
blur: Au(self.mRadius).into(),
|
||||
},
|
||||
base: self.extract_simple_shadow(),
|
||||
spread: Au(self.mSpread),
|
||||
inset: self.mInset,
|
||||
}
|
||||
|
@ -53,11 +48,9 @@ impl nsCSSShadowItem {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns this item as a simple shadow.
|
||||
/// Gets a simple shadow from this item.
|
||||
#[inline]
|
||||
pub fn to_simple_shadow(&self) -> SimpleShadow {
|
||||
debug_assert_eq!(self.mSpread, 0);
|
||||
debug_assert_eq!(self.mInset, false);
|
||||
fn extract_simple_shadow(&self) -> SimpleShadow {
|
||||
SimpleShadow {
|
||||
color: Color::rgba(convert_nscolor_to_rgba(self.mColor)),
|
||||
horizontal: Au(self.mXOffset),
|
||||
|
@ -65,4 +58,12 @@ impl nsCSSShadowItem {
|
|||
blur: Au(self.mRadius).into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns this item as a simple shadow.
|
||||
#[inline]
|
||||
pub fn to_simple_shadow(&self) -> SimpleShadow {
|
||||
debug_assert_eq!(self.mSpread, 0);
|
||||
debug_assert_eq!(self.mInset, false);
|
||||
self.extract_simple_shadow()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue