mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
stylo: Support stroke-dasharray and stroke-dashoffset
MozReview-Commit-ID: 4QKKzJ1DVYP
This commit is contained in:
parent
4d33761596
commit
ff08de8ad1
7 changed files with 89 additions and 4 deletions
|
@ -259,6 +259,8 @@ impl ToCss for SVGPaint {
|
|||
}
|
||||
}
|
||||
|
||||
/// <length> | <percentage> | <number>
|
||||
pub type LoPOrNumber = Either<LengthOrPercentage, Number>;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue