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

@ -4,7 +4,9 @@
//! Computed types for SVG properties.
use values::RGBA;
use app_units::Au;
use values::{Either, RGBA};
use values::computed::LengthOrPercentageOrNumber;
use values::generics::svg as generic;
/// Computed SVG Paint value
@ -31,3 +33,12 @@ impl SVGPaint {
}
}
}
/// <length> | <percentage> | <number> | context-value
pub type SVGLength = generic::SVGLength<LengthOrPercentageOrNumber>;
impl From<Au> for SVGLength {
fn from(length: Au) -> Self {
generic::SVGLength::Length(Either::Second(length.into()))
}
}