mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Make computed types hold Percentage instead of bare CSSFloat
This commit is contained in:
parent
4b633c8637
commit
608e7f71a2
22 changed files with 140 additions and 110 deletions
|
@ -105,7 +105,7 @@ impl GeckoStyleCoordConvertible for LengthOrPercentage {
|
|||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
let value = match *self {
|
||||
LengthOrPercentage::Length(au) => CoordDataValue::Coord(au.0),
|
||||
LengthOrPercentage::Percentage(p) => CoordDataValue::Percent(p),
|
||||
LengthOrPercentage::Percentage(p) => CoordDataValue::Percent(p.0),
|
||||
LengthOrPercentage::Calc(calc) => CoordDataValue::Calc(calc.into()),
|
||||
};
|
||||
coord.set_value(value);
|
||||
|
@ -114,7 +114,7 @@ impl GeckoStyleCoordConvertible for LengthOrPercentage {
|
|||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
match coord.as_value() {
|
||||
CoordDataValue::Coord(coord) => Some(LengthOrPercentage::Length(Au(coord))),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentage::Percentage(p)),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentage::Percentage(Percentage(p))),
|
||||
CoordDataValue::Calc(calc) => Some(LengthOrPercentage::Calc(calc.into())),
|
||||
_ => None,
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ impl GeckoStyleCoordConvertible for LengthOrPercentageOrAuto {
|
|||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
let value = match *self {
|
||||
LengthOrPercentageOrAuto::Length(au) => CoordDataValue::Coord(au.0),
|
||||
LengthOrPercentageOrAuto::Percentage(p) => CoordDataValue::Percent(p),
|
||||
LengthOrPercentageOrAuto::Percentage(p) => CoordDataValue::Percent(p.0),
|
||||
LengthOrPercentageOrAuto::Auto => CoordDataValue::Auto,
|
||||
LengthOrPercentageOrAuto::Calc(calc) => CoordDataValue::Calc(calc.into()),
|
||||
};
|
||||
|
@ -148,7 +148,7 @@ impl GeckoStyleCoordConvertible for LengthOrPercentageOrAuto {
|
|||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
match coord.as_value() {
|
||||
CoordDataValue::Coord(coord) => Some(LengthOrPercentageOrAuto::Length(Au(coord))),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentageOrAuto::Percentage(p)),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentageOrAuto::Percentage(Percentage(p))),
|
||||
CoordDataValue::Auto => Some(LengthOrPercentageOrAuto::Auto),
|
||||
CoordDataValue::Calc(calc) => Some(LengthOrPercentageOrAuto::Calc(calc.into())),
|
||||
_ => None,
|
||||
|
@ -160,7 +160,7 @@ impl GeckoStyleCoordConvertible for LengthOrPercentageOrNone {
|
|||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
let value = match *self {
|
||||
LengthOrPercentageOrNone::Length(au) => CoordDataValue::Coord(au.0),
|
||||
LengthOrPercentageOrNone::Percentage(p) => CoordDataValue::Percent(p),
|
||||
LengthOrPercentageOrNone::Percentage(p) => CoordDataValue::Percent(p.0),
|
||||
LengthOrPercentageOrNone::None => CoordDataValue::None,
|
||||
LengthOrPercentageOrNone::Calc(calc) => CoordDataValue::Calc(calc.into()),
|
||||
};
|
||||
|
@ -170,7 +170,7 @@ impl GeckoStyleCoordConvertible for LengthOrPercentageOrNone {
|
|||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
match coord.as_value() {
|
||||
CoordDataValue::Coord(coord) => Some(LengthOrPercentageOrNone::Length(Au(coord))),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentageOrNone::Percentage(p)),
|
||||
CoordDataValue::Percent(p) => Some(LengthOrPercentageOrNone::Percentage(Percentage(p))),
|
||||
CoordDataValue::None => Some(LengthOrPercentageOrNone::None),
|
||||
CoordDataValue::Calc(calc) => Some(LengthOrPercentageOrNone::Calc(calc.into())),
|
||||
_ => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue