Revert as many changes to selectors from upstream as possible (#31365)

This is part of the preparation for splitting stylo into a separate
crate. We have made various changes to selectors includings:

 1. Bumping the rust edition
 2. Fixing typos and updating links

In addition to reverting those changes, this PR pulls in some changes to
selectors we seem to have missed in the process of updates.
This commit is contained in:
Martin Robinson 2024-02-20 07:57:10 +01:00 committed by GitHub
parent b993518892
commit 2fa76916d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 58 additions and 69 deletions

View file

@ -5,19 +5,16 @@
use crate::parser::SelectorImpl;
use cssparser::ToCss;
use std::fmt;
#[cfg(feature = "shmem")]
use to_shmem_derive::ToShmem;
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
#[cfg_attr(feature = "shmem", shmem(no_bounds))]
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[shmem(no_bounds)]
pub struct AttrSelectorWithOptionalNamespace<Impl: SelectorImpl> {
#[cfg_attr(feature = "shmem", shmem(field_bound))]
#[shmem(field_bound)]
pub namespace: Option<NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>>,
#[cfg_attr(feature = "shmem", shmem(field_bound))]
#[shmem(field_bound)]
pub local_name: Impl::LocalName,
pub local_name_lower: Impl::LocalName,
#[cfg_attr(feature = "shmem", shmem(field_bound))]
#[shmem(field_bound)]
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
}
@ -30,8 +27,7 @@ impl<Impl: SelectorImpl> AttrSelectorWithOptionalNamespace<Impl> {
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
#[derive(Clone, Eq, PartialEq, ToShmem)]
pub enum NamespaceConstraint<NamespaceUrl> {
Any,
@ -39,8 +35,7 @@ pub enum NamespaceConstraint<NamespaceUrl> {
Specific(NamespaceUrl),
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
#[derive(Clone, Eq, PartialEq, ToShmem)]
pub enum ParsedAttrSelectorOperation<AttrValue> {
Exists,
WithValue {
@ -80,8 +75,7 @@ impl<AttrValue> AttrSelectorOperation<AttrValue> {
}
}
#[derive(Clone, Copy, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
#[derive(Clone, Copy, Eq, PartialEq, ToShmem)]
pub enum AttrSelectorOperator {
Equal,
Includes,
@ -146,8 +140,7 @@ impl AttrSelectorOperator {
/// The definition of whitespace per CSS Selectors Level 3 § 4.
pub static SELECTOR_WHITESPACE: &[char] = &[' ', '\t', '\n', '\r', '\x0C'];
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
pub enum ParsedCaseSensitivity {
/// 's' was specified.
ExplicitCaseSensitive,