mirror of
https://github.com/servo/servo.git
synced 2025-08-20 12:55:33 +01:00
style: Expose colors via cbindgen.
Also s/Foreground/CurrentColor. Differential Revision: https://phabricator.services.mozilla.com/D25975
This commit is contained in:
parent
a6f32bc762
commit
691eb36ffe
6 changed files with 50 additions and 37 deletions
|
@ -49,8 +49,8 @@ impl From<ComputedColor> for StyleComplexColor {
|
|||
fn from(other: ComputedColor) -> Self {
|
||||
match other {
|
||||
GenericColor::Numeric(color) => color.into(),
|
||||
GenericColor::Foreground => Self::current_color(),
|
||||
GenericColor::Complex(color, ratios) => {
|
||||
GenericColor::CurrentColor => Self::current_color(),
|
||||
GenericColor::Complex { color, ratios } => {
|
||||
debug_assert!(ratios != ComplexColorRatios::NUMERIC);
|
||||
debug_assert!(ratios != ComplexColorRatios::FOREGROUND);
|
||||
StyleComplexColor {
|
||||
|
@ -73,18 +73,18 @@ impl From<StyleComplexColor> for ComputedColor {
|
|||
},
|
||||
Tag::eForeground => {
|
||||
debug_assert!(other.mBgRatio == 0. && other.mFgRatio == 1.);
|
||||
GenericColor::Foreground
|
||||
GenericColor::CurrentColor
|
||||
},
|
||||
Tag::eComplex => {
|
||||
debug_assert!(other.mBgRatio != 1. || other.mFgRatio != 0.);
|
||||
debug_assert!(other.mBgRatio != 0. || other.mFgRatio != 1.);
|
||||
GenericColor::Complex(
|
||||
convert_nscolor_to_rgba(other.mColor),
|
||||
ComplexColorRatios {
|
||||
GenericColor::Complex {
|
||||
color: convert_nscolor_to_rgba(other.mColor),
|
||||
ratios: ComplexColorRatios {
|
||||
bg: other.mBgRatio,
|
||||
fg: other.mFgRatio,
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
Tag::eAuto => unreachable!("Unsupport StyleComplexColor with tag eAuto"),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue