From ab760033fdd480f644b372e45c679804c880ce67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 11 Jun 2018 16:24:26 -0700 Subject: [PATCH] style: Fix servo build. --- components/script/dom/cssstyledeclaration.rs | 4 +- .../helpers/animated_properties.mako.rs | 3 +- .../style/properties/longhand/box.mako.rs | 3 +- .../style/properties/properties.mako.rs | 41 ++++++++++--------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 43eac985c5e..e3a4a20d380 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -253,7 +253,7 @@ impl CSSStyleDeclaration { self.owner.mutate_associated_block(|pdb, changed| { if value.is_empty() { // Step 3 - *changed = pdb.remove_property(&id); + *changed = pdb.remove_property(&id, |_| {}); return Ok(()); } @@ -365,7 +365,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { let mut string = String::new(); self.owner.mutate_associated_block(|pdb, changed| { pdb.property_value_to_css(&id, &mut string).unwrap(); - *changed = pdb.remove_property(&id); + *changed = pdb.remove_property(&id, |_| {}); }); // Step 6 diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index acdaebef205..d935726eb48 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -31,10 +31,11 @@ use values::CSSFloat; use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; use values::animated::color::RGBA as AnimatedRGBA; use values::animated::effects::Filter as AnimatedFilter; +#[cfg(feature = "gecko")] use values::computed::TransitionProperty; use values::computed::{Angle, CalcLengthOrPercentage}; use values::computed::{ClipRect, Context}; use values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; -use values::computed::{LengthOrPercentageOrNone, MaxLength, TransitionProperty}; +use values::computed::{LengthOrPercentageOrNone, MaxLength}; use values::computed::{NonNegativeNumber, Number, NumberOrPercentage, Percentage}; use values::computed::length::NonNegativeLengthOrPercentage; use values::computed::ToComputedValue; diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 6c388d1efbd..898f7391de0 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -19,7 +19,8 @@ ${helpers.predefined_type( animation_value_type="discrete", flags="APPLIES_TO_PLACEHOLDER", spec="https://drafts.csswg.org/css-display/#propdef-display", - servo_restyle_damage="rebuild_and_reflow" + servo_restyle_damage="rebuild_and_reflow", + needs_context=product == "gecko" )} // FIXME(emilio): Listing all the display values here is very unfortunate, we should teach C++ to use the diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index cdebe662279..4d18e0ca634 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2501,6 +2501,7 @@ pub mod style_structs { /// Whether this is a multicol style. #[cfg(feature = "servo")] pub fn is_multicol(&self) -> bool { + use values::Either; match self.column_width { Either::First(_width) => true, Either::Second(_auto) => !self.column_count.is_auto(), @@ -2699,6 +2700,26 @@ impl ComputedValues { /// Get the initial computed values. pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES } + + /// Serializes the computed value of this property as a string. + pub fn computed_value_to_string(&self, property: PropertyDeclarationId) -> String { + match property { + PropertyDeclarationId::Longhand(id) => { + let mut s = String::new(); + self.get_longhand_property_value( + id, + &mut CssWriter::new(&mut s) + ).unwrap(); + s + } + PropertyDeclarationId::Custom(name) => { + self.custom_properties + .as_ref() + .and_then(|map| map.get(name)) + .map_or(String::new(), |value| value.to_css_string()) + } + } + } } #[cfg(feature = "servo")] @@ -2937,26 +2958,6 @@ impl ComputedValuesInner { // Neither perspective nor transform present false } - - /// Serializes the computed value of this property as a string. - pub fn computed_value_to_string(&self, property: PropertyDeclarationId) -> String { - match property { - PropertyDeclarationId::Longhand(id) => { - let mut s = String::new(); - self.get_longhand_property_value( - property, - &mut CssWriter::new(&mut s) - ).unwrap(); - s - } - PropertyDeclarationId::Custom(name) => { - self.custom_properties - .as_ref() - .and_then(|map| map.get(name)) - .map_or(String::new(), |value| value.to_css_string()) - } - } - } } % if product == "gecko":