mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Rename LengthOrPercentageOrAutoOrContent to FlexBasis
This commit is contained in:
parent
a568f7752f
commit
bc9bc1d340
11 changed files with 111 additions and 169 deletions
29
components/style/values/specified/flex.rs
Normal file
29
components/style/values/specified/flex.rs
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Specified types for CSS values related to flexbox.
|
||||
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use style_traits::ParseError;
|
||||
use values::generics::flex::FlexBasis as GenericFlexBasis;
|
||||
use values::specified::length::LengthOrPercentage;
|
||||
|
||||
/// A specified value for the `flex-basis` property.
|
||||
pub type FlexBasis = GenericFlexBasis<LengthOrPercentage>;
|
||||
|
||||
impl Parse for FlexBasis {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>)
|
||||
-> Result<Self, ParseError<'i>> {
|
||||
if let Ok(length) = input.try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
|
||||
return Ok(GenericFlexBasis::Length(length));
|
||||
}
|
||||
try_match_ident_ignore_ascii_case! { input.expect_ident()?,
|
||||
"auto" => Ok(GenericFlexBasis::Auto),
|
||||
"content" => Ok(GenericFlexBasis::Content),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue