Skip to content

Commit 9196e9e

Browse files
committed
CSSIntegerWithInfinity to CSSInteger
1 parent 26e101e commit 9196e9e

6 files changed

Lines changed: 90 additions & 219 deletions

File tree

src/properties/align.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::prefixes::{is_flex_2009, Feature};
1111
use crate::printer::Printer;
1212
use crate::traits::{FromStandard, Parse, PropertyHandler, Shorthand, ToCss};
1313
use crate::values::length::LengthPercentage;
14+
use crate::values::number::CSSInteger;
1415
use crate::vendor_prefix::VendorPrefix;
1516
#[cfg(feature = "visitor")]
1617
use crate::visitor::Visit;

src/properties/flex.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::macros::*;
1111
use crate::prefixes::{is_flex_2009, Feature};
1212
use crate::printer::Printer;
1313
use crate::traits::{FromStandard, Parse, PropertyHandler, Shorthand, ToCss, Zero};
14-
use crate::values::number::{CSSIntegerWithInfinity, CSSNumber};
14+
use crate::values::number::{CSSInteger, CSSNumber};
1515
use crate::values::{
1616
length::{LengthPercentage, LengthPercentageOrAuto},
1717
percentage::Percentage,
@@ -350,15 +350,15 @@ impl FromStandard<FlexWrap> for BoxLines {
350350
}
351351
}
352352

353-
type BoxOrdinalGroup = CSSIntegerWithInfinity;
354-
impl FromStandard<CSSIntegerWithInfinity> for BoxOrdinalGroup {
355-
fn from_standard(order: &CSSIntegerWithInfinity) -> Option<BoxOrdinalGroup> {
353+
type BoxOrdinalGroup = CSSInteger;
354+
impl FromStandard<CSSInteger> for BoxOrdinalGroup {
355+
fn from_standard(order: &CSSInteger) -> Option<BoxOrdinalGroup> {
356356
Some(*order)
357357
}
358358
}
359359

360360
/// A value for the legacy (prefixed) [box-flex-group](https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#box-flex-group) property.
361-
pub type BoxFlexGroup = CSSIntegerWithInfinity;
361+
pub type BoxFlexGroup = CSSInteger;
362362

363363
// Old flex (2012): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/
364364

@@ -487,9 +487,9 @@ pub(crate) struct FlexHandler {
487487
flex_negative: Option<(CSSNumber, VendorPrefix)>,
488488
basis: Option<(LengthPercentageOrAuto, VendorPrefix)>,
489489
preferred_size: Option<(LengthPercentageOrAuto, VendorPrefix)>,
490-
order: Option<(CSSIntegerWithInfinity, VendorPrefix)>,
490+
order: Option<(CSSInteger, VendorPrefix)>,
491491
box_ordinal_group: Option<(BoxOrdinalGroup, VendorPrefix)>,
492-
flex_order: Option<(CSSIntegerWithInfinity, VendorPrefix)>,
492+
flex_order: Option<(CSSInteger, VendorPrefix)>,
493493
has_any: bool,
494494
}
495495

src/properties/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ use crate::prefixes::Feature;
129129
use crate::printer::{Printer, PrinterOptions};
130130
use crate::targets::Targets;
131131
use crate::traits::{Parse, ParseWithOptions, Shorthand, ToCss};
132-
use crate::values::number::{CSSIntegerWithInfinity, CSSNumber};
132+
use crate::values::number::{CSSInteger, CSSNumber};
133133
use crate::values::string::CowArcStr;
134134
use crate::values::{
135135
alpha::*, color::*, easing::EasingFunction, ident::DashedIdentReference, ident::NoneOrCustomIdentList, image::*,
@@ -1335,7 +1335,7 @@ define_properties! {
13351335
"flex-shrink": FlexShrink(CSSNumber, VendorPrefix) / WebKit,
13361336
"flex-basis": FlexBasis(LengthPercentageOrAuto, VendorPrefix) / WebKit,
13371337
"flex": Flex(Flex, VendorPrefix) / WebKit / Ms shorthand: true,
1338-
"order": Order(CSSIntegerWithInfinity, VendorPrefix) / WebKit,
1338+
"order": Order(CSSInteger, VendorPrefix) / WebKit,
13391339

13401340
// Align properties: https://www.w3.org/TR/2020/WD-css-align-3-20200421
13411341
"align-content": AlignContent(AlignContent, VendorPrefix) / WebKit,
@@ -1354,16 +1354,16 @@ define_properties! {
13541354
// Old flex (2009): https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/
13551355
"box-orient": BoxOrient(BoxOrient, VendorPrefix) / WebKit / Moz unprefixed: false,
13561356
"box-direction": BoxDirection(BoxDirection, VendorPrefix) / WebKit / Moz unprefixed: false,
1357-
"box-ordinal-group": BoxOrdinalGroup(CSSIntegerWithInfinity, VendorPrefix) / WebKit / Moz unprefixed: false,
1357+
"box-ordinal-group": BoxOrdinalGroup(CSSInteger, VendorPrefix) / WebKit / Moz unprefixed: false,
13581358
"box-align": BoxAlign(BoxAlign, VendorPrefix) / WebKit / Moz unprefixed: false,
13591359
"box-flex": BoxFlex(CSSNumber, VendorPrefix) / WebKit / Moz unprefixed: false,
1360-
"box-flex-group": BoxFlexGroup(CSSIntegerWithInfinity, VendorPrefix) / WebKit unprefixed: false,
1360+
"box-flex-group": BoxFlexGroup(CSSInteger, VendorPrefix) / WebKit unprefixed: false,
13611361
"box-pack": BoxPack(BoxPack, VendorPrefix) / WebKit / Moz unprefixed: false,
13621362
"box-lines": BoxLines(BoxLines, VendorPrefix) / WebKit / Moz unprefixed: false,
13631363

13641364
// Old flex (2012): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/
13651365
"flex-pack": FlexPack(FlexPack, VendorPrefix) / Ms unprefixed: false,
1366-
"flex-order": FlexOrder(CSSIntegerWithInfinity, VendorPrefix) / Ms unprefixed: false,
1366+
"flex-order": FlexOrder(CSSInteger, VendorPrefix) / Ms unprefixed: false,
13671367
"flex-align": FlexAlign(BoxAlign, VendorPrefix) / Ms unprefixed: false,
13681368
"flex-item-align": FlexItemAlign(FlexItemAlign, VendorPrefix) / Ms unprefixed: false,
13691369
"flex-line-pack": FlexLinePack(FlexLinePack, VendorPrefix) / Ms unprefixed: false,

src/properties/position.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::error::{ParserError, PrinterError};
77
use crate::prefixes::Feature;
88
use crate::printer::Printer;
99
use crate::traits::{Parse, PropertyHandler, ToCss};
10-
use crate::values::number::CSSIntegerWithInfinity;
10+
use crate::values::number::CSSInteger;
1111
use crate::vendor_prefix::VendorPrefix;
1212
#[cfg(feature = "visitor")]
1313
use crate::visitor::Visit;
@@ -86,7 +86,7 @@ pub enum ZIndex {
8686
/// The `auto` keyword.
8787
Auto,
8888
/// An integer value (supports infinity via calc()).
89-
Integer(CSSIntegerWithInfinity),
89+
Integer(CSSInteger),
9090
}
9191

9292
impl<'i> Parse<'i> for ZIndex {
@@ -95,8 +95,8 @@ impl<'i> Parse<'i> for ZIndex {
9595
return Ok(ZIndex::Auto);
9696
}
9797

98-
// Use CSSIntegerWithInfinity::parse which handles calc() and infinity
99-
let integer = CSSIntegerWithInfinity::parse(input)?;
98+
// Use CSSInteger::parse which handles calc() and infinity
99+
let integer = CSSInteger::parse(input)?;
100100
Ok(ZIndex::Integer(integer))
101101
}
102102
}

src/values/easing.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::values::number::{CSSInteger, CSSNumber};
77
#[cfg(feature = "visitor")]
88
use crate::visitor::Visit;
99
use cssparser::*;
10-
use std::fmt::Write;
1110

1211
/// A CSS [easing function](https://www.w3.org/TR/css-easing-1/#easing-functions).
1312
#[derive(Debug, Clone, PartialEq)]
@@ -172,7 +171,7 @@ impl ToCss for EasingFunction {
172171
} => dest.write_str("step-end"),
173172
EasingFunction::Steps { count, position } => {
174173
dest.write_str("steps(")?;
175-
write!(dest, "{}", count)?;
174+
count.to_css(dest)?;
176175
dest.delim(',', false)?;
177176
position.to_css(dest)?;
178177
dest.write_char(')')

0 commit comments

Comments
 (0)