aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-05-29 00:57:46 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-05-29 00:58:53 +0200
commit862fc4f88dc8d16a62fa40d1b8fa8e6de07a87f8 (patch)
tree4a2fe68a5a2b09d8397983209a967d914fda2ede
parentaf3ede418b47be9a9296107fddd8e1970c433cce (diff)
downloadservo-862fc4f88dc8d16a62fa40d1b8fa8e6de07a87f8.tar.gz
servo-862fc4f88dc8d16a62fa40d1b8fa8e6de07a87f8.zip
Rename BorderRadiusSize to BorderCornerSize
-rw-r--r--components/layout/model.rs4
-rw-r--r--components/style/gecko/conversions.rs6
-rw-r--r--components/style/properties/gecko.mako.rs4
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs8
-rw-r--r--components/style/properties/longhand/border.mako.rs2
-rw-r--r--components/style/properties/longhand/outline.mako.rs2
-rw-r--r--components/style/values/computed/border.rs4
-rw-r--r--components/style/values/computed/mod.rs2
-rw-r--r--components/style/values/generics/border.rs30
-rw-r--r--components/style/values/specified/border.rs14
-rw-r--r--components/style/values/specified/mod.rs4
-rw-r--r--tests/unit/style/properties/serialization.rs10
12 files changed, 45 insertions, 45 deletions
diff --git a/components/layout/model.rs b/components/layout/model.rs
index fc8402426d6..97fb5cbc43e 100644
--- a/components/layout/model.rs
+++ b/components/layout/model.rs
@@ -14,7 +14,7 @@ use std::fmt;
use style::computed_values::transform::ComputedMatrix;
use style::logical_geometry::{LogicalMargin, WritingMode};
use style::properties::ServoComputedValues;
-use style::values::computed::{BorderRadiusSize, LengthOrPercentageOrAuto};
+use style::values::computed::{BorderCornerRadius, LengthOrPercentageOrAuto};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone};
/// A collapsible margin. See CSS 2.1 § 8.3.1.
@@ -471,7 +471,7 @@ pub fn style_length(style_length: LengthOrPercentageOrAuto,
///
/// [1]: https://drafts.csswg.org/css-backgrounds-3/#border-radius
pub fn specified_border_radius(
- radius: BorderRadiusSize,
+ radius: BorderCornerRadius,
containing_size: Size2D<Au>)
-> Size2D<Au>
{
diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs
index d9c5f231fd1..9f222690404 100644
--- a/components/style/gecko/conversions.rs
+++ b/components/style/gecko/conversions.rs
@@ -363,7 +363,7 @@ pub mod basic_shape {
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use std::borrow::Borrow;
use values::computed::basic_shape::{BasicShape, ShapeRadius};
- use values::computed::border::{BorderRadius, BorderRadiusSize};
+ use values::computed::border::{BorderCornerRadius, BorderRadius};
use values::computed::length::LengthOrPercentage;
use values::computed::position;
use values::generics::basic_shape::{BasicShape as GenericBasicShape, InsetRect, Polygon};
@@ -436,7 +436,7 @@ pub mod basic_shape {
fn from(other: T) -> Self {
let other = other.borrow();
let get_corner = |index| {
- BorderRadiusSize::new(
+ BorderCornerRadius::new(
LengthOrPercentage::from_gecko_style_coord(&other.data_at(index))
.expect("<border-radius> should be a length, percentage, or calc value"),
LengthOrPercentage::from_gecko_style_coord(&other.data_at(index + 1))
@@ -457,7 +457,7 @@ pub mod basic_shape {
impl BorderRadius {
/// Set this `BorderRadius` into a given `nsStyleCoord`.
pub fn set_corners(&self, other: &mut nsStyleCorners) {
- let mut set_corner = |field: &BorderRadiusSize, index| {
+ let mut set_corner = |field: &BorderCornerRadius, index| {
field.0.width.to_gecko_style_coord(&mut other.data_at_mut(index));
field.0.height.to_gecko_style_coord(&mut other.data_at_mut(index + 1));
};
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs
index 1f6f16fa781..985d4fbef44 100644
--- a/components/style/properties/gecko.mako.rs
+++ b/components/style/properties/gecko.mako.rs
@@ -558,14 +558,14 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor {
% if need_clone:
#[allow(non_snake_case)]
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
- use values::computed::border::BorderRadiusSize;
+ use values::computed::border::BorderCornerRadius;
let width = GeckoStyleCoordConvertible::from_gecko_style_coord(
&self.gecko.${gecko_ffi_name}.data_at(${x_index}))
.expect("Failed to clone ${ident}");
let height = GeckoStyleCoordConvertible::from_gecko_style_coord(
&self.gecko.${gecko_ffi_name}.data_at(${y_index}))
.expect("Failed to clone ${ident}");
- BorderRadiusSize::new(width, height)
+ BorderCornerRadius::new(width, height)
}
% endif
</%def>
diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs
index 6d1946ab86e..d19a3099374 100644
--- a/components/style/properties/helpers/animated_properties.mako.rs
+++ b/components/style/properties/helpers/animated_properties.mako.rs
@@ -39,11 +39,11 @@ use super::ComputedValues;
use values::CSSFloat;
use values::{Auto, Either};
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
-use values::computed::{BorderRadiusSize, ClipRect};
+use values::computed::{BorderCornerRadius, ClipRect};
use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
use values::computed::{MaxLength, MozLength};
use values::computed::ToComputedValue;
-use values::generics::border::BorderRadiusSize as GenericBorderRadiusSize;
+use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
use values::generics::position as generic_position;
@@ -875,10 +875,10 @@ impl<T: Animatable + Copy> Animatable for Point2D<T> {
}
}
-impl Animatable for BorderRadiusSize {
+impl Animatable for BorderCornerRadius {
#[inline]
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
- self.0.add_weighted(&other.0, self_portion, other_portion).map(GenericBorderRadiusSize)
+ self.0.add_weighted(&other.0, self_portion, other_portion).map(GenericBorderCornerRadius)
}
#[inline]
diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs
index 37c1e4c0657..9ced7480176 100644
--- a/components/style/properties/longhand/border.mako.rs
+++ b/components/style/properties/longhand/border.mako.rs
@@ -46,7 +46,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
// FIXME(#4126): when gfx supports painting it, make this Size2D<LengthOrPercentage>
% for corner in ["top-left", "top-right", "bottom-right", "bottom-left"]:
- ${helpers.predefined_type("border-" + corner + "-radius", "BorderRadiusSize",
+ ${helpers.predefined_type("border-" + corner + "-radius", "BorderCornerRadius",
"computed::LengthOrPercentage::zero().into()",
"parse", extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner,
diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs
index f832b568436..e3896df6671 100644
--- a/components/style/properties/longhand/outline.mako.rs
+++ b/components/style/properties/longhand/outline.mako.rs
@@ -108,7 +108,7 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr
// The -moz-outline-radius-* properties are non-standard and not on a standards track.
// TODO: Should they animate?
% for corner in ["topleft", "topright", "bottomright", "bottomleft"]:
- ${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderRadiusSize",
+ ${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderCornerRadius",
"computed::LengthOrPercentage::zero().into()",
products="gecko",
boxed=True,
diff --git a/components/style/values/computed/border.rs b/components/style/values/computed/border.rs
index e5b1f9ef815..00408b302eb 100644
--- a/components/style/values/computed/border.rs
+++ b/components/style/values/computed/border.rs
@@ -6,10 +6,10 @@
use values::computed::{Number, NumberOrPercentage};
use values::computed::length::LengthOrPercentage;
+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::border::BorderRadiusSize as GenericBorderRadiusSize;
use values::generics::rect::Rect;
/// A computed value for the `border-image-width` property.
@@ -25,7 +25,7 @@ pub type BorderImageSlice = GenericBorderImageSlice<NumberOrPercentage>;
pub type BorderRadius = GenericBorderRadius<LengthOrPercentage>;
/// A computed value for the `border-*-radius` longhand properties.
-pub type BorderRadiusSize = GenericBorderRadiusSize<LengthOrPercentage>;
+pub type BorderCornerRadius = GenericBorderCornerRadius<LengthOrPercentage>;
impl BorderImageWidthSide {
/// Returns `1`.
diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs
index 82363498d76..1a295217438 100644
--- a/components/style/values/computed/mod.rs
+++ b/components/style/values/computed/mod.rs
@@ -25,7 +25,7 @@ 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::{BorderRadius, BorderRadiusSize};
+pub use self::border::{BorderRadius, BorderCornerRadius};
pub use self::image::{Gradient, GradientItem, ImageLayer, LineDirection, Image, ImageRect};
pub use self::rect::LengthOrNumberRect;
pub use super::{Auto, Either, None_};
diff --git a/components/style/values/generics/border.rs b/components/style/values/generics/border.rs
index 65780ea66d8..6bfc5234b3d 100644
--- a/components/style/values/generics/border.rs
+++ b/components/style/values/generics/border.rs
@@ -38,19 +38,19 @@ pub struct BorderImageSlice<NumberOrPercentage> {
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
pub struct BorderRadius<LengthOrPercentage> {
/// The top left radius.
- pub top_left: BorderRadiusSize<LengthOrPercentage>,
+ pub top_left: BorderCornerRadius<LengthOrPercentage>,
/// The top right radius.
- pub top_right: BorderRadiusSize<LengthOrPercentage>,
+ pub top_right: BorderCornerRadius<LengthOrPercentage>,
/// The bottom right radius.
- pub bottom_right: BorderRadiusSize<LengthOrPercentage>,
+ pub bottom_right: BorderCornerRadius<LengthOrPercentage>,
/// The bottom left radius.
- pub bottom_left: BorderRadiusSize<LengthOrPercentage>,
+ pub bottom_left: BorderCornerRadius<LengthOrPercentage>,
}
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
/// A generic value for `border-*-radius` longhand properties.
-pub struct BorderRadiusSize<L>(pub Size2D<L>);
+pub struct BorderCornerRadius<L>(pub Size2D<L>);
impl<L, N> ToCss for BorderImageWidthSide<L, N>
where L: ToCss, N: ToCss,
@@ -95,10 +95,10 @@ impl<N> ToCss for BorderImageSlice<N>
impl<L> BorderRadius<L> {
/// Returns a new `BorderRadius<L>`.
#[inline]
- pub fn new(tl: BorderRadiusSize<L>,
- tr: BorderRadiusSize<L>,
- br: BorderRadiusSize<L>,
- bl: BorderRadiusSize<L>)
+ pub fn new(tl: BorderCornerRadius<L>,
+ tr: BorderCornerRadius<L>,
+ br: BorderCornerRadius<L>,
+ bl: BorderCornerRadius<L>)
-> Self {
BorderRadius {
top_left: tl,
@@ -144,21 +144,21 @@ impl<L> ToCss for BorderRadius<L>
}
}
-impl<L> BorderRadiusSize<L> {
+impl<L> BorderCornerRadius<L> {
#[inline]
- /// Create a new `BorderRadiusSize` for an area of given width and height.
- pub fn new(width: L, height: L) -> BorderRadiusSize<L> {
- BorderRadiusSize(Size2D::new(width, height))
+ /// Create a new `BorderCornerRadius` for an area of given width and height.
+ pub fn new(width: L, height: L) -> BorderCornerRadius<L> {
+ BorderCornerRadius(Size2D::new(width, height))
}
}
-impl<L: Clone> From<L> for BorderRadiusSize<L> {
+impl<L: Clone> From<L> for BorderCornerRadius<L> {
fn from(radius: L) -> Self {
Self::new(radius.clone(), radius)
}
}
-impl<L> ToCss for BorderRadiusSize<L>
+impl<L> ToCss for BorderCornerRadius<L>
where L: ToCss,
{
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs
index b33a6fc9aa6..26b7974732f 100644
--- a/components/style/values/specified/border.rs
+++ b/components/style/values/specified/border.rs
@@ -6,10 +6,10 @@
use cssparser::Parser;
use parser::{Parse, ParserContext};
+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::border::BorderRadiusSize as GenericBorderRadiusSize;
use values::generics::rect::Rect;
use values::specified::{Number, NumberOrPercentage};
use values::specified::length::LengthOrPercentage;
@@ -27,7 +27,7 @@ pub type BorderImageSlice = GenericBorderImageSlice<NumberOrPercentage>;
pub type BorderRadius = GenericBorderRadius<LengthOrPercentage>;
/// A specified value for the `border-*-radius` longhand properties.
-pub type BorderRadiusSize = GenericBorderRadiusSize<LengthOrPercentage>;
+pub type BorderCornerRadius = GenericBorderCornerRadius<LengthOrPercentage>;
impl BorderImageWidthSide {
/// Returns `1`.
@@ -76,15 +76,15 @@ impl Parse for BorderRadius {
};
Ok(GenericBorderRadius {
- top_left: BorderRadiusSize::new(widths.0, heights.0),
- top_right: BorderRadiusSize::new(widths.1, heights.1),
- bottom_right: BorderRadiusSize::new(widths.2, heights.2),
- bottom_left: BorderRadiusSize::new(widths.3, heights.3),
+ top_left: BorderCornerRadius::new(widths.0, heights.0),
+ top_right: BorderCornerRadius::new(widths.1, heights.1),
+ bottom_right: BorderCornerRadius::new(widths.2, heights.2),
+ bottom_left: BorderCornerRadius::new(widths.3, heights.3),
})
}
}
-impl Parse for BorderRadiusSize {
+impl Parse for BorderCornerRadius {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
let first = LengthOrPercentage::parse_non_negative(context, input)?;
let second = input
diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs
index 07049bf4862..ecb36632c8a 100644
--- a/components/style/values/specified/mod.rs
+++ b/components/style/values/specified/mod.rs
@@ -29,8 +29,8 @@ use values::specified::calc::CalcNode;
#[cfg(feature = "gecko")]
pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems};
pub use self::background::BackgroundSize;
-pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageWidthSide};
-pub use self::border::{BorderRadius, BorderRadiusSize};
+pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
+pub use self::border::{BorderImageWidthSide, BorderRadius};
pub use self::color::Color;
pub use self::rect::LengthOrNumberRect;
pub use super::generics::grid::GridLine;
diff --git a/tests/unit/style/properties/serialization.rs b/tests/unit/style/properties/serialization.rs
index 46570f870a0..cee52e5385f 100644
--- a/tests/unit/style/properties/serialization.rs
+++ b/tests/unit/style/properties/serialization.rs
@@ -368,22 +368,22 @@ mod shorthand_serialization {
assert_eq!(serialization, "border-style: solid dotted;");
}
- use style::values::specified::BorderRadiusSize;
+ use style::values::specified::BorderCornerRadius;
use style::values::specified::length::Percentage;
#[test]
fn border_radius_should_serialize_correctly() {
let mut properties = Vec::new();
- properties.push(PropertyDeclaration::BorderTopLeftRadius(Box::new(BorderRadiusSize::new(
+ properties.push(PropertyDeclaration::BorderTopLeftRadius(Box::new(BorderCornerRadius::new(
Percentage(0.01).into(), Percentage(0.05).into()
))));
- properties.push(PropertyDeclaration::BorderTopRightRadius(Box::new(BorderRadiusSize::new(
+ properties.push(PropertyDeclaration::BorderTopRightRadius(Box::new(BorderCornerRadius::new(
Percentage(0.02).into(), Percentage(0.06).into()
))));
- properties.push(PropertyDeclaration::BorderBottomRightRadius(Box::new(BorderRadiusSize::new(
+ properties.push(PropertyDeclaration::BorderBottomRightRadius(Box::new(BorderCornerRadius::new(
Percentage(0.03).into(), Percentage(0.07).into()
))));
- properties.push(PropertyDeclaration::BorderBottomLeftRadius(Box::new(BorderRadiusSize::new(
+ properties.push(PropertyDeclaration::BorderBottomLeftRadius(Box::new(BorderCornerRadius::new(
Percentage(0.04).into(), Percentage(0.08).into()
))));