mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Add support for parsing the contain-intrinsic-size
property from the CSS-sizing specification
Differential Revision: https://phabricator.services.mozilla.com/D151001
This commit is contained in:
parent
b0693b2f4d
commit
6fec9d6f8c
7 changed files with 101 additions and 3 deletions
|
@ -10,7 +10,7 @@ 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_::{GenericVerticalAlign, VerticalAlignKeyword};
|
||||
use crate::values::generics::box_::{GenericContainIntrinsicSize, GenericVerticalAlign, VerticalAlignKeyword};
|
||||
use crate::values::specified::length::{LengthPercentage, NonNegativeLength};
|
||||
use crate::values::specified::{AllowQuirks, Number};
|
||||
use crate::values::{CustomIdent, KeyframesName, TimelineName};
|
||||
|
@ -621,6 +621,9 @@ impl Debug for Display {
|
|||
}
|
||||
}
|
||||
|
||||
/// A specified value for the `contain-intrinsic-size` property.
|
||||
pub type ContainIntrinsicSize = GenericContainIntrinsicSize<NonNegativeLength>;
|
||||
|
||||
/// A specified value for the `vertical-align` property.
|
||||
pub type VerticalAlign = GenericVerticalAlign<LengthPercentage>;
|
||||
|
||||
|
@ -1427,6 +1430,28 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse for ContainIntrinsicSize {
|
||||
/// none | <length> | auto <length>
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
|
||||
if let Ok(l) = input.try_parse(|i| NonNegativeLength::parse(context, i))
|
||||
{
|
||||
return Ok(Self::Length(l));
|
||||
}
|
||||
|
||||
if input.try_parse(|i| i.expect_ident_matching("auto")).is_ok() {
|
||||
let l = NonNegativeLength::parse(context, input)?;
|
||||
return Ok(Self::AutoLength(l));
|
||||
}
|
||||
|
||||
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(
|
||||
|
|
|
@ -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, Float, Overflow, OverflowAnchor};
|
||||
pub use self::box_::{Clear, ContentVisibility, ContainIntrinsicSize, 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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue