mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Use rust lengths for row-gap / column-gap.
Differential Revision: https://phabricator.services.mozilla.com/D26915
This commit is contained in:
parent
0f57b7b833
commit
0a84073767
8 changed files with 48 additions and 72 deletions
|
@ -18,7 +18,7 @@ use crate::values::generics::gecko::ScrollSnapPoint;
|
|||
use crate::values::generics::grid::{TrackBreadth, TrackKeyword};
|
||||
use crate::values::generics::length::LengthPercentageOrAuto;
|
||||
use crate::values::generics::{CounterStyleOrNone, NonNegative};
|
||||
use crate::values::{Auto, Either, None_, Normal};
|
||||
use crate::values::Either;
|
||||
use crate::{Atom, Zero};
|
||||
use app_units::Au;
|
||||
use cssparser::RGBA;
|
||||
|
@ -44,23 +44,6 @@ impl nsStyleCoord {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A: GeckoStyleCoordConvertible, B: GeckoStyleCoordConvertible> GeckoStyleCoordConvertible
|
||||
for Either<A, B>
|
||||
{
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match *self {
|
||||
Either::First(ref v) => v.to_gecko_style_coord(coord),
|
||||
Either::Second(ref v) => v.to_gecko_style_coord(coord),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
A::from_gecko_style_coord(coord)
|
||||
.map(Either::First)
|
||||
.or_else(|| B::from_gecko_style_coord(coord).map(Either::Second))
|
||||
}
|
||||
}
|
||||
|
||||
impl<Inner> GeckoStyleCoordConvertible for NonNegative<Inner>
|
||||
where
|
||||
Inner: GeckoStyleCoordConvertible,
|
||||
|
@ -265,48 +248,6 @@ impl GeckoStyleCoordConvertible for Angle {
|
|||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for Auto {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
coord.set_value(CoordDataValue::Auto)
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
if let CoordDataValue::Auto = coord.as_value() {
|
||||
Some(Auto)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for None_ {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
coord.set_value(CoordDataValue::None)
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
if let CoordDataValue::None = coord.as_value() {
|
||||
Some(None_)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for Normal {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
coord.set_value(CoordDataValue::Normal)
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
if let CoordDataValue::Normal = coord.as_value() {
|
||||
Some(Normal)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for ScrollSnapPoint<LengthPercentage> {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match self.repeated() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue