Add SVGLength which accepts context-value, and use it for stroke-{width,dashoffset}.

This commit is contained in:
Xidorn Quan 2017-08-02 09:27:46 +10:00
parent 3991e7d344
commit aa80859a71
8 changed files with 182 additions and 49 deletions

View file

@ -94,3 +94,13 @@ impl<ColorType: Parse> Parse for SVGPaint<ColorType> {
}
}
}
/// An SVG length value supports `context-value` in addition to length.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, HasViewportPercentage, ToComputedValue, ToCss)]
pub enum SVGLength<LengthType> {
/// `<length> | <percentage> | <number>`
Length(LengthType),
/// `context-value`
ContextValue,
}