Bug 1542178 - Use ToResolvedValue for computed style serialization. r=heycam
☠☠ backed out by e0edc59f9158 ☠ ☠
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 10 Apr 2019 12:10:40 +0000
changeset 468778 152985a87c0153550cf118a9e7fcfcd0061ce645
parent 468777 7da7a8bc596a97e823c5837bad136ceba5db7ac4
child 468779 e5a602010961fe91c2a1dc635aa6c0810ecb77c3
push id112755
push userdvarga@mozilla.com
push dateWed, 10 Apr 2019 22:06:41 +0000
treeherdermozilla-inbound@606f85641d0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1542178
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542178 - Use ToResolvedValue for computed style serialization. r=heycam Differential Revision: https://phabricator.services.mozilla.com/D26784
servo/components/style/properties/properties.mako.rs
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -34,17 +34,17 @@ use crate::properties::longhands::system
 use crate::selector_parser::PseudoElement;
 use selectors::parser::SelectorParseErrorKind;
 #[cfg(feature = "servo")] use servo_config::prefs;
 use style_traits::{CssWriter, KeywordsCollectFn, ParseError, ParsingMode};
 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;
 use crate::Zero;
 use self::computed_value_flags::*;
 use crate::str::{CssString, CssStringBorrow, CssStringWriter};
 use std::cell::Cell;
 
@@ -2807,29 +2807,29 @@ impl ComputedValues {
     pub fn get_longhand_property_value<W>(
         &self,
         property_id: LonghandId,
         dest: &mut CssWriter<W>
     ) -> fmt::Result
     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
         }
     }
 
     /// Resolves the currentColor keyword.
     ///
     /// Any color value from computed values (except for the 'color' property