diff options
-rw-r--r-- | components/layout/text.rs | 2 | ||||
-rw-r--r-- | components/script/dom/element.rs | 2 | ||||
-rw-r--r-- | components/style/properties/longhand/border.mako.rs | 4 | ||||
-rw-r--r-- | components/style/properties/longhand/column.mako.rs | 12 | ||||
-rw-r--r-- | components/style/properties/longhand/inherited_text.mako.rs | 10 | ||||
-rw-r--r-- | components/style/properties/longhand/outline.mako.rs | 51 | ||||
-rw-r--r-- | components/style/properties/shorthand/border.mako.rs | 12 | ||||
-rw-r--r-- | components/style/values/specified/border.rs | 81 | ||||
-rw-r--r-- | components/style/values/specified/mod.rs | 89 | ||||
-rw-r--r-- | ports/geckolib/glue.rs | 10 | ||||
-rw-r--r-- | tests/unit/style/properties/serialization.rs | 35 | ||||
-rw-r--r-- | tests/unit/style/properties/viewport.rs | 6 | ||||
-rw-r--r-- | tests/wpt/metadata/cssom/serialize-values.html.ini | 9 |
13 files changed, 137 insertions, 186 deletions
diff --git a/components/layout/text.rs b/components/layout/text.rs index 481e2025201..10093f251b8 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -167,7 +167,7 @@ impl TextRunScanner { }; text_transform = inherited_text_style.text_transform; letter_spacing = inherited_text_style.letter_spacing; - word_spacing = inherited_text_style.word_spacing.value().cloned() + word_spacing = inherited_text_style.word_spacing.value() .map(|lop| lop.to_hash_key()) .unwrap_or((Au(0), NotNaN::new(0.0).unwrap())); text_rendering = inherited_text_style.text_rendering; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index d7f3b89ba2f..be708113def 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -646,7 +646,7 @@ impl LayoutElementHelpers for LayoutJS<Element> { }; if let Some(border) = border { - let width_value = specified::BorderWidth::from_length(specified::Length::from_px(border as f32)); + let width_value = specified::BorderSideWidth::Length(specified::Length::from_px(border as f32)); hints.push(from_declaration( shared_lock, PropertyDeclaration::BorderTopWidth(width_value.clone()))); diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index dccbb1edfa2..40aaffdc716 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -32,7 +32,9 @@ spec=maybe_logical_spec(side, "style"), animation_value_type="none", logical=side[1])} - ${helpers.predefined_type("border-%s-width" % side[0], "BorderWidth", "Au::from_px(3)", + ${helpers.predefined_type("border-%s-width" % side[0], + "BorderSideWidth", + "Au::from_px(3)", computed_type="::app_units::Au", alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width"), spec=maybe_logical_spec(side, "width"), diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index dee3bbef627..2c99a7f1dc3 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -40,11 +40,15 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", products="gecko", animation_value_type="discrete", spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")} -${helpers.predefined_type("column-rule-width", "BorderWidth", "Au::from_px(3)", - initial_specified_value="specified::BorderWidth::Medium", - products="gecko", computed_type="::app_units::Au", +${helpers.predefined_type("column-rule-width", + "BorderSideWidth", + "Au::from_px(3)", + initial_specified_value="specified::BorderSideWidth::Medium", + computed_type="::app_units::Au", + products="gecko", spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width", - animation_value_type="ComputedValue", extra_prefixes="moz")} + animation_value_type="ComputedValue", + extra_prefixes="moz")} // https://drafts.csswg.org/css-multicol-1/#crc ${helpers.predefined_type("column-rule-color", "CSSColor", diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 1aac10125e3..8b1dafb5cd4 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -872,13 +872,15 @@ ${helpers.predefined_type( ignored_when_colors_disabled=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")} -${helpers.predefined_type("-webkit-text-stroke-width", "BorderWidth", "Au::from_px(0)", - initial_specified_value="specified::BorderWidth::from_length(specified::Length::zero())", - computed_type="::app_units::Au", products="gecko", +${helpers.predefined_type("-webkit-text-stroke-width", + "BorderSideWidth", + "Au::from_px(0)", + initial_specified_value="specified::BorderSideWidth::Length(specified::Length::zero())", + computed_type="::app_units::Au", + products="gecko", spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width", animation_value_type="none")} - // CSS Ruby Layout Module Level 1 // https://drafts.csswg.org/css-ruby/ ${helpers.single_keyword("ruby-align", "space-around start center space-between", diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs index 0cccccaf310..1640953e305 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -61,50 +61,13 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr } </%helpers:longhand> -<%helpers:longhand name="outline-width" animation_value_type="ComputedValue" - spec="https://drafts.csswg.org/css-ui/#propdef-outline-width"> - use std::fmt; - use style_traits::ToCss; - - impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - self.0.to_css(dest) - } - } - - pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> { - specified::parse_border_width(context, input).map(SpecifiedValue) - } - - #[derive(Clone, Debug, HasViewportPercentage, PartialEq)] - #[cfg_attr(feature = "servo", derive(HeapSizeOf))] - pub struct SpecifiedValue(pub specified::Length); - - pub mod computed_value { - use app_units::Au; - pub type T = Au; - } - - pub use super::border_top_width::get_initial_value; - #[inline] - pub fn get_initial_specified_value() -> SpecifiedValue { - SpecifiedValue(specified::Length::NoCalc(specified::NoCalcLength::medium())) - } - - impl ToComputedValue for SpecifiedValue { - type ComputedValue = computed_value::T; - - #[inline] - fn to_computed_value(&self, context: &Context) -> computed_value::T { - self.0.to_computed_value(context) - } - - #[inline] - fn from_computed_value(computed: &computed_value::T) -> Self { - SpecifiedValue(ToComputedValue::from_computed_value(computed)) - } - } -</%helpers:longhand> +${helpers.predefined_type("outline-width", + "BorderSideWidth", + "Au::from_px(3)", + initial_specified_value="specified::BorderSideWidth::Medium", + computed_type="::app_units::Au", + animation_value_type="ComputedValue", + spec="https://drafts.csswg.org/css-ui/#propdef-outline-width")} // The -moz-outline-radius-* properties are non-standard and not on a standards track. // TODO: Should they animate? diff --git a/components/style/properties/shorthand/border.mako.rs b/components/style/properties/shorthand/border.mako.rs index e2576891b06..c84549a544f 100644 --- a/components/style/properties/shorthand/border.mako.rs +++ b/components/style/properties/shorthand/border.mako.rs @@ -18,11 +18,11 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style", for side in PHYSICAL_SIDES)}" spec="https://drafts.csswg.org/css-backgrounds/#border-width"> use values::generics::rect::Rect; - use values::specified::{AllowQuirks, BorderWidth}; + use values::specified::{AllowQuirks, BorderSideWidth}; pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> { let rect = Rect::parse_with(context, input, |_, i| { - BorderWidth::parse_quirky(context, i, AllowQuirks::Yes) + BorderSideWidth::parse_quirky(context, i, AllowQuirks::Yes) })?; Ok(expanded! { border_top_width: rect.0, @@ -46,8 +46,8 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style", pub fn parse_border(context: &ParserContext, input: &mut Parser) -> Result<(specified::CSSColor, specified::BorderStyle, - specified::BorderWidth), ()> { - use values::specified::{CSSColor, BorderStyle, BorderWidth}; + specified::BorderSideWidth), ()> { + use values::specified::{CSSColor, BorderStyle, BorderSideWidth}; let _unused = context; let mut color = None; let mut style = None; @@ -69,7 +69,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser) } } if width.is_none() { - if let Ok(value) = input.try(|i| BorderWidth::parse(context, i)) { + if let Ok(value) = input.try(|i| BorderSideWidth::parse(context, i)) { width = Some(value); any = true; continue @@ -80,7 +80,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser) if any { Ok((color.unwrap_or_else(|| CSSColor::currentcolor()), style.unwrap_or(BorderStyle::none), - width.unwrap_or(BorderWidth::Medium))) + width.unwrap_or(BorderSideWidth::Medium))) } else { Err(()) } diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index 26b7974732f..741b6a1d94f 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -4,15 +4,33 @@ //! Specified types for CSS values related to borders. +use app_units::Au; use cssparser::Parser; use parser::{Parse, ParserContext}; +use std::fmt; +use style_traits::ToCss; +use values::computed::{Context, ToComputedValue}; use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius; use values::generics::border::BorderImageSlice as GenericBorderImageSlice; use values::generics::border::BorderImageWidthSide as GenericBorderImageWidthSide; use values::generics::border::BorderRadius as GenericBorderRadius; use values::generics::rect::Rect; -use values::specified::{Number, NumberOrPercentage}; -use values::specified::length::LengthOrPercentage; +use values::specified::{AllowQuirks, Number, NumberOrPercentage}; +use values::specified::length::{Length, LengthOrPercentage}; + +/// A specified value for a single side of the `border-width` property. +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +#[derive(Clone, Debug, HasViewportPercentage, PartialEq)] +pub enum BorderSideWidth { + /// `thin` + Thin, + /// `medium` + Medium, + /// `thick` + Thick, + /// `<length>` + Length(Length), +} /// A specified value for the `border-image-width` property. pub type BorderImageWidth = Rect<BorderImageWidthSide>; @@ -29,6 +47,65 @@ pub type BorderRadius = GenericBorderRadius<LengthOrPercentage>; /// A specified value for the `border-*-radius` longhand properties. pub type BorderCornerRadius = GenericBorderCornerRadius<LengthOrPercentage>; +impl BorderSideWidth { + /// Parses, with quirks. + pub fn parse_quirky( + context: &ParserContext, + input: &mut Parser, + allow_quirks: AllowQuirks) + -> Result<Self, ()> + { + if let Ok(length) = input.try(|i| Length::parse_non_negative_quirky(context, i, allow_quirks)) { + return Ok(BorderSideWidth::Length(length)); + } + match_ignore_ascii_case! { &input.expect_ident()?, + "thin" => Ok(BorderSideWidth::Thin), + "medium" => Ok(BorderSideWidth::Medium), + "thick" => Ok(BorderSideWidth::Thick), + _ => Err(()) + } + } +} + +impl Parse for BorderSideWidth { + fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { + Self::parse_quirky(context, input, AllowQuirks::No) + } +} + +impl ToCss for BorderSideWidth { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + match *self { + BorderSideWidth::Thin => dest.write_str("thin"), + BorderSideWidth::Medium => dest.write_str("medium"), + BorderSideWidth::Thick => dest.write_str("thick"), + BorderSideWidth::Length(ref length) => length.to_css(dest) + } + } +} + +impl ToComputedValue for BorderSideWidth { + type ComputedValue = Au; + + #[inline] + fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { + // We choose the pixel length of the keyword values the same as both spec and gecko. + // Spec: https://drafts.csswg.org/css-backgrounds-3/#line-width + // Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1312155#c0 + match *self { + BorderSideWidth::Thin => Length::from_px(1.).to_computed_value(context), + BorderSideWidth::Medium => Length::from_px(3.).to_computed_value(context), + BorderSideWidth::Thick => Length::from_px(5.).to_computed_value(context), + BorderSideWidth::Length(ref length) => length.to_computed_value(context) + } + } + + #[inline] + fn from_computed_value(computed: &Self::ComputedValue) -> Self { + BorderSideWidth::Length(ToComputedValue::from_computed_value(computed)) + } +} + impl BorderImageWidthSide { /// Returns `1`. #[inline] diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index c0bf1cdb3b7..893cbc4db4e 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -7,7 +7,6 @@ //! TODO(emilio): Enhance docs. use Namespace; -use app_units::Au; use context::QuirksMode; use cssparser::{self, Parser, Token, serialize_identifier}; use itoa; @@ -32,7 +31,7 @@ use values::specified::calc::CalcNode; pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems}; pub use self::background::BackgroundSize; pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; -pub use self::border::{BorderImageWidthSide, BorderRadius}; +pub use self::border::{BorderImageWidthSide, BorderRadius, BorderSideWidth}; pub use self::color::Color; pub use self::rect::LengthOrNumberRect; pub use super::generics::grid::GridLine; @@ -434,92 +433,6 @@ impl Angle { } } -#[allow(missing_docs)] -pub fn parse_border_width(context: &ParserContext, input: &mut Parser) -> Result<Length, ()> { - input.try(|i| Length::parse_non_negative(context, i)).or_else(|()| { - match_ignore_ascii_case! { &try!(input.expect_ident()), - "thin" => Ok(Length::from_px(1.)), - "medium" => Ok(Length::from_px(3.)), - "thick" => Ok(Length::from_px(5.)), - _ => Err(()) - } - }) -} - -#[derive(Clone, Debug, HasViewportPercentage, PartialEq)] -#[cfg_attr(feature = "servo", derive(HeapSizeOf))] -#[allow(missing_docs)] -pub enum BorderWidth { - Thin, - Medium, - Thick, - Width(Length), -} - -impl Parse for BorderWidth { - fn parse(context: &ParserContext, input: &mut Parser) -> Result<BorderWidth, ()> { - Self::parse_quirky(context, input, AllowQuirks::No) - } -} - -impl BorderWidth { - /// Parses a border width, allowing quirks. - pub fn parse_quirky(context: &ParserContext, - input: &mut Parser, - allow_quirks: AllowQuirks) - -> Result<BorderWidth, ()> { - match input.try(|i| Length::parse_non_negative_quirky(context, i, allow_quirks)) { - Ok(length) => Ok(BorderWidth::Width(length)), - Err(_) => match_ignore_ascii_case! { &try!(input.expect_ident()), - "thin" => Ok(BorderWidth::Thin), - "medium" => Ok(BorderWidth::Medium), - "thick" => Ok(BorderWidth::Thick), - _ => Err(()) - } - } - } -} - -impl BorderWidth { - #[allow(missing_docs)] - pub fn from_length(length: Length) -> Self { - BorderWidth::Width(length) - } -} - -impl ToCss for BorderWidth { - fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match *self { - BorderWidth::Thin => dest.write_str("thin"), - BorderWidth::Medium => dest.write_str("medium"), - BorderWidth::Thick => dest.write_str("thick"), - BorderWidth::Width(ref length) => length.to_css(dest) - } - } -} - -impl ToComputedValue for BorderWidth { - type ComputedValue = Au; - - #[inline] - fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { - // We choose the pixel length of the keyword values the same as both spec and gecko. - // Spec: https://drafts.csswg.org/css-backgrounds-3/#line-width - // Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1312155#c0 - match *self { - BorderWidth::Thin => Length::from_px(1.).to_computed_value(context), - BorderWidth::Medium => Length::from_px(3.).to_computed_value(context), - BorderWidth::Thick => Length::from_px(5.).to_computed_value(context), - BorderWidth::Width(ref length) => length.to_computed_value(context) - } - } - - #[inline] - fn from_computed_value(computed: &Self::ComputedValue) -> Self { - BorderWidth::Width(ToComputedValue::from_computed_value(computed)) - } -} - // The integer values here correspond to the border conflict resolution rules in CSS 2.1 § // 17.6.2.1. Higher values override lower values. define_numbered_css_keyword_enum! { BorderStyle: diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index dbe09dec669..636b6a868a5 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1946,7 +1946,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations: use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing; use style::properties::longhands::height::SpecifiedValue as Height; use style::properties::longhands::width::SpecifiedValue as Width; - use style::values::specified::BorderWidth; + use style::values::specified::BorderSideWidth; use style::values::specified::MozLength; use style::values::specified::length::{NoCalcLength, LengthOrPercentage}; @@ -1956,10 +1956,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations: let prop = match_wrap_declared! { long, Height => Height(MozLength::LengthOrPercentageOrAuto(nocalc.into())), Width => Width(MozLength::LengthOrPercentageOrAuto(nocalc.into())), - BorderTopWidth => BorderWidth::Width(nocalc.into()), - BorderRightWidth => BorderWidth::Width(nocalc.into()), - BorderBottomWidth => BorderWidth::Width(nocalc.into()), - BorderLeftWidth => BorderWidth::Width(nocalc.into()), + BorderTopWidth => BorderSideWidth::Length(nocalc.into()), + BorderRightWidth => BorderSideWidth::Length(nocalc.into()), + BorderBottomWidth => BorderSideWidth::Length(nocalc.into()), + BorderLeftWidth => BorderSideWidth::Length(nocalc.into()), MarginTop => nocalc.into(), MarginRight => nocalc.into(), MarginBottom => nocalc.into(), diff --git a/tests/unit/style/properties/serialization.rs b/tests/unit/style/properties/serialization.rs index cee52e5385f..e8009794a5a 100644 --- a/tests/unit/style/properties/serialization.rs +++ b/tests/unit/style/properties/serialization.rs @@ -9,7 +9,7 @@ use style::properties::longhands::outline_color::computed_value::T as ComputedCo use style::properties::parse_property_declaration_list; use style::values::{RGBA, Auto}; use style::values::CustomIdent; -use style::values::specified::{BorderStyle, BorderWidth, CSSColor, Length, LengthOrPercentage}; +use style::values::specified::{BorderStyle, BorderSideWidth, CSSColor, Length, LengthOrPercentage}; use style::values::specified::{LengthOrPercentageOrAuto, LengthOrPercentageOrAutoOrContent}; use style::values::specified::{NoCalcLength, PositionComponent}; use style::values::specified::position::Y; @@ -221,8 +221,8 @@ mod shorthand_serialization { properties.push(PropertyDeclaration::BorderBottomStyle(solid.clone())); properties.push(PropertyDeclaration::BorderLeftStyle(solid.clone())); - let px_30 = BorderWidth::from_length(Length::from_px(30f32)); - let px_10 = BorderWidth::from_length(Length::from_px(10f32)); + let px_30 = BorderSideWidth::Length(Length::from_px(30f32)); + let px_10 = BorderSideWidth::Length(Length::from_px(10f32)); properties.push(PropertyDeclaration::BorderTopWidth(px_30.clone())); properties.push(PropertyDeclaration::BorderRightWidth(px_30.clone())); @@ -255,7 +255,7 @@ mod shorthand_serialization { properties.push(PropertyDeclaration::BorderBottomStyle(solid.clone())); properties.push(PropertyDeclaration::BorderLeftStyle(solid.clone())); - let px_30 = BorderWidth::from_length(Length::from_px(30f32)); + let px_30 = BorderSideWidth::Length(Length::from_px(30f32)); properties.push(PropertyDeclaration::BorderTopWidth(px_30.clone())); properties.push(PropertyDeclaration::BorderRightWidth(px_30.clone())); @@ -295,11 +295,11 @@ mod shorthand_serialization { fn border_width_should_serialize_correctly() { let mut properties = Vec::new(); - let top_px = BorderWidth::from_length(Length::from_px(10f32)); - let bottom_px = BorderWidth::from_length(Length::from_px(10f32)); + let top_px = BorderSideWidth::Length(Length::from_px(10f32)); + let bottom_px = BorderSideWidth::Length(Length::from_px(10f32)); - let right_px = BorderWidth::from_length(Length::from_px(15f32)); - let left_px = BorderWidth::from_length(Length::from_px(15f32)); + let right_px = BorderSideWidth::Length(Length::from_px(15f32)); + let left_px = BorderSideWidth::Length(Length::from_px(15f32)); properties.push(PropertyDeclaration::BorderTopWidth(top_px)); properties.push(PropertyDeclaration::BorderRightWidth(right_px)); @@ -314,10 +314,10 @@ mod shorthand_serialization { fn border_width_with_keywords_should_serialize_correctly() { let mut properties = Vec::new(); - let top_px = BorderWidth::Thin; - let right_px = BorderWidth::Medium; - let bottom_px = BorderWidth::Thick; - let left_px = BorderWidth::from_length(Length::from_px(15f32)); + let top_px = BorderSideWidth::Thin; + let right_px = BorderSideWidth::Medium; + let bottom_px = BorderSideWidth::Thick; + let left_px = BorderSideWidth::Length(Length::from_px(15f32)); properties.push(PropertyDeclaration::BorderTopWidth(top_px)); properties.push(PropertyDeclaration::BorderRightWidth(right_px)); @@ -403,7 +403,7 @@ mod shorthand_serialization { fn directional_border_should_show_all_properties_when_values_are_set() { let mut properties = Vec::new(); - let width = BorderWidth::from_length(Length::from_px(4f32)); + let width = BorderSideWidth::Length(Length::from_px(4f32)); let style = BorderStyle::solid; let color = CSSColor { parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)), @@ -418,8 +418,8 @@ mod shorthand_serialization { assert_eq!(serialization, "border-top: 4px solid rgb(255, 0, 0);"); } - fn get_border_property_values() -> (BorderWidth, BorderStyle, CSSColor) { - (BorderWidth::from_length(Length::from_px(4f32)), + fn get_border_property_values() -> (BorderSideWidth, BorderStyle, CSSColor) { + (BorderSideWidth::Length(Length::from_px(4f32)), BorderStyle::solid, CSSColor::currentcolor()) } @@ -523,7 +523,6 @@ mod shorthand_serialization { } mod outline { - use style::properties::longhands::outline_width::SpecifiedValue as WidthContainer; use style::values::Either; use super::*; @@ -531,7 +530,7 @@ mod shorthand_serialization { fn outline_should_show_all_properties_when_set() { let mut properties = Vec::new(); - let width = WidthContainer(Length::from_px(4f32)); + let width = BorderSideWidth::Length(Length::from_px(4f32)); let style = Either::Second(BorderStyle::solid); let color = CSSColor { parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)), @@ -550,7 +549,7 @@ mod shorthand_serialization { fn outline_should_serialize_correctly_when_style_is_auto() { let mut properties = Vec::new(); - let width = WidthContainer(Length::from_px(4f32)); + let width = BorderSideWidth::Length(Length::from_px(4f32)); let style = Either::First(Auto); let color = CSSColor { parsed: ComputedColor::RGBA(RGBA::new(255, 0, 0, 255)), diff --git a/tests/unit/style/properties/viewport.rs b/tests/unit/style/properties/viewport.rs index ce4f879224e..205370da8f4 100644 --- a/tests/unit/style/properties/viewport.rs +++ b/tests/unit/style/properties/viewport.rs @@ -4,22 +4,22 @@ use app_units::Au; use style::properties::PropertyDeclaration; -use style::properties::longhands::border_top_width; use style::values::specified::{AbsoluteLength, Length, NoCalcLength, ViewportPercentageLength}; +use style::values::specified::border::BorderSideWidth; use style_traits::HasViewportPercentage; #[test] fn has_viewport_percentage_for_specified_value() { //TODO: test all specified value with a HasViewportPercentage impl let pvw = PropertyDeclaration::BorderTopWidth( - border_top_width::SpecifiedValue::from_length( + BorderSideWidth::Length( Length::NoCalc(NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.))) ) ); assert!(pvw.has_viewport_percentage()); let pabs = PropertyDeclaration::BorderTopWidth( - border_top_width::SpecifiedValue::from_length( + BorderSideWidth::Length( Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(Au(100).to_f32_px()))) ) ); diff --git a/tests/wpt/metadata/cssom/serialize-values.html.ini b/tests/wpt/metadata/cssom/serialize-values.html.ini index 720be83c21e..f4bf4377b00 100644 --- a/tests/wpt/metadata/cssom/serialize-values.html.ini +++ b/tests/wpt/metadata/cssom/serialize-values.html.ini @@ -45,15 +45,6 @@ [outline-color: invert] expected: FAIL - [outline-width: thin] - expected: FAIL - - [outline-width: medium] - expected: FAIL - - [outline-width: thick] - expected: FAIL - [page-break-after: auto] expected: FAIL |