mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
cargo fix --edition
This commit is contained in:
parent
e1fcffb336
commit
a15d33a10e
197 changed files with 1414 additions and 1380 deletions
|
@ -5,16 +5,16 @@
|
|||
//! CSS handling for the computed value of
|
||||
//! [grids](https://drafts.csswg.org/css-grid/)
|
||||
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::values::computed::{self, Context, ToComputedValue};
|
||||
use crate::values::generics::grid::{GridTemplateComponent, RepeatCount, TrackBreadth};
|
||||
use crate::values::generics::grid::{LineNameList, TrackKeyword, TrackRepeat, TrackSize};
|
||||
use crate::values::generics::grid::{TrackList, TrackListType, TrackListValue};
|
||||
use crate::values::specified::{Integer, LengthOrPercentage};
|
||||
use crate::values::{CSSFloat, CustomIdent};
|
||||
use cssparser::{ParseError as CssParseError, Parser, Token};
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::mem;
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use values::computed::{self, Context, ToComputedValue};
|
||||
use values::generics::grid::{GridTemplateComponent, RepeatCount, TrackBreadth};
|
||||
use values::generics::grid::{LineNameList, TrackKeyword, TrackRepeat, TrackSize};
|
||||
use values::generics::grid::{TrackList, TrackListType, TrackListValue};
|
||||
use values::specified::{Integer, LengthOrPercentage};
|
||||
use values::{CSSFloat, CustomIdent};
|
||||
|
||||
/// Parse a single flexible length.
|
||||
pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result<CSSFloat, ParseError<'i>> {
|
||||
|
@ -36,11 +36,11 @@ impl Parse for TrackBreadth<LengthOrPercentage> {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(lop) = input.try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
|
||||
if let Ok(lop) = input.r#try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
|
||||
return Ok(TrackBreadth::Breadth(lop));
|
||||
}
|
||||
|
||||
if let Ok(f) = input.try(parse_flex) {
|
||||
if let Ok(f) = input.r#try(parse_flex) {
|
||||
return Ok(TrackBreadth::Fr(f));
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,17 @@ impl Parse for TrackSize<LengthOrPercentage> {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(b) = input.try(|i| TrackBreadth::parse(context, i)) {
|
||||
if let Ok(b) = input.r#try(|i| TrackBreadth::parse(context, i)) {
|
||||
return Ok(TrackSize::Breadth(b));
|
||||
}
|
||||
|
||||
if input.try(|i| i.expect_function_matching("minmax")).is_ok() {
|
||||
if input
|
||||
.r#try(|i| i.expect_function_matching("minmax"))
|
||||
.is_ok()
|
||||
{
|
||||
return input.parse_nested_block(|input| {
|
||||
let inflexible_breadth =
|
||||
match input.try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
|
||||
match input.r#try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
|
||||
Ok(lop) => TrackBreadth::Breadth(lop),
|
||||
Err(..) => {
|
||||
let keyword = TrackKeyword::parse(input)?;
|
||||
|
@ -92,7 +95,7 @@ pub fn parse_line_names<'i, 't>(
|
|||
input.expect_square_bracket_block()?;
|
||||
input.parse_nested_block(|input| {
|
||||
let mut values = vec![];
|
||||
while let Ok((loc, ident)) = input.try(|i| -> Result<_, CssParseError<()>> {
|
||||
while let Ok((loc, ident)) = input.r#try(|i| -> Result<_, CssParseError<()>> {
|
||||
Ok((i.current_source_location(), i.expect_ident_cloned()?))
|
||||
}) {
|
||||
let ident = CustomIdent::from_ident(loc, &ident, &["span", "auto"])?;
|
||||
|
@ -123,7 +126,7 @@ impl TrackRepeat<LengthOrPercentage, Integer> {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<(Self, RepeatType), ParseError<'i>> {
|
||||
input
|
||||
.try(|i| i.expect_function_matching("repeat").map_err(|e| e.into()))
|
||||
.r#try(|i| i.expect_function_matching("repeat").map_err(|e| e.into()))
|
||||
.and_then(|_| {
|
||||
input.parse_nested_block(|input| {
|
||||
let count = RepeatCount::parse(context, input)?;
|
||||
|
@ -143,9 +146,9 @@ impl TrackRepeat<LengthOrPercentage, Integer> {
|
|||
|
||||
loop {
|
||||
current_names = input
|
||||
.try(parse_line_names)
|
||||
.r#try(parse_line_names)
|
||||
.unwrap_or(vec![].into_boxed_slice());
|
||||
if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) {
|
||||
if let Ok(track_size) = input.r#try(|i| TrackSize::parse(context, i)) {
|
||||
if !track_size.is_fixed() {
|
||||
if is_auto {
|
||||
// should be <fixed-size> for <auto-repeat>
|
||||
|
@ -169,7 +172,7 @@ impl TrackRepeat<LengthOrPercentage, Integer> {
|
|||
// gecko implements new spec.
|
||||
names.push(
|
||||
input
|
||||
.try(parse_line_names)
|
||||
.r#try(parse_line_names)
|
||||
.unwrap_or(vec![].into_boxed_slice()),
|
||||
);
|
||||
break;
|
||||
|
@ -223,10 +226,10 @@ impl Parse for TrackList<LengthOrPercentage, Integer> {
|
|||
loop {
|
||||
current_names.extend_from_slice(
|
||||
&mut input
|
||||
.try(parse_line_names)
|
||||
.r#try(parse_line_names)
|
||||
.unwrap_or(vec![].into_boxed_slice()),
|
||||
);
|
||||
if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) {
|
||||
if let Ok(track_size) = input.r#try(|i| TrackSize::parse(context, i)) {
|
||||
if !track_size.is_fixed() {
|
||||
atleast_one_not_fixed = true;
|
||||
if auto_repeat.is_some() {
|
||||
|
@ -239,7 +242,7 @@ impl Parse for TrackList<LengthOrPercentage, Integer> {
|
|||
names.push(vec.into_boxed_slice());
|
||||
values.push(TrackListValue::TrackSize(track_size));
|
||||
} else if let Ok((repeat, type_)) =
|
||||
input.try(|i| TrackRepeat::parse_with_repeat_type(context, i))
|
||||
input.r#try(|i| TrackRepeat::parse_with_repeat_type(context, i))
|
||||
{
|
||||
if list_type == TrackListType::Explicit {
|
||||
list_type = TrackListType::Normal; // <explicit-track-list> doesn't contain repeat()
|
||||
|
@ -401,7 +404,7 @@ impl Parse for GridTemplateComponent<LengthOrPercentage, Integer> {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
if input.r#try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(GridTemplateComponent::None);
|
||||
}
|
||||
|
||||
|
@ -416,7 +419,7 @@ impl GridTemplateComponent<LengthOrPercentage, Integer> {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if allow_grid_template_subgrids() {
|
||||
if let Ok(t) = input.try(|i| LineNameList::parse(context, i)) {
|
||||
if let Ok(t) = input.r#try(|i| LineNameList::parse(context, i)) {
|
||||
return Ok(GridTemplateComponent::Subgrid(t));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue