Skip to content

Commit

Permalink
Rename BorderImageWidthSide to BorderImageSideWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jun 2, 2017
1 parent 7da94d0 commit e58f541
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions components/style/properties/gecko.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,17 +998,17 @@ fn static_assert() {
}

pub fn set_border_image_width(&mut self, v: longhands::border_image_width::computed_value::T) {
use values::generics::border::BorderImageWidthSide;
use values::generics::border::BorderImageSideWidth;

% for side in SIDES:
match v.${side.index} {
BorderImageWidthSide::Auto => {
BorderImageSideWidth::Auto => {
self.gecko.mBorderImageWidth.data_at_mut(${side.index}).set_value(CoordDataValue::Auto)
},
BorderImageWidthSide::Length(l) => {
BorderImageSideWidth::Length(l) => {
l.to_gecko_style_coord(&mut self.gecko.mBorderImageWidth.data_at_mut(${side.index}))
},
BorderImageWidthSide::Number(n) => {
BorderImageSideWidth::Number(n) => {
self.gecko.mBorderImageWidth.data_at_mut(${side.index}).set_value(CoordDataValue::Factor(n))
},
}
Expand Down
4 changes: 2 additions & 2 deletions components/style/properties/longhand/border.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
</%helpers:longhand>

${helpers.predefined_type("border-image-width", "BorderImageWidth",
initial_value="computed::BorderImageWidthSide::one().into()",
initial_specified_value="specified::BorderImageWidthSide::one().into()",
initial_value="computed::BorderImageSideWidth::one().into()",
initial_specified_value="specified::BorderImageSideWidth::one().into()",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width",
animation_value_type="none",
boxed=True)}
Expand Down
10 changes: 5 additions & 5 deletions components/style/values/computed/border.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
use values::computed::{Number, NumberOrPercentage};
use values::computed::length::LengthOrPercentage;
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
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;

/// A computed value for the `border-image-width` property.
pub type BorderImageWidth = Rect<BorderImageWidthSide>;
pub type BorderImageWidth = Rect<BorderImageSideWidth>;

/// A computed value for a single side of a `border-image-width` property.
pub type BorderImageWidthSide = GenericBorderImageWidthSide<LengthOrPercentage, Number>;
pub type BorderImageSideWidth = GenericBorderImageSideWidth<LengthOrPercentage, Number>;

/// A computed value for the `border-image-slice` property.
pub type BorderImageSlice = GenericBorderImageSlice<NumberOrPercentage>;
Expand All @@ -27,10 +27,10 @@ pub type BorderRadius = GenericBorderRadius<LengthOrPercentage>;
/// A computed value for the `border-*-radius` longhand properties.
pub type BorderCornerRadius = GenericBorderCornerRadius<LengthOrPercentage>;

impl BorderImageWidthSide {
impl BorderImageSideWidth {
/// Returns `1`.
#[inline]
pub fn one() -> Self {
GenericBorderImageWidthSide::Number(1.)
GenericBorderImageSideWidth::Number(1.)
}
}
2 changes: 1 addition & 1 deletion components/style/values/computed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use super::specified;
pub use app_units::Au;
pub use cssparser::Color as CSSColor;
pub use self::background::BackgroundSize;
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageWidthSide};
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderCornerRadius};
pub use self::image::{Gradient, GradientItem, ImageLayer, LineDirection, Image, ImageRect};
pub use self::rect::LengthOrNumberRect;
Expand Down
10 changes: 5 additions & 5 deletions components/style/values/generics/border.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use values::generics::rect::Rect;
/// A generic value for a single side of a `border-image-width` property.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
pub enum BorderImageWidthSide<LengthOrPercentage, Number> {
pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
/// `<length-or-percentage>`
Length(LengthOrPercentage),
/// `<number>`
Expand Down Expand Up @@ -52,16 +52,16 @@ pub struct BorderRadius<LengthOrPercentage> {
/// A generic value for `border-*-radius` longhand properties.
pub struct BorderCornerRadius<L>(pub Size2D<L>);

impl<L, N> ToCss for BorderImageWidthSide<L, N>
impl<L, N> ToCss for BorderImageSideWidth<L, N>
where L: ToCss, N: ToCss,
{
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write
{
match *self {
BorderImageWidthSide::Length(ref length) => length.to_css(dest),
BorderImageWidthSide::Number(ref number) => number.to_css(dest),
BorderImageWidthSide::Auto => dest.write_str("auto"),
BorderImageSideWidth::Length(ref length) => length.to_css(dest),
BorderImageSideWidth::Number(ref number) => number.to_css(dest),
BorderImageSideWidth::Auto => dest.write_str("auto"),
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions components/style/values/specified/border.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use std::fmt;
use style_traits::ToCss;
use values::computed::{Context, ToComputedValue};
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
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::{AllowQuirks, Number, NumberOrPercentage};
Expand All @@ -33,10 +33,10 @@ pub enum BorderSideWidth {
}

/// A specified value for the `border-image-width` property.
pub type BorderImageWidth = Rect<BorderImageWidthSide>;
pub type BorderImageWidth = Rect<BorderImageSideWidth>;

/// A specified value for a single side of a `border-image-width` property.
pub type BorderImageWidthSide = GenericBorderImageWidthSide<LengthOrPercentage, Number>;
pub type BorderImageSideWidth = GenericBorderImageSideWidth<LengthOrPercentage, Number>;

/// A specified value for the `border-image-slice` property.
pub type BorderImageSlice = GenericBorderImageSlice<NumberOrPercentage>;
Expand Down Expand Up @@ -106,26 +106,26 @@ impl ToComputedValue for BorderSideWidth {
}
}

impl BorderImageWidthSide {
impl BorderImageSideWidth {
/// Returns `1`.
#[inline]
pub fn one() -> Self {
GenericBorderImageWidthSide::Number(Number::new(1.))
GenericBorderImageSideWidth::Number(Number::new(1.))
}
}

impl Parse for BorderImageWidthSide {
impl Parse for BorderImageSideWidth {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if input.try(|i| i.expect_ident_matching("auto")).is_ok() {
return Ok(GenericBorderImageWidthSide::Auto);
return Ok(GenericBorderImageSideWidth::Auto);
}

if let Ok(len) = input.try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
return Ok(GenericBorderImageWidthSide::Length(len));
return Ok(GenericBorderImageSideWidth::Length(len));
}

let num = Number::parse_non_negative(context, input)?;
Ok(GenericBorderImageWidthSide::Number(num))
Ok(GenericBorderImageSideWidth::Number(num))
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/style/values/specified/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,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, BorderSideWidth};
pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth};
pub use self::color::Color;
pub use self::rect::LengthOrNumberRect;
pub use super::generics::grid::GridLine;
Expand Down

0 comments on commit e58f541

Please sign in to comment.