stylo: Add Gecko bindings for <paint>, use for stroke/fill

MozReview-Commit-ID: 4QKKzJ1DVYP
This commit is contained in:
Manish Goregaokar 2017-02-09 17:43:52 -08:00 committed by Manish Goregaokar
parent fabc1b875b
commit 51b03fbc7d
6 changed files with 124 additions and 14 deletions

View file

@ -10,7 +10,7 @@ use font_metrics::FontMetricsProvider;
use properties::ComputedValues;
use std::fmt;
use style_traits::ToCss;
use super::{CSSFloat, specified};
use super::{CSSFloat, RGBA, specified};
pub use cssparser::Color as CSSColor;
pub use self::image::{AngleOrCorner, EndingShape as GradientShape, Gradient, GradientKind, Image};
@ -197,6 +197,26 @@ pub struct SVGPaint {
pub fallback: Option<CSSColor>,
}
impl Default for SVGPaint {
fn default() -> Self {
SVGPaint {
kind: SVGPaintKind::None,
fallback: None,
}
}
}
impl SVGPaint {
/// Opaque black color
pub fn black() -> Self {
let rgba = RGBA::from_floats(0., 0., 0., 1.);
SVGPaint {
kind: SVGPaintKind::Color(CSSColor::RGBA(rgba)),
fallback: None,
}
}
}
/// An SVG paint value without the fallback
///
/// Whereas the spec only allows PaintServer