Skip to content

Commit

Permalink
stylo: Add stroke-width property
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 4QKKzJ1DVYP
  • Loading branch information
Manishearth committed Feb 18, 2017
1 parent 51b03fb commit 3b0840d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions components/style/properties/longhand/inherited_svg.mako.rs
Expand Up @@ -65,6 +65,16 @@ ${helpers.predefined_type(
boxed=True,
spec="https://www.w3.org/TR/SVG2/painting.html#SpecifyingStrokePaint")}

${helpers.predefined_type(
"stroke-width", "LengthOrPercentage",
"computed::LengthOrPercentage::one()",
"parse_non_negative",
products="gecko",
animatable=True,
needs_context=False,
boxed=True,
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeWidth")}

${helpers.single_keyword("stroke-linecap", "butt round square",
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeLinecapProperty")}
Expand Down
8 changes: 7 additions & 1 deletion components/style/values/computed/length.rs
Expand Up @@ -4,7 +4,7 @@

//! `<length>` computed values, and related ones.

use app_units::Au;
use app_units::{Au, AU_PER_PX};
use ordered_float::NotNaN;
use std::fmt;
use style_traits::ToCss;
Expand Down Expand Up @@ -195,6 +195,12 @@ impl LengthOrPercentage {
LengthOrPercentage::Length(Au(0))
}

#[inline]
/// 1px length value for SVG defaults
pub fn one() -> LengthOrPercentage {
LengthOrPercentage::Length(Au(AU_PER_PX))
}

/// Returns true if the computed value is absolute 0 or 0%.
///
/// (Returns false for calc() values, even if ones that may resolve to zero.)
Expand Down

0 comments on commit 3b0840d

Please sign in to comment.