mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Bug 1374233 - Part 9: Add NonNegativeLengthOrPercentageOrNumber for stroke-{width|dasharry}.
Also add SVGWidth which use NonNegativeSVGLengthOrPercentage as the LengthType for stroke-width. MozReview-Commit-ID: 8gD0fVe2eAe
This commit is contained in:
parent
b37f270c65
commit
bd0a098ef1
9 changed files with 64 additions and 46 deletions
|
@ -7,6 +7,7 @@
|
|||
use app_units::Au;
|
||||
use values::{Either, RGBA};
|
||||
use values::computed::{LengthOrPercentageOrNumber, Opacity};
|
||||
use values::computed::{NonNegativeAu, NonNegativeLengthOrPercentageOrNumber};
|
||||
use values::generics::svg as generic;
|
||||
|
||||
/// Computed SVG Paint value
|
||||
|
@ -43,8 +44,17 @@ impl From<Au> for SVGLength {
|
|||
}
|
||||
}
|
||||
|
||||
/// An non-negative wrapper of SVGLength.
|
||||
pub type SVGWidth = generic::SVGLength<NonNegativeLengthOrPercentageOrNumber>;
|
||||
|
||||
impl From<NonNegativeAu> for SVGWidth {
|
||||
fn from(length: NonNegativeAu) -> Self {
|
||||
generic::SVGLength::Length(Either::Second(length.into()))
|
||||
}
|
||||
}
|
||||
|
||||
/// [ <length> | <percentage> | <number> ]# | context-value
|
||||
pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<LengthOrPercentageOrNumber>;
|
||||
pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeLengthOrPercentageOrNumber>;
|
||||
|
||||
impl Default for SVGStrokeDashArray {
|
||||
fn default() -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue