style: Fix ToResolvedValue implementation for caret-color, and serialize some color properties with Servo.

Differential Revision: https://phabricator.services.mozilla.com/D26785
This commit is contained in:
Emilio Cobos Álvarez 2019-04-10 12:10:49 +00:00
parent 5fd4e17020
commit 0f57b7b833
3 changed files with 48 additions and 20 deletions

View file

@ -8,6 +8,9 @@
use cssparser;
use smallvec::SmallVec;
use crate::properties::ComputedValues;
mod color;
use crate::values::computed;
/// Information needed to resolve a given value.
@ -187,22 +190,3 @@ where
Vec::from_resolved_value(Vec::from(resolved)).into_boxed_slice()
}
}
/// A resolved color value is an rgba color, with currentcolor resolved.
pub type Color = cssparser::RGBA;
impl ToResolvedValue for computed::Color {
type ResolvedValue = Color;
#[inline]
fn to_resolved_value(self, context: &Context) -> Self::ResolvedValue {
context.style.resolve_color(self)
}
#[inline]
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self {
use crate::values::generics::color::Color as GenericColor;
GenericColor::Numeric(resolved)
}
}