mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Manually implement collect_completion_keywords for some types.
Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: 6T35uylxgho
This commit is contained in:
parent
0f7f9eebc0
commit
07de715bb5
7 changed files with 209 additions and 34 deletions
|
@ -8,7 +8,8 @@
|
|||
use counter_style::{parse_counter_style_name, Symbols};
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use style_traits::{KeywordsCollectFn, ParseError};
|
||||
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind};
|
||||
use super::CustomIdent;
|
||||
|
||||
pub mod background;
|
||||
|
@ -79,8 +80,7 @@ impl SymbolsType {
|
|||
/// Since wherever <counter-style> is used, 'none' is a valid value as
|
||||
/// well, we combine them into one type to make code simpler.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, SpecifiedValueInfo, ToComputedValue,
|
||||
ToCss)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum CounterStyleOrNone {
|
||||
/// `none`
|
||||
None,
|
||||
|
@ -138,6 +138,22 @@ impl Parse for CounterStyleOrNone {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for CounterStyleOrNone {
|
||||
fn collect_completion_keywords(f: KeywordsCollectFn) {
|
||||
// XXX The best approach for implementing this is probably
|
||||
// having a CounterStyleName type wrapping CustomIdent, and
|
||||
// put the predefined list for that type in counter_style mod.
|
||||
// But that's a non-trivial change itself, so we use a simpler
|
||||
// approach here.
|
||||
macro_rules! predefined {
|
||||
($($name:expr,)+) => {
|
||||
f(&["none", "symbols", $($name,)+]);
|
||||
}
|
||||
}
|
||||
include!("../../counter_style/predefined.rs");
|
||||
}
|
||||
}
|
||||
|
||||
/// A wrapper of Non-negative values.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue