/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Specified types for counter properties.
#[cfg(feature = "servo")] usecrate::computed_values::list_style_type::T as ListStyleType; #[cfg(feature = "gecko")] usecrate::counter_style::CounterStyle; usecrate::parser::{Parse, ParserContext}; usecrate::values::generics::counters as generics; usecrate::values::generics::counters::CounterPair; usecrate::values::specified::image::Image; usecrate::values::specified::Attr; usecrate::values::specified::Integer; usecrate::values::CustomIdent; use cssparser::{Parser, Token}; use selectors::parser::SelectorParseErrorKind; use style_traits::{ParseError, StyleParseErrorKind};
letmut counters = Vec::new(); loop { let location = input.current_source_location(); let (name, is_reversed) = match input.next() {
Ok(&Token::Ident(ref ident)) => {
(CustomIdent::from_ident(location, ident, &["none"])?, false)
},
Ok(&Token::Function(ref name)) if counter_type == CounterType::Reset && name.eq_ignore_ascii_case("reversed") =>
{
input
.parse_nested_block(|input| Ok((CustomIdent::parse(input, &["none"])?, true)))?
},
Ok(t) => { let t = t.clone(); return Err(location.new_unexpected_token_error(t));
},
Err(_) => break,
};
let value = match input.try_parse(|input| Integer::parse(context, input)) {
Ok(start) => { if start.value == i32::min_value() { // The spec says that values must be clamped to the valid range, // and we reserve i32::min_value() as an internal magic value. // https://drafts.csswg.org/css-lists/#auto-numbering
Integer::new(i32::min_value() + 1)
} else {
start
}
},
_ => Integer::new(if is_reversed {
i32::min_value()
} else {
counter_type.default_value()
}),
};
counters.push(CounterPair {
name,
value,
is_reversed,
});
}
if !counters.is_empty() {
Ok(counters)
} else {
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}
}
/// The specified value for the `content` property. pubtype Content = generics::GenericContent<Image>;
/// The specified value for a content item in the `content` property. pubtype ContentItem = generics::GenericContentItem<Image>;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.