mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
Implement an nth-index cache.
MozReview-Commit-ID: Ee0um3QXkxl
This commit is contained in:
parent
29517d553e
commit
438740b912
13 changed files with 164 additions and 40 deletions
|
@ -8,11 +8,27 @@
|
|||
use attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
use matching::{ElementSelectorFlags, LocalMatchingContext, MatchingContext, RelevantLinkStatus};
|
||||
use parser::SelectorImpl;
|
||||
use servo_arc::NonZeroPtrMut;
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub trait Element: Sized + Debug {
|
||||
/// Opaque representation of an Element, for identity comparisons. We use
|
||||
/// NonZeroPtrMut to get the NonZero optimization.
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct OpaqueElement(pub NonZeroPtrMut<()>);
|
||||
|
||||
impl OpaqueElement {
|
||||
/// Creates a new OpaqueElement from an arbitrarily-typed pointer.
|
||||
pub fn new<T>(ptr: *const T) -> Self {
|
||||
OpaqueElement(NonZeroPtrMut::new(ptr as *const () as *mut ()))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Element: Sized + Clone + Debug {
|
||||
type Impl: SelectorImpl;
|
||||
|
||||
/// Converts self into an opaque representation.
|
||||
fn opaque(&self) -> OpaqueElement;
|
||||
|
||||
fn parent_element(&self) -> Option<Self>;
|
||||
|
||||
/// The parent of a given pseudo-element, after matching a pseudo-element
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue