style: Define types for pseudo-class string argument storage.

This commit is contained in:
Cameron McCormack 2017-06-07 12:19:07 +08:00
parent 094052c544
commit e299905606
2 changed files with 8 additions and 2 deletions

View file

@ -24,6 +24,9 @@ bitflags! {
} }
} }
/// The type used for storing pseudo-class string arguments.
pub type PseudoClassStringArg = Box<[u16]>;
macro_rules! pseudo_class_name { macro_rules! pseudo_class_name {
(bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*], (bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*],
string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*], string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*],
@ -37,7 +40,7 @@ macro_rules! pseudo_class_name {
)* )*
$( $(
#[doc = $s_css] #[doc = $s_css]
$s_name(Box<[u16]>), $s_name(PseudoClassStringArg),
)* )*
$( $(
#[doc = $k_css] #[doc = $k_css]

View file

@ -160,6 +160,9 @@ impl PseudoElement {
} }
} }
/// The type used for storing pseudo-class string arguments.
pub type PseudoClassStringArg = Box<str>;
/// A non tree-structural pseudo-class. /// A non tree-structural pseudo-class.
/// See https://drafts.csswg.org/selectors-4/#structural-pseudos /// See https://drafts.csswg.org/selectors-4/#structural-pseudos
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
@ -175,7 +178,7 @@ pub enum NonTSPseudoClass {
Fullscreen, Fullscreen,
Hover, Hover,
Indeterminate, Indeterminate,
Lang(Box<str>), Lang(PseudoClassStringArg),
Link, Link,
PlaceholderShown, PlaceholderShown,
ReadWrite, ReadWrite,