mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Rename MozLength to Size, and MaxLength to MaxSize.
MozLength is not a very descriptive name. If we're going to use it in both Gecko and Servo we may as well name it something more accurate. I would've chosen `ContentSize` per CSS2[1][2] if it wasn't a lie in presence of box-sizing. I don't have better ideas than `Size`, given that. [1]: https://drafts.csswg.org/css2/visudet.html#propdef-width [2]: https://drafts.csswg.org/css2/box.html#content-width Differential Revision: https://phabricator.services.mozilla.com/D19280
This commit is contained in:
parent
7ed6b9d3ce
commit
c2819365f0
26 changed files with 280 additions and 333 deletions
|
@ -5,6 +5,7 @@
|
|||
//! Generic types for CSS values related to length.
|
||||
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::computed::ExtremumLength;
|
||||
use cssparser::Parser;
|
||||
use style_traits::ParseError;
|
||||
|
@ -76,7 +77,7 @@ impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>
|
|||
|
||||
/// A generic value for the `width`, `height`, `min-width`, or `min-height` property.
|
||||
///
|
||||
/// Unlike `max-width` or `max-height` properties, a MozLength can be `auto`,
|
||||
/// Unlike `max-width` or `max-height` properties, a Size can be `auto`,
|
||||
/// and cannot be `none`.
|
||||
///
|
||||
/// Note that it only accepts non-negative values.
|
||||
|
@ -95,18 +96,25 @@ impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>
|
|||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
pub enum MozLength<LengthPercentage> {
|
||||
pub enum Size<LengthPercentage> {
|
||||
LengthPercentage(LengthPercentage),
|
||||
Auto,
|
||||
#[cfg(feature = "gecko")]
|
||||
#[animation(error)]
|
||||
ExtremumLength(ExtremumLength),
|
||||
}
|
||||
|
||||
impl<LengthPercentage> MozLength<LengthPercentage> {
|
||||
impl<LengthPercentage> Size<LengthPercentage> {
|
||||
/// `auto` value.
|
||||
#[inline]
|
||||
pub fn auto() -> Self {
|
||||
MozLength::Auto
|
||||
Size::Auto
|
||||
}
|
||||
|
||||
/// Returns whether we're the auto value.
|
||||
#[inline]
|
||||
pub fn is_auto(&self) -> bool {
|
||||
matches!(*self, Size::Auto)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +134,7 @@ impl<LengthPercentage> MozLength<LengthPercentage> {
|
|||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
pub enum MaxLength<LengthPercentage> {
|
||||
pub enum MaxSize<LengthPercentage> {
|
||||
LengthPercentage(LengthPercentage),
|
||||
None,
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -134,10 +142,10 @@ pub enum MaxLength<LengthPercentage> {
|
|||
ExtremumLength(ExtremumLength),
|
||||
}
|
||||
|
||||
impl<LengthPercentage> MaxLength<LengthPercentage> {
|
||||
impl<LengthPercentage> MaxSize<LengthPercentage> {
|
||||
/// `none` value.
|
||||
#[inline]
|
||||
pub fn none() -> Self {
|
||||
MaxLength::None
|
||||
MaxSize::None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue