Bug 1542178 - Use ToResolvedValue for computed style serialization. r=heycam

Differential Revision: https://phabricator.services.mozilla.com/D26784

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-04-10 12:10:40 +00:00
Родитель 7ace3b8574
Коммит dc49b231ff
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -39,7 +39,7 @@ use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
use to_shmem::impl_trivial_to_shmem;
use crate::stylesheets::{CssRuleType, Origin, UrlExtraData};
use crate::values::generics::text::LineHeight;
use crate::values::computed;
use crate::values::{computed, resolved};
use crate::values::computed::NonNegativeLength;
use crate::values::serialize_atom_name;
use crate::rule_tree::StrongRuleNode;
@ -2812,19 +2812,19 @@ impl ComputedValues {
where
W: Write,
{
use crate::values::resolved::ToResolvedValue;
let context = resolved::Context {
style: self,
};
// TODO(emilio): Is it worth to merge branches here just like
// PropertyDeclaration::to_css does?
//
// We'd need to get a concept of ~resolved value, which may not be worth
// it.
match property_id {
% for prop in data.longhands:
LonghandId::${prop.camel_case} => {
let value = self.clone_${prop.ident}();
% if prop.predefined_type == "Color":
let value = self.resolve_color(value);
% endif
value.to_css(dest)
value.to_resolved_value(&context).to_css(dest)
}
% endfor
}