mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Make use of predefined_type for some aliased types
This commit is contained in:
parent
61a17993eb
commit
63965f55f5
8 changed files with 81 additions and 174 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Computed values.
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::size::Size2D;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use media_queries::Device;
|
||||
|
@ -16,6 +15,7 @@ use super::generics::BorderRadiusSize as GenericBorderRadiusSize;
|
|||
use super::specified;
|
||||
use super::specified::grid::{TrackBreadth as GenericTrackBreadth, TrackSize as GenericTrackSize};
|
||||
|
||||
pub use app_units::Au;
|
||||
pub use cssparser::Color as CSSColor;
|
||||
pub use self::image::{AngleOrCorner, EndingShape as GradientShape, Gradient, GradientKind, Image, ImageRect};
|
||||
pub use self::image::{LengthOrKeyword, LengthOrPercentageOrKeyword};
|
||||
|
|
|
@ -59,7 +59,23 @@ pub type HorizontalPosition = GenericHorizontalPosition<LengthOrPercentage>;
|
|||
|
||||
impl Copy for HorizontalPosition {}
|
||||
|
||||
impl HorizontalPosition {
|
||||
#[inline]
|
||||
/// Create a zero position value.
|
||||
pub fn zero() -> HorizontalPosition {
|
||||
GenericHorizontalPosition(LengthOrPercentage::Percentage(0.0))
|
||||
}
|
||||
}
|
||||
|
||||
/// The computed value of a vertical `<position>`
|
||||
pub type VerticalPosition = GenericVerticalPosition<LengthOrPercentage>;
|
||||
|
||||
impl Copy for VerticalPosition {}
|
||||
|
||||
impl VerticalPosition {
|
||||
#[inline]
|
||||
/// Create a zero position value.
|
||||
pub fn zero() -> VerticalPosition {
|
||||
GenericVerticalPosition(LengthOrPercentage::Percentage(0.0))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,6 +219,18 @@ impl ToComputedValue for HorizontalPosition {
|
|||
}
|
||||
}
|
||||
|
||||
impl HorizontalPosition {
|
||||
#[inline]
|
||||
/// Initial specified value for vertical position (`top` keyword).
|
||||
pub fn left() -> HorizontalPosition {
|
||||
GenericHorizontalPosition(PositionValue {
|
||||
keyword: Some(Keyword::Left),
|
||||
position: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The specified value of vertical `<position>`
|
||||
pub type VerticalPosition = GenericVerticalPosition<PositionValue<LengthOrPercentage>>;
|
||||
|
||||
|
@ -238,3 +250,14 @@ impl ToComputedValue for VerticalPosition {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl VerticalPosition {
|
||||
#[inline]
|
||||
/// Initial specified value for vertical position (`top` keyword).
|
||||
pub fn top() -> VerticalPosition {
|
||||
GenericVerticalPosition(PositionValue {
|
||||
keyword: Some(Keyword::Top),
|
||||
position: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue