mirror of
https://github.com/servo/servo.git
synced 2025-07-04 05:53:39 +01:00
style: Change nscolor to StyleComplexColor.
Bug: 1467622 Reviewed-by: xidorn MozReview-Commit-ID: 1bbQzOoOuBe
This commit is contained in:
parent
6f9b47be25
commit
a76f5393d4
4 changed files with 15 additions and 13 deletions
|
@ -667,14 +667,14 @@ def set_gecko_property(ffi_name, expr):
|
||||||
SVGPaintKind::Color(color) => {
|
SVGPaintKind::Color(color) => {
|
||||||
paint.mType = nsStyleSVGPaintType::eStyleSVGPaintType_Color;
|
paint.mType = nsStyleSVGPaintType::eStyleSVGPaintType_Color;
|
||||||
unsafe {
|
unsafe {
|
||||||
*paint.mPaint.mColor.as_mut() = convert_rgba_to_nscolor(&color);
|
*paint.mPaint.mColor.as_mut() = color.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paint.mFallbackType = match fallback {
|
paint.mFallbackType = match fallback {
|
||||||
Some(Either::First(color)) => {
|
Some(Either::First(color)) => {
|
||||||
paint.mFallbackColor = convert_rgba_to_nscolor(&color);
|
paint.mFallbackColor = color.into();
|
||||||
nsStyleSVGFallbackType::eStyleSVGFallbackType_Color
|
nsStyleSVGFallbackType::eStyleSVGFallbackType_Color
|
||||||
},
|
},
|
||||||
Some(Either::Second(_)) => {
|
Some(Either::Second(_)) => {
|
||||||
|
@ -709,7 +709,7 @@ def set_gecko_property(ffi_name, expr):
|
||||||
|
|
||||||
let fallback = match paint.mFallbackType {
|
let fallback = match paint.mFallbackType {
|
||||||
nsStyleSVGFallbackType::eStyleSVGFallbackType_Color => {
|
nsStyleSVGFallbackType::eStyleSVGFallbackType_Color => {
|
||||||
Some(Either::First(convert_nscolor_to_rgba(paint.mFallbackColor)))
|
Some(Either::First(paint.mFallbackColor.into()))
|
||||||
},
|
},
|
||||||
nsStyleSVGFallbackType::eStyleSVGFallbackType_None => {
|
nsStyleSVGFallbackType::eStyleSVGFallbackType_None => {
|
||||||
Some(Either::Second(None_))
|
Some(Either::Second(None_))
|
||||||
|
@ -728,7 +728,8 @@ def set_gecko_property(ffi_name, expr):
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
nsStyleSVGPaintType::eStyleSVGPaintType_Color => {
|
nsStyleSVGPaintType::eStyleSVGPaintType_Color => {
|
||||||
unsafe { SVGPaintKind::Color(convert_nscolor_to_rgba(*paint.mPaint.mColor.as_ref())) }
|
let col = unsafe { *paint.mPaint.mColor.as_ref() };
|
||||||
|
SVGPaintKind::Color(col.into())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
SVGPaint {
|
SVGPaint {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use hash::FnvHashMap;
|
||||||
use super::ComputedValues;
|
use super::ComputedValues;
|
||||||
use values::CSSFloat;
|
use values::CSSFloat;
|
||||||
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||||
use values::animated::color::RGBA as AnimatedRGBA;
|
use values::animated::color::Color as AnimatedColor;
|
||||||
use values::animated::effects::Filter as AnimatedFilter;
|
use values::animated::effects::Filter as AnimatedFilter;
|
||||||
#[cfg(feature = "gecko")] use values::computed::TransitionProperty;
|
#[cfg(feature = "gecko")] use values::computed::TransitionProperty;
|
||||||
use values::computed::{Angle, CalcLengthOrPercentage};
|
use values::computed::{Angle, CalcLengthOrPercentage};
|
||||||
|
@ -2674,10 +2674,10 @@ impl ComputeSquaredDistance for ComputedTransform {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Animated SVGPaint
|
/// Animated SVGPaint
|
||||||
pub type IntermediateSVGPaint = SVGPaint<AnimatedRGBA, ComputedUrl>;
|
pub type IntermediateSVGPaint = SVGPaint<AnimatedColor, ComputedUrl>;
|
||||||
|
|
||||||
/// Animated SVGPaintKind
|
/// Animated SVGPaintKind
|
||||||
pub type IntermediateSVGPaintKind = SVGPaintKind<AnimatedRGBA, ComputedUrl>;
|
pub type IntermediateSVGPaintKind = SVGPaintKind<AnimatedColor, ComputedUrl>;
|
||||||
|
|
||||||
impl ToAnimatedZero for IntermediateSVGPaint {
|
impl ToAnimatedZero for IntermediateSVGPaint {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -9,6 +9,7 @@ use values::RGBA;
|
||||||
use values::computed::{LengthOrPercentage, NonNegativeLength};
|
use values::computed::{LengthOrPercentage, NonNegativeLength};
|
||||||
use values::computed::{NonNegativeLengthOrPercentage, NonNegativeNumber, Number};
|
use values::computed::{NonNegativeLengthOrPercentage, NonNegativeNumber, Number};
|
||||||
use values::computed::Opacity;
|
use values::computed::Opacity;
|
||||||
|
use values::computed::color::Color;
|
||||||
use values::computed::url::ComputedUrl;
|
use values::computed::url::ComputedUrl;
|
||||||
use values::generics::svg as generic;
|
use values::generics::svg as generic;
|
||||||
|
|
||||||
|
@ -17,9 +18,9 @@ pub use values::specified::SVGPaintOrder;
|
||||||
pub use values::specified::MozContextProperties;
|
pub use values::specified::MozContextProperties;
|
||||||
|
|
||||||
/// Computed SVG Paint value
|
/// Computed SVG Paint value
|
||||||
pub type SVGPaint = generic::SVGPaint<RGBA, ComputedUrl>;
|
pub type SVGPaint = generic::SVGPaint<Color, ComputedUrl>;
|
||||||
/// Computed SVG Paint Kind value
|
/// Computed SVG Paint Kind value
|
||||||
pub type SVGPaintKind = generic::SVGPaintKind<RGBA, ComputedUrl>;
|
pub type SVGPaintKind = generic::SVGPaintKind<Color, ComputedUrl>;
|
||||||
|
|
||||||
impl Default for SVGPaint {
|
impl Default for SVGPaint {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
@ -33,7 +34,7 @@ impl Default for SVGPaint {
|
||||||
impl SVGPaint {
|
impl SVGPaint {
|
||||||
/// Opaque black color
|
/// Opaque black color
|
||||||
pub fn black() -> Self {
|
pub fn black() -> Self {
|
||||||
let rgba = RGBA::from_floats(0., 0., 0., 1.);
|
let rgba = RGBA::from_floats(0., 0., 0., 1.).into();
|
||||||
SVGPaint {
|
SVGPaint {
|
||||||
kind: generic::SVGPaintKind::Color(rgba),
|
kind: generic::SVGPaintKind::Color(rgba),
|
||||||
fallback: None,
|
fallback: None,
|
||||||
|
|
|
@ -13,14 +13,14 @@ use values::CustomIdent;
|
||||||
use values::generics::svg as generic;
|
use values::generics::svg as generic;
|
||||||
use values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
use values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
||||||
use values::specified::{Number, Opacity};
|
use values::specified::{Number, Opacity};
|
||||||
use values::specified::color::RGBAColor;
|
use values::specified::color::Color;
|
||||||
use values::specified::url::SpecifiedUrl;
|
use values::specified::url::SpecifiedUrl;
|
||||||
|
|
||||||
/// Specified SVG Paint value
|
/// Specified SVG Paint value
|
||||||
pub type SVGPaint = generic::SVGPaint<RGBAColor, SpecifiedUrl>;
|
pub type SVGPaint = generic::SVGPaint<Color, SpecifiedUrl>;
|
||||||
|
|
||||||
/// Specified SVG Paint Kind value
|
/// Specified SVG Paint Kind value
|
||||||
pub type SVGPaintKind = generic::SVGPaintKind<RGBAColor, SpecifiedUrl>;
|
pub type SVGPaintKind = generic::SVGPaintKind<Color, SpecifiedUrl>;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
fn is_context_value_enabled() -> bool {
|
fn is_context_value_enabled() -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue