style: Fix servo build.

This commit is contained in:
Emilio Cobos Álvarez 2018-06-11 16:24:26 -07:00
parent e94395b523
commit ab760033fd
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 27 additions and 24 deletions

View file

@ -253,7 +253,7 @@ impl CSSStyleDeclaration {
self.owner.mutate_associated_block(|pdb, changed| { self.owner.mutate_associated_block(|pdb, changed| {
if value.is_empty() { if value.is_empty() {
// Step 3 // Step 3
*changed = pdb.remove_property(&id); *changed = pdb.remove_property(&id, |_| {});
return Ok(()); return Ok(());
} }
@ -365,7 +365,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
let mut string = String::new(); let mut string = String::new();
self.owner.mutate_associated_block(|pdb, changed| { self.owner.mutate_associated_block(|pdb, changed| {
pdb.property_value_to_css(&id, &mut string).unwrap(); pdb.property_value_to_css(&id, &mut string).unwrap();
*changed = pdb.remove_property(&id); *changed = pdb.remove_property(&id, |_| {});
}); });
// Step 6 // Step 6

View file

@ -31,10 +31,11 @@ use values::CSSFloat;
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use values::animated::color::RGBA as AnimatedRGBA; use values::animated::color::RGBA as AnimatedRGBA;
use values::animated::effects::Filter as AnimatedFilter; use values::animated::effects::Filter as AnimatedFilter;
#[cfg(feature = "gecko")] use values::computed::TransitionProperty;
use values::computed::{Angle, CalcLengthOrPercentage}; use values::computed::{Angle, CalcLengthOrPercentage};
use values::computed::{ClipRect, Context}; use values::computed::{ClipRect, Context};
use values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; 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::{NonNegativeNumber, Number, NumberOrPercentage, Percentage};
use values::computed::length::NonNegativeLengthOrPercentage; use values::computed::length::NonNegativeLengthOrPercentage;
use values::computed::ToComputedValue; use values::computed::ToComputedValue;

View file

@ -19,7 +19,8 @@ ${helpers.predefined_type(
animation_value_type="discrete", animation_value_type="discrete",
flags="APPLIES_TO_PLACEHOLDER", flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-display/#propdef-display", 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 // FIXME(emilio): Listing all the display values here is very unfortunate, we should teach C++ to use the

View file

@ -2501,6 +2501,7 @@ pub mod style_structs {
/// Whether this is a multicol style. /// Whether this is a multicol style.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub fn is_multicol(&self) -> bool { pub fn is_multicol(&self) -> bool {
use values::Either;
match self.column_width { match self.column_width {
Either::First(_width) => true, Either::First(_width) => true,
Either::Second(_auto) => !self.column_count.is_auto(), Either::Second(_auto) => !self.column_count.is_auto(),
@ -2699,6 +2700,26 @@ impl ComputedValues {
/// Get the initial computed values. /// Get the initial computed values.
pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_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")] #[cfg(feature = "servo")]
@ -2937,26 +2958,6 @@ impl ComputedValuesInner {
// Neither perspective nor transform present // Neither perspective nor transform present
false 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": % if product == "gecko":