mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Add ShapeRadius to basic_shape.rs
This commit is contained in:
parent
2580c1dc6e
commit
88c1a67d89
2 changed files with 79 additions and 0 deletions
|
@ -50,6 +50,31 @@ impl ToCss for InsetRect {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
||||
#[derive(Clone, PartialEq, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum ShapeRadius {
|
||||
Length(LengthOrPercentage),
|
||||
ClosestSide,
|
||||
FarthestSide,
|
||||
}
|
||||
|
||||
impl Default for ShapeRadius {
|
||||
fn default() -> Self {
|
||||
ShapeRadius::ClosestSide
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for ShapeRadius {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
ShapeRadius::Length(lop) => lop.to_css(dest),
|
||||
ShapeRadius::ClosestSide => dest.write_str("closest-side"),
|
||||
ShapeRadius::FarthestSide => dest.write_str("farthest-side"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
||||
#[derive(Clone, PartialEq, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue