stylo: Support stroke-dasharray and stroke-dashoffset

MozReview-Commit-ID: 4QKKzJ1DVYP
This commit is contained in:
Manish Goregaokar 2017-02-09 17:43:52 -08:00 committed by Manish Goregaokar
parent 4d33761596
commit ff08de8ad1
7 changed files with 89 additions and 4 deletions

View file

@ -824,6 +824,21 @@ impl ToComputedValue for SVGPaintKind {
}
}
/// <length> | <percentage> | <number>
pub type LoPOrNumber = Either<LengthOrPercentage, Number>;
impl LoPOrNumber {
/// parse a <length-percentage> | <number> enforcing that the contents aren't negative
pub fn parse_non_negative(_: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if let Ok(lop) = input.try(LengthOrPercentage::parse_non_negative) {
Ok(Either::First(lop))
} else if let Ok(num) = input.try(Number::parse_non_negative) {
Ok(Either::Second(num))
} else {
Err(())
}
}
}
impl HasViewportPercentage for ClipRect {
fn has_viewport_percentage(&self) -> bool {