mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
stylo: Add Gecko bindings for <paint>, use for stroke/fill
MozReview-Commit-ID: 4QKKzJ1DVYP
This commit is contained in:
parent
fabc1b875b
commit
51b03fbc7d
6 changed files with 124 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue