servo: Merge #19371 - style: Don't insert into the `seen` set before ignoring document colors (from emilio:doc-colors); r=whoops
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 24 Nov 2017 19:10:00 -0600
changeset 438196 638260058fcc1fdca09f2c83e749fc773b4b919e
parent 438195 826766a15d6acdedb61209157f9febcfd142b75e
child 438197 d0c7f8a95402b8da3cdd7d784e6a776e0068afd7
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewerswhoops
milestone59.0a1
servo: Merge #19371 - style: Don't insert into the `seen` set before ignoring document colors (from emilio:doc-colors); r=whoops Otherwise we may stop honoring other colors in other cascade levels. Fixes: #19370 Source-Repo: https://github.com/servo/servo Source-Revision: 2377d60fa1deb56dcb5196e2206ef2b44ed296d5
servo/components/style/properties/properties.mako.rs
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -3325,17 +3325,16 @@ where
                 continue
             }
 
             <% maybe_to_physical = ".to_physical(writing_mode)" if category_to_cascade_now != "early" else "" %>
             let physical_longhand_id = longhand_id ${maybe_to_physical};
             if seen.contains(physical_longhand_id) {
                 continue
             }
-            seen.insert(physical_longhand_id);
 
             let mut declaration = match *declaration {
                 PropertyDeclaration::WithVariables(id, ref unparsed) => {
                     if !id.inherited() {
                         context.rule_cache_conditions.borrow_mut()
                             .set_uncacheable();
                     }
                     Cow::Owned(unparsed.substitute_variables(
@@ -3371,16 +3370,18 @@ where
                 // borrows being lexical.
                 if non_transparent_background {
                     let color = device.default_background_color();
                     declaration =
                         Cow::Owned(PropertyDeclaration::BackgroundColor(color.into()));
                 }
             }
 
+            seen.insert(physical_longhand_id);
+
             % if category_to_cascade_now == "early":
                 if LonghandId::FontSize == longhand_id {
                     font_size = Some(declaration.clone());
                     continue;
                 }
                 if LonghandId::FontFamily == longhand_id {
                     font_family = Some(declaration.clone());
                     continue;