mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Derive ToCss for ShapeRadius<L>
This commit is contained in:
parent
8449eb4a62
commit
fd1ab75af9
1 changed files with 1 additions and 12 deletions
|
@ -92,7 +92,7 @@ pub struct Ellipse<H, V, LengthOrPercentage> {
|
||||||
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
pub enum ShapeRadius<LengthOrPercentage> {
|
pub enum ShapeRadius<LengthOrPercentage> {
|
||||||
Length(LengthOrPercentage),
|
Length(LengthOrPercentage),
|
||||||
ClosestSide,
|
ClosestSide,
|
||||||
|
@ -161,17 +161,6 @@ impl<L> Default for ShapeRadius<L> {
|
||||||
fn default() -> Self { ShapeRadius::ClosestSide }
|
fn default() -> Self { ShapeRadius::ClosestSide }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<L: ToCss> ToCss for ShapeRadius<L> {
|
|
||||||
#[inline]
|
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
|
||||||
match *self {
|
|
||||||
ShapeRadius::Length(ref lop) => lop.to_css(dest),
|
|
||||||
ShapeRadius::ClosestSide => dest.write_str("closest-side"),
|
|
||||||
ShapeRadius::FarthestSide => dest.write_str("farthest-side"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<L: ToCss> ToCss for Polygon<L> {
|
impl<L: ToCss> ToCss for Polygon<L> {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
dest.write_str("polygon(")?;
|
dest.write_str("polygon(")?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue