mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Rename LengthOrPercentage to LengthPercentage.
It does not represent `<length> | <percentage>`, but `<length-percentage>`, so `LengthOrPercentage` is not the right name. This patch is totally autogenerated using: rg 'LengthOrPercentage' servo | cut -d : -f 1 | sort | uniq > files for file in $(cat files); do sed -i "s#LengthOrPercentage#LengthPercentage#g" $file; done Differential Revision: https://phabricator.services.mozilla.com/D15812
This commit is contained in:
parent
4a31509215
commit
daf1f02feb
61 changed files with 709 additions and 702 deletions
|
@ -13,9 +13,9 @@ use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, Coor
|
|||
use crate::media_queries::Device;
|
||||
use crate::values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
|
||||
use crate::values::computed::FlexBasis as ComputedFlexBasis;
|
||||
use crate::values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage};
|
||||
use crate::values::computed::{LengthOrPercentageOrAuto, Percentage};
|
||||
use crate::values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
|
||||
use crate::values::computed::{Angle, ExtremumLength, Length, LengthPercentage};
|
||||
use crate::values::computed::{LengthPercentageOrAuto, Percentage};
|
||||
use crate::values::computed::{LengthPercentageOrNone, Number, NumberOrPercentage};
|
||||
use crate::values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength};
|
||||
use crate::values::generics::basic_shape::ShapeRadius;
|
||||
use crate::values::generics::box_::Perspective;
|
||||
|
@ -146,7 +146,7 @@ impl GeckoStyleCoordConvertible for NumberOrPercentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for LengthOrPercentage {
|
||||
impl GeckoStyleCoordConvertible for LengthPercentage {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
if self.was_calc {
|
||||
return coord.set_value(CoordDataValue::Calc((*self).into()))
|
||||
|
@ -160,8 +160,8 @@ impl GeckoStyleCoordConvertible for LengthOrPercentage {
|
|||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
match coord.as_value() {
|
||||
CoordDataValue::Coord(coord) => Some(LengthOrPercentage::new(Au(coord).into(), None)),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentage::new(Au(0).into(), Some(Percentage(p)))),
|
||||
CoordDataValue::Coord(coord) => Some(LengthPercentage::new(Au(coord).into(), None)),
|
||||
CoordDataValue::Percent(p) => Some(LengthPercentage::new(Au(0).into(), Some(Percentage(p)))),
|
||||
CoordDataValue::Calc(calc) => Some(calc.into()),
|
||||
_ => None,
|
||||
}
|
||||
|
@ -181,34 +181,34 @@ impl GeckoStyleCoordConvertible for Length {
|
|||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for LengthOrPercentageOrAuto {
|
||||
impl GeckoStyleCoordConvertible for LengthPercentageOrAuto {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match *self {
|
||||
LengthOrPercentageOrAuto::Auto => coord.set_value(CoordDataValue::Auto),
|
||||
LengthOrPercentageOrAuto::LengthOrPercentage(ref lop) => lop.to_gecko_style_coord(coord),
|
||||
LengthPercentageOrAuto::Auto => coord.set_value(CoordDataValue::Auto),
|
||||
LengthPercentageOrAuto::LengthPercentage(ref lop) => lop.to_gecko_style_coord(coord),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
match coord.as_value() {
|
||||
CoordDataValue::Auto => Some(LengthOrPercentageOrAuto::Auto),
|
||||
_ => LengthOrPercentage::from_gecko_style_coord(coord).map(LengthOrPercentageOrAuto::LengthOrPercentage),
|
||||
CoordDataValue::Auto => Some(LengthPercentageOrAuto::Auto),
|
||||
_ => LengthPercentage::from_gecko_style_coord(coord).map(LengthPercentageOrAuto::LengthPercentage),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for LengthOrPercentageOrNone {
|
||||
impl GeckoStyleCoordConvertible for LengthPercentageOrNone {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match *self {
|
||||
LengthOrPercentageOrNone::None => coord.set_value(CoordDataValue::None),
|
||||
LengthOrPercentageOrNone::LengthOrPercentage(ref lop) => lop.to_gecko_style_coord(coord),
|
||||
LengthPercentageOrNone::None => coord.set_value(CoordDataValue::None),
|
||||
LengthPercentageOrNone::LengthPercentage(ref lop) => lop.to_gecko_style_coord(coord),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
match coord.as_value() {
|
||||
CoordDataValue::None => Some(LengthOrPercentageOrNone::None),
|
||||
_ => LengthOrPercentage::from_gecko_style_coord(coord).map(LengthOrPercentageOrNone::LengthOrPercentage),
|
||||
CoordDataValue::None => Some(LengthPercentageOrNone::None),
|
||||
_ => LengthPercentage::from_gecko_style_coord(coord).map(LengthPercentageOrNone::LengthPercentage),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,14 +363,14 @@ impl GeckoStyleCoordConvertible for ExtremumLength {
|
|||
impl GeckoStyleCoordConvertible for ComputedMozLength {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match *self {
|
||||
MozLength::LengthOrPercentageOrAuto(ref lopoa) => lopoa.to_gecko_style_coord(coord),
|
||||
MozLength::LengthPercentageOrAuto(ref lopoa) => lopoa.to_gecko_style_coord(coord),
|
||||
MozLength::ExtremumLength(ref e) => e.to_gecko_style_coord(coord),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
LengthOrPercentageOrAuto::from_gecko_style_coord(coord)
|
||||
.map(MozLength::LengthOrPercentageOrAuto)
|
||||
LengthPercentageOrAuto::from_gecko_style_coord(coord)
|
||||
.map(MozLength::LengthPercentageOrAuto)
|
||||
.or_else(|| {
|
||||
ExtremumLength::from_gecko_style_coord(coord).map(MozLength::ExtremumLength)
|
||||
})
|
||||
|
@ -380,21 +380,21 @@ impl GeckoStyleCoordConvertible for ComputedMozLength {
|
|||
impl GeckoStyleCoordConvertible for ComputedMaxLength {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match *self {
|
||||
MaxLength::LengthOrPercentageOrNone(ref lopon) => lopon.to_gecko_style_coord(coord),
|
||||
MaxLength::LengthPercentageOrNone(ref lopon) => lopon.to_gecko_style_coord(coord),
|
||||
MaxLength::ExtremumLength(ref e) => e.to_gecko_style_coord(coord),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
LengthOrPercentageOrNone::from_gecko_style_coord(coord)
|
||||
.map(MaxLength::LengthOrPercentageOrNone)
|
||||
LengthPercentageOrNone::from_gecko_style_coord(coord)
|
||||
.map(MaxLength::LengthPercentageOrNone)
|
||||
.or_else(|| {
|
||||
ExtremumLength::from_gecko_style_coord(coord).map(MaxLength::ExtremumLength)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for ScrollSnapPoint<LengthOrPercentage> {
|
||||
impl GeckoStyleCoordConvertible for ScrollSnapPoint<LengthPercentage> {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match self.repeated() {
|
||||
None => coord.set_value(CoordDataValue::None),
|
||||
|
@ -409,8 +409,8 @@ impl GeckoStyleCoordConvertible for ScrollSnapPoint<LengthOrPercentage> {
|
|||
Some(match coord.unit() {
|
||||
nsStyleUnit::eStyleUnit_None => ScrollSnapPoint::None,
|
||||
_ => ScrollSnapPoint::Repeat(
|
||||
LengthOrPercentage::from_gecko_style_coord(coord)
|
||||
.expect("coord could not convert to LengthOrPercentage"),
|
||||
LengthPercentage::from_gecko_style_coord(coord)
|
||||
.expect("coord could not convert to LengthPercentage"),
|
||||
),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue