mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Add svg mods and move SVG-related types into them.
This commit is contained in:
parent
4d71eed898
commit
0071c7663f
8 changed files with 154 additions and 125 deletions
33
components/style/values/computed/svg.rs
Normal file
33
components/style/values/computed/svg.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Computed types for SVG properties.
|
||||
|
||||
use values::RGBA;
|
||||
use values::generics::svg as generic;
|
||||
|
||||
/// Computed SVG Paint value
|
||||
pub type SVGPaint = generic::SVGPaint<RGBA>;
|
||||
/// Computed SVG Paint Kind value
|
||||
pub type SVGPaintKind = generic::SVGPaintKind<RGBA>;
|
||||
|
||||
impl Default for SVGPaint {
|
||||
fn default() -> Self {
|
||||
SVGPaint {
|
||||
kind: generic::SVGPaintKind::None,
|
||||
fallback: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SVGPaint {
|
||||
/// Opaque black color
|
||||
pub fn black() -> Self {
|
||||
let rgba = RGBA::from_floats(0., 0., 0., 1.);
|
||||
SVGPaint {
|
||||
kind: generic::SVGPaintKind::Color(rgba),
|
||||
fallback: None,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue