From 0488a3d3d359ed23a2137550ff578163dccf20b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 20 Jan 2019 16:48:19 +0100 Subject: [PATCH 1/8] style: Implement the inset shorthand. Differential Revision: https://phabricator.services.mozilla.com/D16704 --- components/style/properties/shorthands/position.mako.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs index 561affe952c..ad00ba8eafd 100644 --- a/components/style/properties/shorthands/position.mako.rs +++ b/components/style/properties/shorthands/position.mako.rs @@ -763,6 +763,15 @@ } +// See https://github.com/w3c/csswg-drafts/issues/3525 for the quirks stuff. +${helpers.four_sides_shorthand( + "inset", + "%s", + "specified::LengthPercentageOrAuto::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-inset", + allow_quirks=False, +)} + % for axis in ["block", "inline"]: <% spec = "https://drafts.csswg.org/css-logical/#propdef-inset-%s" % axis From 624db3a0eb42a8d44ef783109e85c64655becdc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 21 Jan 2019 01:35:00 +0000 Subject: [PATCH 2/8] style: Remove layout.css.overflow.moz-scrollbars.enabled. We've been shipping it for a few releases already, see bug 1481125. Differential Revision: https://phabricator.services.mozilla.com/D17081 --- .../style/properties/shorthands/box.mako.rs | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/components/style/properties/shorthands/box.mako.rs b/components/style/properties/shorthands/box.mako.rs index 02763207cfa..3469d3f3fbb 100644 --- a/components/style/properties/shorthands/box.mako.rs +++ b/components/style/properties/shorthands/box.mako.rs @@ -11,47 +11,11 @@ spec="https://drafts.csswg.org/css-overflow/#propdef-overflow" > use crate::properties::longhands::overflow_x::parse as parse_overflow; - % if product == "gecko": - use crate::properties::longhands::overflow_x::SpecifiedValue; - % endif pub fn parse_value<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - % if product == "gecko": - use crate::gecko_bindings::structs; - let moz_kw_enabled = unsafe { - structs::StaticPrefs_sVarCache_layout_css_overflow_moz_scrollbars_enabled - }; - if moz_kw_enabled { - let moz_kw_found = input.try(|input| { - try_match_ident_ignore_ascii_case! { input, - "-moz-scrollbars-horizontal" => { - Ok(expanded! { - overflow_x: SpecifiedValue::Scroll, - overflow_y: SpecifiedValue::Hidden, - }) - } - "-moz-scrollbars-vertical" => { - Ok(expanded! { - overflow_x: SpecifiedValue::Hidden, - overflow_y: SpecifiedValue::Scroll, - }) - } - "-moz-scrollbars-none" => { - Ok(expanded! { - overflow_x: SpecifiedValue::Hidden, - overflow_y: SpecifiedValue::Hidden, - }) - } - } - }); - if moz_kw_found.is_ok() { - return moz_kw_found - } - } - % endif let overflow_x = parse_overflow(context, input)?; let overflow_y = input.try(|i| parse_overflow(context, i)).unwrap_or(overflow_x); From 137e735d9dedf7ac4967306a60903fa6251ad256 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 18 Jan 2019 12:32:22 -0800 Subject: [PATCH 3/8] style: Add a dependency on derive_more. Differential Revision: https://phabricator.services.mozilla.com/D17028 --- components/selectors/Cargo.toml | 1 + components/style/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/components/selectors/Cargo.toml b/components/selectors/Cargo.toml index b2437831b81..bb8e5d7f81b 100644 --- a/components/selectors/Cargo.toml +++ b/components/selectors/Cargo.toml @@ -23,6 +23,7 @@ bench = [] bitflags = "1.0" matches = "0.1" cssparser = "0.25" +derive_more = "0.13" log = "0.4" fxhash = "0.2" phf = "0.7.18" diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 11aa564bf05..86aaa8079a4 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -31,6 +31,7 @@ bitflags = "1.0" byteorder = "1.0" cssparser = "0.25" crossbeam-channel = { version = "0.3", optional = true } +derive_more = "0.13" new_debug_unreachable = "1.0" encoding_rs = {version = "0.8", optional = true} euclid = "0.19" From af1bbd7b06fa2114ee6f80abb39042b637c370f0 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 18 Jan 2019 12:39:29 -0800 Subject: [PATCH 4/8] style: Derive more. Differential Revision: https://phabricator.services.mozilla.com/D17029 --- components/selectors/builder.rs | 34 +------------------ components/selectors/lib.rs | 2 ++ components/style/context.rs | 16 +-------- components/style/driver.rs | 9 ++--- components/style/lib.rs | 2 ++ components/style/values/computed/angle.rs | 12 +------ components/style/values/distance.rs | 20 +---------- components/style/values/specified/svg_path.rs | 10 +----- 8 files changed, 14 insertions(+), 91 deletions(-) diff --git a/components/selectors/builder.rs b/components/selectors/builder.rs index e653af58fd5..80e8457cfc8 100644 --- a/components/selectors/builder.rs +++ b/components/selectors/builder.rs @@ -23,7 +23,6 @@ use servo_arc::{Arc, HeaderWithLength, ThinArc}; use smallvec::{self, SmallVec}; use std::cmp; use std::iter; -use std::ops::{Add, AddAssign}; use std::ptr; use std::slice; @@ -222,44 +221,13 @@ impl SpecificityAndFlags { const MAX_10BIT: u32 = (1u32 << 10) - 1; -#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] +#[derive(Add, AddAssign, Clone, Copy, Default, Eq, Ord, PartialEq, PartialOrd)] struct Specificity { id_selectors: u32, class_like_selectors: u32, element_selectors: u32, } -impl AddAssign for Specificity { - #[inline] - fn add_assign(&mut self, rhs: Self) { - self.id_selectors += rhs.id_selectors; - self.class_like_selectors += rhs.class_like_selectors; - self.element_selectors += rhs.element_selectors; - } -} - -impl Add for Specificity { - type Output = Specificity; - - fn add(self, rhs: Specificity) -> Specificity { - Specificity { - id_selectors: self.id_selectors + rhs.id_selectors, - class_like_selectors: self.class_like_selectors + rhs.class_like_selectors, - element_selectors: self.element_selectors + rhs.element_selectors, - } - } -} - -impl Default for Specificity { - fn default() -> Specificity { - Specificity { - id_selectors: 0, - class_like_selectors: 0, - element_selectors: 0, - } - } -} - impl From for Specificity { #[inline] fn from(value: u32) -> Specificity { diff --git a/components/selectors/lib.rs b/components/selectors/lib.rs index 02c34f4b7e7..1d9bf58edb3 100644 --- a/components/selectors/lib.rs +++ b/components/selectors/lib.rs @@ -9,6 +9,8 @@ extern crate bitflags; #[macro_use] extern crate cssparser; +#[macro_use] +extern crate derive_more; extern crate fxhash; #[macro_use] extern crate log; diff --git a/components/style/context.rs b/components/style/context.rs index aca1d24f2ea..0bb50217ef3 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -304,7 +304,7 @@ impl ElementCascadeInputs { /// Statistics gathered during the traversal. We gather statistics on each /// thread and then combine them after the threads join via the Add /// implementation below. -#[derive(Default)] +#[derive(AddAssign, Clone, Default)] pub struct PerThreadTraversalStatistics { /// The total number of elements traversed. pub elements_traversed: u32, @@ -319,20 +319,6 @@ pub struct PerThreadTraversalStatistics { pub styles_reused: u32, } -/// Implementation of Add to aggregate statistics across different threads. -impl<'a> ops::Add for &'a PerThreadTraversalStatistics { - type Output = PerThreadTraversalStatistics; - fn add(self, other: Self) -> PerThreadTraversalStatistics { - PerThreadTraversalStatistics { - elements_traversed: self.elements_traversed + other.elements_traversed, - elements_styled: self.elements_styled + other.elements_styled, - elements_matched: self.elements_matched + other.elements_matched, - styles_shared: self.styles_shared + other.styles_shared, - styles_reused: self.styles_reused + other.styles_reused, - } - } -} - /// Statistics gathered during the traversal plus some information from /// other sources including stylist. #[derive(Default)] diff --git a/components/style/driver.rs b/components/style/driver.rs index 0685264e6e6..e9433f73a03 100644 --- a/components/style/driver.rs +++ b/components/style/driver.rs @@ -161,10 +161,11 @@ pub fn traverse_dom( let parallel = maybe_tls.is_some(); if let Some(ref mut tls) = maybe_tls { let slots = unsafe { tls.unsafe_get() }; - aggregate = slots.iter().fold(aggregate, |acc, t| match *t.borrow() { - None => acc, - Some(ref cx) => &cx.statistics + &acc, - }); + for slot in slots { + if let Some(ref cx) = *slot.borrow() { + aggregate += cx.statistics.clone(); + } + } } if report_stats { diff --git a/components/style/lib.rs b/components/style/lib.rs index 79829081b39..4976c787a68 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -37,6 +37,8 @@ extern crate crossbeam_channel; #[macro_use] extern crate cssparser; #[macro_use] +extern crate derive_more; +#[macro_use] extern crate debug_unreachable; extern crate euclid; extern crate fallible; diff --git a/components/style/values/computed/angle.rs b/components/style/values/computed/angle.rs index 6b053a6f832..d30f02d7200 100644 --- a/components/style/values/computed/angle.rs +++ b/components/style/values/computed/angle.rs @@ -9,13 +9,12 @@ use crate::values::CSSFloat; use num_traits::Zero; use std::f64::consts::PI; use std::fmt::{self, Write}; -use std::ops::Add; use std::{f32, f64}; use style_traits::{CssWriter, ToCss}; /// A computed angle in degrees. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero)] +#[derive(Add, Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero)] pub struct Angle(CSSFloat); impl ToCss for Angle { @@ -66,15 +65,6 @@ impl Angle { } } -impl Add for Angle { - type Output = Self; - - #[inline] - fn add(self, rhs: Self) -> Self { - Angle(self.0 + rhs.0) - } -} - impl Zero for Angle { #[inline] fn zero() -> Self { diff --git a/components/style/values/distance.rs b/components/style/values/distance.rs index 320a09448dc..d3b4c7dfaad 100644 --- a/components/style/values/distance.rs +++ b/components/style/values/distance.rs @@ -31,7 +31,7 @@ pub trait ComputeSquaredDistance { } /// A distance between two animatable values. -#[derive(Clone, Copy, Debug)] +#[derive(Add, Clone, Copy, Debug, From)] pub struct SquaredDistance { value: f64, } @@ -114,24 +114,6 @@ impl SquaredDistance { } } -impl From for f64 { - #[inline] - fn from(distance: SquaredDistance) -> Self { - distance.value - } -} - -impl Add for SquaredDistance { - type Output = Self; - - #[inline] - fn add(self, rhs: Self) -> Self { - SquaredDistance { - value: self.value + rhs.value, - } - } -} - impl Sum for SquaredDistance { fn sum(iter: I) -> Self where diff --git a/components/style/values/specified/svg_path.rs b/components/style/values/specified/svg_path.rs index 7accbd96e84..86059c9ab2a 100644 --- a/components/style/values/specified/svg_path.rs +++ b/components/style/values/specified/svg_path.rs @@ -11,7 +11,6 @@ use crate::values::CSSFloat; use cssparser::Parser; use std::fmt::{self, Write}; use std::iter::{Cloned, Peekable}; -use std::ops::AddAssign; use std::slice; use style_traits::values::SequenceWriter; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; @@ -491,6 +490,7 @@ impl IsAbsolute { /// The path coord type. #[derive( + AddAssign, Animate, Clone, ComputeSquaredDistance, @@ -513,14 +513,6 @@ impl CoordPair { } } -impl AddAssign for CoordPair { - #[inline] - fn add_assign(&mut self, other: Self) { - self.0 += other.0; - self.1 += other.1; - } -} - /// The EllipticalArc flag type. #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] #[repr(C)] From 45a416b9969350a2ebf5b7fad9c16bc8442a7b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Jan 2019 17:38:55 +0100 Subject: [PATCH 5/8] style: Cleanup a few shorthand properties. Differential Revision: https://phabricator.services.mozilla.com/D17082 --- components/style/properties/helpers.mako.rs | 52 +++++++ .../style/properties/shorthands/box.mako.rs | 128 ++++-------------- .../properties/shorthands/margin.mako.rs | 68 +++------- .../properties/shorthands/padding.mako.rs | 66 +++------ .../properties/shorthands/position.mako.rs | 56 ++------ 5 files changed, 139 insertions(+), 231 deletions(-) diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 3cbc5a2a33d..59c9785292c 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -793,6 +793,58 @@ % endif +// A shorthand of kind ` ?` where both properties have +// the same type. +<%def name="two_properties_shorthand( + name, + first_property, + second_property, + parser_function, + needs_context=True, + **kwargs +)"> +<%call expr="self.shorthand(name, sub_properties=' '.join([first_property, second_property]), **kwargs)"> + #[allow(unused_imports)] + use crate::parser::Parse; + use crate::values::specified; + + pub fn parse_value<'i, 't>( + context: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { + let parse_one = |_c: &ParserContext, input: &mut Parser<'i, 't>| { + % if needs_context: + ${parser_function}(_c, input) + % else: + ${parser_function}(input) + % endif + }; + + let first = parse_one(context, input)?; + let second = + input.try(|input| parse_one(context, input)).unwrap_or_else(|_| first.clone()); + Ok(expanded! { + ${to_rust_ident(first_property)}: first, + ${to_rust_ident(second_property)}: second, + }) + } + + impl<'a> ToCss for LonghandsToSerialize<'a> { + fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { + let first = &self.${to_rust_ident(first_property)}; + let second = &self.${to_rust_ident(second_property)}; + + first.to_css(dest)?; + if first != second { + dest.write_str(" ")?; + second.to_css(dest)?; + } + Ok(()) + } + } + + + <%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, needs_context=True, allow_quirks=False, **kwargs)"> <% sub_properties=' '.join(sub_property_pattern % side for side in PHYSICAL_SIDES) %> diff --git a/components/style/properties/shorthands/box.mako.rs b/components/style/properties/shorthands/box.mako.rs index 3469d3f3fbb..0acb72b6bb9 100644 --- a/components/style/properties/shorthands/box.mako.rs +++ b/components/style/properties/shorthands/box.mako.rs @@ -4,76 +4,28 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> -<%helpers:shorthand - name="overflow" - flags="SHORTHAND_IN_GETCS" - sub_properties="overflow-x overflow-y" - spec="https://drafts.csswg.org/css-overflow/#propdef-overflow" -> - use crate::properties::longhands::overflow_x::parse as parse_overflow; +${helpers.two_properties_shorthand( + "overflow", + "overflow-x", + "overflow-y", + "specified::Overflow::parse", + flags="SHORTHAND_IN_GETCS", + needs_context=False, + spec="https://drafts.csswg.org/css-overflow/#propdef-overflow", +)} - pub fn parse_value<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let overflow_x = parse_overflow(context, input)?; - let overflow_y = - input.try(|i| parse_overflow(context, i)).unwrap_or(overflow_x); - Ok(expanded! { - overflow_x: overflow_x, - overflow_y: overflow_y, - }) - } - - impl<'a> ToCss for LonghandsToSerialize<'a> { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.overflow_x.to_css(dest)?; - if self.overflow_x != self.overflow_y { - dest.write_char(' ')?; - self.overflow_y.to_css(dest)?; - } - Ok(()) - } - } - - -<%helpers:shorthand - name="overflow-clip-box" - sub_properties="overflow-clip-box-block overflow-clip-box-inline" - enabled_in="ua" - gecko_pref="layout.css.overflow-clip-box.enabled" +${helpers.two_properties_shorthand( + "overflow-clip-box", + "overflow-clip-box-block", + "overflow-clip-box-inline", + "specified::OverflowClipBox::parse", + enabled_in="ua", + needs_context=False, + gecko_pref="layout.css.overflow-clip-box.enabled", spec="Internal, may be standardized in the future " - "(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)" - products="gecko" -> - use crate::values::specified::OverflowClipBox; - pub fn parse_value<'i, 't>( - _: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let block_value = OverflowClipBox::parse(input)?; - let inline_value = - input.try(|input| OverflowClipBox::parse(input)).unwrap_or(block_value); - - Ok(expanded! { - overflow_clip_box_block: block_value, - overflow_clip_box_inline: inline_value, - }) - } - - impl<'a> ToCss for LonghandsToSerialize<'a> { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.overflow_clip_box_block.to_css(dest)?; - - if self.overflow_clip_box_block != self.overflow_clip_box_inline { - dest.write_str(" ")?; - self.overflow_clip_box_inline.to_css(dest)?; - } - - Ok(()) - } - } - + "(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)", + products="gecko", +)} macro_rules! try_parse_one { ($context: expr, $input: expr, $var: ident, $prop_module: ident) => { @@ -381,36 +333,16 @@ macro_rules! try_parse_one { } -<%helpers:shorthand name="overscroll-behavior" products="gecko" - gecko_pref="layout.css.overscroll-behavior.enabled" - sub_properties="overscroll-behavior-x overscroll-behavior-y" - spec="https://wicg.github.io/overscroll-behavior/#overscroll-behavior-properties"> - pub fn parse_value<'i, 't>( - _: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - use crate::values::specified::OverscrollBehavior; - let behavior_x = OverscrollBehavior::parse(input)?; - let behavior_y = input.try(OverscrollBehavior::parse).unwrap_or(behavior_x); - Ok(expanded! { - overscroll_behavior_x: behavior_x, - overscroll_behavior_y: behavior_y, - }) - } - - impl<'a> ToCss for LonghandsToSerialize<'a> { - // Serializes into the single keyword value if both overscroll-behavior-x and overscroll-behavior-y are same. - // Otherwise into two values separated by a space. - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.overscroll_behavior_x.to_css(dest)?; - if self.overscroll_behavior_y != self.overscroll_behavior_x { - dest.write_str(" ")?; - self.overscroll_behavior_y.to_css(dest)?; - } - Ok(()) - } - } - +${helpers.two_properties_shorthand( + "overscroll-behavior", + "overscroll-behavior-x", + "overscroll-behavior-y", + "specified::OverscrollBehavior::parse", + needs_context=False, + products="gecko", + gecko_pref="layout.css.overscroll-behavior.enabled", + spec="https://wicg.github.io/overscroll-behavior/#overscroll-behavior-properties", +)} <%helpers:shorthand name="page-break-before" diff --git a/components/style/properties/shorthands/margin.mako.rs b/components/style/properties/shorthands/margin.mako.rs index 2eb920700e3..8ccd33ebf3b 100644 --- a/components/style/properties/shorthands/margin.mako.rs +++ b/components/style/properties/shorthands/margin.mako.rs @@ -4,51 +4,27 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> -${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthPercentageOrAuto::parse", - spec="https://drafts.csswg.org/css-box/#propdef-margin", - allowed_in_page_rule=True, - allow_quirks=True)} +${helpers.four_sides_shorthand( + "margin", + "margin-%s", + "specified::LengthPercentageOrAuto::parse", + spec="https://drafts.csswg.org/css-box/#propdef-margin", + allowed_in_page_rule=True, + allow_quirks=True, +)} -% for axis in ["block", "inline"]: - <% - spec = "https://drafts.csswg.org/css-logical/#propdef-margin-%s" % axis - %> - <%helpers:shorthand - name="margin-${axis}" - sub_properties="${' '.join( - 'margin-%s-%s' % (axis, side) - for side in ['start', 'end'] - )}" - spec="${spec}"> +${helpers.two_properties_shorthand( + "margin-block", + "margin-block-start", + "margin-block-end", + "specified::LengthPercentageOrAuto::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-margin-block" +)} - use crate::parser::Parse; - use crate::values::specified::length::LengthPercentageOrAuto; - pub fn parse_value<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let start_value = LengthPercentageOrAuto::parse(context, input)?; - let end_value = - input.try(|input| LengthPercentageOrAuto::parse(context, input)) - .unwrap_or_else(|_| start_value.clone()); - - Ok(expanded! { - margin_${axis}_start: start_value, - margin_${axis}_end: end_value, - }) - } - - impl<'a> ToCss for LonghandsToSerialize<'a> { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.margin_${axis}_start.to_css(dest)?; - - if self.margin_${axis}_end != self.margin_${axis}_start { - dest.write_str(" ")?; - self.margin_${axis}_end.to_css(dest)?; - } - - Ok(()) - } - } - -% endfor +${helpers.two_properties_shorthand( + "margin-inline", + "margin-inline-start", + "margin-inline-end", + "specified::LengthPercentageOrAuto::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-margin-inline" +)} diff --git a/components/style/properties/shorthands/padding.mako.rs b/components/style/properties/shorthands/padding.mako.rs index 5749029aa20..3efc0b4a153 100644 --- a/components/style/properties/shorthands/padding.mako.rs +++ b/components/style/properties/shorthands/padding.mako.rs @@ -4,50 +4,26 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> -${helpers.four_sides_shorthand("padding", "padding-%s", "specified::NonNegativeLengthPercentage::parse", - spec="https://drafts.csswg.org/css-box-3/#propdef-padding", - allow_quirks=True)} +${helpers.four_sides_shorthand( + "padding", + "padding-%s", + "specified::NonNegativeLengthPercentage::parse", + spec="https://drafts.csswg.org/css-box-3/#propdef-padding", + allow_quirks=True, +)} -% for axis in ["block", "inline"]: - <% - spec = "https://drafts.csswg.org/css-logical/#propdef-padding-%s" % axis - %> - <%helpers:shorthand - name="padding-${axis}" - sub_properties="${' '.join( - 'padding-%s-%s' % (axis, side) - for side in ['start', 'end'] - )}" - spec="${spec}"> +${helpers.two_properties_shorthand( + "padding-block", + "padding-block-start", + "padding-block-end", + "specified::NonNegativeLengthPercentage::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-padding-block" +)} - use crate::parser::Parse; - use crate::values::specified::length::NonNegativeLengthPercentage; - pub fn parse_value<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let start_value = NonNegativeLengthPercentage::parse(context, input)?; - let end_value = - input.try(|input| NonNegativeLengthPercentage::parse(context, input)) - .unwrap_or_else(|_| start_value.clone()); - - Ok(expanded! { - padding_${axis}_start: start_value, - padding_${axis}_end: end_value, - }) - } - - impl<'a> ToCss for LonghandsToSerialize<'a> { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.padding_${axis}_start.to_css(dest)?; - - if self.padding_${axis}_end != self.padding_${axis}_start { - dest.write_str(" ")?; - self.padding_${axis}_end.to_css(dest)?; - } - - Ok(()) - } - } - -% endfor +${helpers.two_properties_shorthand( + "padding-inline", + "padding-inline-start", + "padding-inline-end", + "specified::NonNegativeLengthPercentage::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-padding-inline" +)} diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs index ad00ba8eafd..aaf97a0674c 100644 --- a/components/style/properties/shorthands/position.mako.rs +++ b/components/style/properties/shorthands/position.mako.rs @@ -772,46 +772,18 @@ ${helpers.four_sides_shorthand( allow_quirks=False, )} -% for axis in ["block", "inline"]: - <% - spec = "https://drafts.csswg.org/css-logical/#propdef-inset-%s" % axis - %> - <%helpers:shorthand - name="inset-${axis}" - sub_properties="${' '.join( - 'inset-%s-%s' % (axis, side) - for side in ['start', 'end'] - )}" - spec="${spec}"> +${helpers.two_properties_shorthand( + "inset-block", + "inset-block-start", + "inset-block-end", + "specified::LengthPercentageOrAuto::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-inset-block" +)} - use crate::parser::Parse; - use crate::values::specified::length::LengthPercentageOrAuto; - pub fn parse_value<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let start_value = LengthPercentageOrAuto::parse(context, input)?; - let end_value = - input.try(|input| LengthPercentageOrAuto::parse(context, input)) - .unwrap_or_else(|_| start_value.clone()); - - Ok(expanded! { - inset_${axis}_start: start_value, - inset_${axis}_end: end_value, - }) - } - - impl<'a> ToCss for LonghandsToSerialize<'a> { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.inset_${axis}_start.to_css(dest)?; - - if self.inset_${axis}_end != self.inset_${axis}_start { - dest.write_str(" ")?; - self.inset_${axis}_end.to_css(dest)?; - } - - Ok(()) - } - } - -% endfor +${helpers.two_properties_shorthand( + "inset-inline", + "inset-inline-start", + "inset-inline-end", + "specified::LengthPercentageOrAuto::parse", + spec="https://drafts.csswg.org/css-logical/#propdef-inset-inline" +)} From 76ea22d50c502270b65697d5efb1fe732b125440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 28 Jan 2019 00:04:06 +0000 Subject: [PATCH 6/8] style: Simplify some conversion code used for mapped attributes. These days for the types we share computed value representation we don't really need any special code. Differential Revision: https://phabricator.services.mozilla.com/D17763 --- components/style/properties/longhands/border.mako.rs | 9 --------- components/style/values/computed/box.rs | 4 ++-- components/style/values/specified/border.rs | 1 + 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/components/style/properties/longhands/border.mako.rs b/components/style/properties/longhands/border.mako.rs index b9d3425f84a..c9d6b7f5e19 100644 --- a/components/style/properties/longhands/border.mako.rs +++ b/components/style/properties/longhands/border.mako.rs @@ -61,15 +61,6 @@ )} % endfor -${helpers.gecko_keyword_conversion( - Keyword('border-style', - "none solid double dotted dashed hidden groove ridge inset outset", - gecko_enum_prefix="StyleBorderStyle", - gecko_inexhaustive=True), - type="crate::values::specified::BorderStyle", -)} - -// FIXME(#4126): when gfx supports painting it, make this Size2D % for corner in ALL_CORNERS: <% corner_name = corner[0] diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 38d021d9829..3ce2e611a54 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -38,7 +38,7 @@ pub type Perspective = GenericPerspective; #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, )] #[repr(u8)] /// A computed value for the `float` property. @@ -97,7 +97,7 @@ impl ToComputedValue for SpecifiedFloat { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, )] /// A computed value for the `clear` property. pub enum Clear { diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index c3f1dd6f4af..e16d37b4786 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -30,6 +30,7 @@ use style_traits::{CssWriter, ParseError, ToCss}; Copy, Debug, Eq, + FromPrimitive, MallocSizeOf, Ord, Parse, From 4d24dd2847622658de532fa1d5533e6178f2a9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 29 Jan 2019 02:53:55 +0100 Subject: [PATCH 7/8] style: Rustfmt recent changes. --- Cargo.lock | 78 ++++++++++++++++++------- components/style/values/computed/box.rs | 24 +++++++- 2 files changed, 80 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 74faaeff413..1d9d0451c24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,7 +227,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -811,7 +811,7 @@ dependencies = [ "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -825,7 +825,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -847,7 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "ident_case 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -904,6 +904,17 @@ dependencies = [ "deny_public_fields 0.0.1", ] +[[package]] +name = "derive_more" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "device" version = "0.0.1" @@ -994,7 +1005,7 @@ dependencies = [ name = "domobject_derive" version = "0.0.1" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1115,7 +1126,7 @@ name = "enum-iterator-derive" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1722,7 +1733,7 @@ name = "headers-derive" version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1780,7 +1791,7 @@ dependencies = [ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "markup5ever 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2026,7 +2037,7 @@ dependencies = [ name = "jstraceable_derive" version = "0.0.1" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2383,7 +2394,7 @@ name = "malloc_size_of_derive" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2766,7 +2777,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3056,7 +3067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "0.4.6" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3123,7 +3134,7 @@ name = "quote" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3271,6 +3282,14 @@ name = "rustc-demangle" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rusttype" version = "0.7.2" @@ -3491,6 +3510,7 @@ version = "0.21.0" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3502,6 +3522,19 @@ dependencies = [ "thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "1.0.80" @@ -3523,7 +3556,7 @@ name = "serde_derive" version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3744,7 +3777,7 @@ name = "servo_media_derive" version = "0.1.0" source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3949,7 +3982,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3976,6 +4009,7 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)", "fallible 0.0.1", @@ -4027,7 +4061,7 @@ name = "style_derive" version = "0.0.1" dependencies = [ "darling 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4084,7 +4118,7 @@ name = "syn" version = "0.15.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4094,7 +4128,7 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5014,6 +5048,7 @@ dependencies = [ "checksum darling_macro 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9973050ba46be2a2935a7b316147f41a808ac604b8f0fef6eba77fd47a89daeb" "checksum dbus 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d975a175aa2dced1a6cd410b89a1bf23918f301eab2b6f7c5e608291b757639" "checksum deflate 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebb02aaf4b775afc96684b8402510a338086974e38570a1f65bea8c202eb77a7" +"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871" "checksum device 0.0.1 (git+https://github.com/servo/devices)" = "" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" @@ -5194,7 +5229,7 @@ dependencies = [ "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -"checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" +"checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978" "checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" @@ -5214,11 +5249,14 @@ dependencies = [ "checksum rust-webvr 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9355af34c9a072f567d8f3a7e51ef170935b5bf22d8d0450f0e8c41da6df46a2" "checksum rust-webvr-api 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "712e22ba3c03a7075b40842ae91029a0ab96a81f95e97c0cf623800ec0cbac07" "checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rusttype 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8eb11f5b0a98c8eca2fb1483f42646d8c340e83e46ab416f8a063a0fd0eeb20" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" "checksum scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef399c8893e8cb7aa9696e895427fab3a6bf265977bb96e126f24ddd2cda85a" "checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "adb6e51a6b3696b301bc221d785f898b4457c619b51d7ce195a6d20baecb37b3" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 3ce2e611a54..46d3f93854e 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -38,7 +38,17 @@ pub type Perspective = GenericPerspective; #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, + Copy, + Debug, + Eq, + FromPrimitive, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, )] #[repr(u8)] /// A computed value for the `float` property. @@ -97,7 +107,17 @@ impl ToComputedValue for SpecifiedFloat { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, + Copy, + Debug, + Eq, + FromPrimitive, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, )] /// A computed value for the `clear` property. pub enum Clear { From 9909816c7689fc59b3b1e13d09504681ec58a875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 29 Jan 2019 03:17:24 +0100 Subject: [PATCH 8/8] style: sort extern crates and fix servo build. --- components/script/dom/webidls/CSSStyleDeclaration.webidl | 2 ++ components/style/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/script/dom/webidls/CSSStyleDeclaration.webidl b/components/script/dom/webidls/CSSStyleDeclaration.webidl index ef75f29501a..1908b908203 100644 --- a/components/script/dom/webidls/CSSStyleDeclaration.webidl +++ b/components/script/dom/webidls/CSSStyleDeclaration.webidl @@ -209,6 +209,8 @@ partial interface CSSStyleDeclaration { [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString filter; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString inset; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString lineHeight; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString line-height; diff --git a/components/style/lib.rs b/components/style/lib.rs index 4976c787a68..2ea20088ed0 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -37,9 +37,9 @@ extern crate crossbeam_channel; #[macro_use] extern crate cssparser; #[macro_use] -extern crate derive_more; -#[macro_use] extern crate debug_unreachable; +#[macro_use] +extern crate derive_more; extern crate euclid; extern crate fallible; extern crate fxhash;