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]
|
#[inline]
|
||||||
pub fn to_box_shadow(&self) -> BoxShadow {
|
pub fn to_box_shadow(&self) -> BoxShadow {
|
||||||
BoxShadow {
|
BoxShadow {
|
||||||
base: SimpleShadow {
|
base: self.extract_simple_shadow(),
|
||||||
color: Color::rgba(convert_nscolor_to_rgba(self.mColor)),
|
|
||||||
horizontal: Au(self.mXOffset),
|
|
||||||
vertical: Au(self.mYOffset),
|
|
||||||
blur: Au(self.mRadius).into(),
|
|
||||||
},
|
|
||||||
spread: Au(self.mSpread),
|
spread: Au(self.mSpread),
|
||||||
inset: self.mInset,
|
inset: self.mInset,
|
||||||
}
|
}
|
||||||
|
@ -53,11 +48,9 @@ impl nsCSSShadowItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns this item as a simple shadow.
|
/// Gets a simple shadow from this item.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_simple_shadow(&self) -> SimpleShadow {
|
fn extract_simple_shadow(&self) -> SimpleShadow {
|
||||||
debug_assert_eq!(self.mSpread, 0);
|
|
||||||
debug_assert_eq!(self.mInset, false);
|
|
||||||
SimpleShadow {
|
SimpleShadow {
|
||||||
color: Color::rgba(convert_nscolor_to_rgba(self.mColor)),
|
color: Color::rgba(convert_nscolor_to_rgba(self.mColor)),
|
||||||
horizontal: Au(self.mXOffset),
|
horizontal: Au(self.mXOffset),
|
||||||
|
@ -65,4 +58,12 @@ impl nsCSSShadowItem {
|
||||||
blur: Au(self.mRadius).into(),
|
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