mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Respect calc for percentages.
This commit is contained in:
parent
465e6f14fe
commit
310be02ba8
28 changed files with 308 additions and 176 deletions
|
@ -505,8 +505,11 @@ impl ToCss for Number {
|
|||
}
|
||||
}
|
||||
|
||||
/// <number-percentage>
|
||||
/// <number> | <percentage>
|
||||
///
|
||||
/// Accepts only non-negative numbers.
|
||||
///
|
||||
/// FIXME(emilio): Should probably use Either.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
|
@ -518,10 +521,11 @@ pub enum NumberOrPercentage {
|
|||
no_viewport_percentage!(NumberOrPercentage);
|
||||
|
||||
impl NumberOrPercentage {
|
||||
fn parse_with_clamping_mode<'i, 't>(context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
type_: AllowedNumericType)
|
||||
-> Result<Self, ParseError<'i>> {
|
||||
fn parse_with_clamping_mode<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
type_: AllowedNumericType
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(per) = input.try(|i| Percentage::parse_with_clamping_mode(context, i, type_)) {
|
||||
return Ok(NumberOrPercentage::Percentage(per));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue