mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Move line-clamp out of mako and do some adjacent clean-up
No behavior change, but simplifies the following patch. Differential Revision: https://phabricator.services.mozilla.com/D155180
This commit is contained in:
parent
3fa76ff2e8
commit
a44db17432
12 changed files with 101 additions and 99 deletions
|
@ -8,11 +8,10 @@ use crate::custom_properties::Name as CustomPropertyName;
|
|||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::properties::{LonghandId, PropertyDeclarationId};
|
||||
use crate::properties::{PropertyId, ShorthandId};
|
||||
use crate::values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use crate::values::generics::box_::Perspective as GenericPerspective;
|
||||
use crate::values::generics::box_::{GenericAnimationIterationCount, GenericPerspective, GenericLineClamp};
|
||||
use crate::values::generics::box_::{GenericContainIntrinsicSize, GenericVerticalAlign, VerticalAlignKeyword};
|
||||
use crate::values::specified::length::{LengthPercentage, NonNegativeLength};
|
||||
use crate::values::specified::{AllowQuirks, Number};
|
||||
use crate::values::specified::{AllowQuirks, Number, Integer};
|
||||
use crate::values::{CustomIdent, KeyframesName, TimelineName};
|
||||
use crate::Atom;
|
||||
use cssparser::Parser;
|
||||
|
@ -615,6 +614,9 @@ impl Debug for Display {
|
|||
/// A specified value for the `contain-intrinsic-size` property.
|
||||
pub type ContainIntrinsicSize = GenericContainIntrinsicSize<NonNegativeLength>;
|
||||
|
||||
/// A specified value for the `line-clamp` property.
|
||||
pub type LineClamp = GenericLineClamp<Integer>;
|
||||
|
||||
/// A specified value for the `vertical-align` property.
|
||||
pub type VerticalAlign = GenericVerticalAlign<LengthPercentage>;
|
||||
|
||||
|
@ -1443,6 +1445,21 @@ impl Parse for ContainIntrinsicSize {
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse for LineClamp {
|
||||
/// none | <positive-integer>
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(i) = input.try_parse(|i| crate::values::specified::PositiveInteger::parse(context, i))
|
||||
{
|
||||
return Ok(Self(i.0))
|
||||
}
|
||||
input.expect_ident_matching("none")?;
|
||||
Ok(Self::none())
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-contain-2/#content-visibility
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
|
|
|
@ -13,7 +13,7 @@ use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as Generic
|
|||
use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize};
|
||||
use super::generics::transform::IsParallelTo;
|
||||
use super::generics::{self, GreaterThanOrEqualToOne, NonNegative};
|
||||
use super::{CSSFloat, CSSInteger, Either, None_};
|
||||
use super::{CSSFloat, CSSInteger};
|
||||
use crate::context::QuirksMode;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::values::serialize_atom_identifier;
|
||||
|
@ -38,7 +38,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
|
|||
pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, AnimationTimeline, Contain, Display};
|
||||
pub use self::box_::{Appearance, BreakBetween, BreakWithin, ContainerName, ContainerType};
|
||||
pub use self::box_::{Clear, ContentVisibility, ContainIntrinsicSize, Float, Overflow, OverflowAnchor};
|
||||
pub use self::box_::{Clear, ContentVisibility, ContainIntrinsicSize, LineClamp, Float, Overflow, OverflowAnchor};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||
pub use self::box_::{ScrollAxis, ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
||||
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType, ScrollTimelineName};
|
||||
|
@ -708,9 +708,6 @@ impl Parse for PositiveInteger {
|
|||
}
|
||||
}
|
||||
|
||||
/// A specified positive `<integer>` value or `none`.
|
||||
pub type PositiveIntegerOrNone = Either<PositiveInteger, None_>;
|
||||
|
||||
/// The specified value of a grid `<track-breadth>`
|
||||
pub type TrackBreadth = GenericTrackBreadth<LengthPercentage>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue