mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
parent
bf7c044955
commit
b85f1a0240
2 changed files with 19 additions and 0 deletions
|
@ -142,6 +142,7 @@ ${helpers.predefined_type("flex-basis",
|
|||
"LengthOrPercentageOrAutoOrContent",
|
||||
"computed::LengthOrPercentageOrAuto::Auto" if product == "gecko" else
|
||||
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
||||
"parse_non_negative_with_context",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
||||
extra_prefixes="webkit",
|
||||
animatable=True if product == "gecko" else False)}
|
||||
|
|
|
@ -1170,6 +1170,14 @@ impl LengthOrPercentageOrAuto {
|
|||
pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrPercentageOrAuto, ()> {
|
||||
LengthOrPercentageOrAuto::parse_internal(input, AllowedNumericType::NonNegative)
|
||||
}
|
||||
|
||||
/// Parse a non-negative length, percentage, or auto.
|
||||
#[inline]
|
||||
pub fn parse_non_negative_with_context(_context: &ParserContext,
|
||||
input: &mut Parser)
|
||||
-> Result<LengthOrPercentageOrAuto, ()> {
|
||||
LengthOrPercentageOrAuto::parse_non_negative(input)
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for LengthOrPercentageOrAuto {
|
||||
|
@ -1273,6 +1281,16 @@ pub enum LengthOrPercentageOrAutoOrContent {
|
|||
Content
|
||||
}
|
||||
|
||||
impl LengthOrPercentageOrAutoOrContent {
|
||||
/// Alias to `parse` so that Gecko and Servo can use the same method name for
|
||||
/// both `LengthOrPercentageOrAuto` and `LengthOrPercentageOrAutoOrContent`.
|
||||
///
|
||||
/// NOTE: `parse` already only accepts non-negative values.
|
||||
pub fn parse_non_negative_with_context(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
Self::parse(context, input)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasViewportPercentage for LengthOrPercentageOrAutoOrContent {
|
||||
fn has_viewport_percentage(&self) -> bool {
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue