Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-08-16 23:29:27 +02:00 committed by Martin Robinson
parent 1ce75ff7dd
commit 6c3f92cb85
27 changed files with 266 additions and 91 deletions

View file

@ -43,7 +43,6 @@ bitflags = "1.0"
byteorder = "1.0"
cssparser = "0.29"
derive_more = "0.99"
dom = { path = "../../../dom/base/rust" }
encoding_rs = { version = "0.8", optional = true }
euclid = "0.22"
fxhash = "0.2"

View file

@ -21,7 +21,6 @@ use crate::traversal_flags::TraversalFlags;
use crate::values::AtomIdent;
use crate::{LocalName, Namespace, WeakAtom};
use atomic_refcell::{AtomicRef, AtomicRefMut};
use dom::ElementState;
use selectors::matching::{QuirksMode, VisitedHandlingMode};
use selectors::sink::Push;
use selectors::Element as SelectorsElement;
@ -30,6 +29,7 @@ use std::fmt;
use std::fmt::Debug;
use std::hash::Hash;
use std::ops::Deref;
use style_traits::dom::ElementState;
pub use style_traits::dom::OpaqueNode;

View file

@ -10,8 +10,8 @@ use crate::invalidation::element::invalidator::{DescendantInvalidationLists, Inv
use crate::invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
use crate::invalidation::element::state_and_attributes;
use crate::stylist::CascadeData;
use dom::DocumentState;
use selectors::matching::{MatchingContext, MatchingMode, QuirksMode, VisitedHandlingMode, NeedsSelectorFlags};
use style_traits::dom::DocumentState;
/// A struct holding the members necessary to invalidate document state
/// selectors.

View file

@ -10,12 +10,12 @@ use crate::selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, Selecto
use crate::selector_parser::{Snapshot, SnapshotMap};
use crate::values::AtomIdent;
use crate::{CaseSensitivityExt, LocalName, Namespace, WeakAtom};
use dom::ElementState;
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::matching::{ElementSelectorFlags, MatchingContext};
use selectors::{Element, OpaqueElement};
use std::cell::Cell;
use std::fmt;
use style_traits::dom::ElementState;
/// In order to compute restyle hints, we perform a selector match against a
/// list of partial selectors whose rightmost simple selector may be sensitive

View file

@ -11,12 +11,12 @@ use crate::selector_map::{
use crate::selector_parser::SelectorImpl;
use crate::AllocErr;
use crate::{Atom, LocalName, Namespace, ShrinkIfNeeded};
use dom::{DocumentState, ElementState};
use selectors::attr::NamespaceConstraint;
use selectors::parser::{Combinator, Component};
use selectors::parser::{Selector, SelectorIter};
use selectors::visitor::SelectorVisitor;
use smallvec::SmallVec;
use style_traits::dom::{DocumentState, ElementState};
/// Mapping between (partial) CompoundSelectors (and the combinator to their
/// right) and the states and attributes they depend on.

View file

@ -17,11 +17,11 @@ use crate::selector_map::SelectorMap;
use crate::selector_parser::Snapshot;
use crate::stylesheets::origin::OriginSet;
use crate::{Atom, WeakAtom};
use dom::ElementState;
use selectors::attr::CaseSensitivity;
use selectors::matching::{matches_selector, MatchingContext, MatchingMode, VisitedHandlingMode, NeedsSelectorFlags};
use selectors::NthIndexCache;
use smallvec::SmallVec;
use style_traits::dom::ElementState;
/// The collector implementation.
struct Collector<'a, 'b: 'a, 'selectors: 'a, E>

View file

@ -10,10 +10,10 @@ use crate::stylesheets::{Namespaces, Origin, UrlExtraData};
use crate::values::serialize_atom_identifier;
use crate::Atom;
use cssparser::{Parser as CssParser, ParserInput};
use dom::ElementState;
use selectors::parser::SelectorList;
use std::fmt::{self, Debug, Write};
use style_traits::{CssWriter, ParseError, ToCss};
use style_traits::dom::ElementState;
/// A convenient alias for the type that represents an attribute value used for
/// selector parser implementation.

View file

@ -17,7 +17,7 @@ use crate::selector_parser::{PseudoElementCascadeType, SelectorParser};
use crate::values::{AtomIdent, AtomString};
use crate::{Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss};
use dom::{DocumentState, ElementState};
use style_traits::dom::{DocumentState, ElementState};
use fxhash::FxHashMap;
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::parser::SelectorParseErrorKind;
@ -367,20 +367,20 @@ impl NonTSPseudoClass {
pub fn state_flag(&self) -> ElementState {
use self::NonTSPseudoClass::*;
match *self {
Active => ElementState::IN_ACTIVE_STATE,
Focus => ElementState::IN_FOCUS_STATE,
Fullscreen => ElementState::IN_FULLSCREEN_STATE,
Hover => ElementState::IN_HOVER_STATE,
Defined => ElementState::IN_DEFINED_STATE,
Enabled => ElementState::IN_ENABLED_STATE,
Disabled => ElementState::IN_DISABLED_STATE,
Checked => ElementState::IN_CHECKED_STATE,
Valid => ElementState::IN_VALID_STATE,
Invalid => ElementState::IN_INVALID_STATE,
Indeterminate => ElementState::IN_INDETERMINATE_STATE,
ReadOnly | ReadWrite => ElementState::IN_READWRITE_STATE,
PlaceholderShown => ElementState::IN_PLACEHOLDER_SHOWN_STATE,
Target => ElementState::IN_TARGET_STATE,
Active => ElementState::ACTIVE,
Focus => ElementState::FOCUS,
Fullscreen => ElementState::FULLSCREEN,
Hover => ElementState::HOVER,
Defined => ElementState::DEFINED,
Enabled => ElementState::ENABLED,
Disabled => ElementState::DISABLED,
Checked => ElementState::CHECKED,
Valid => ElementState::VALID,
Invalid => ElementState::INVALID,
Indeterminate => ElementState::INDETERMINATE,
ReadOnly | ReadWrite => ElementState::READWRITE,
PlaceholderShown => ElementState::PLACEHOLDER_SHOWN,
Target => ElementState::URLTARGET,
AnyLink | Lang(_) | Link | Visited | ServoNonZeroBorder => ElementState::empty(),
}

View file

@ -41,7 +41,6 @@ use crate::stylesheets::{
use crate::stylesheets::{StyleRule, StylesheetContents, StylesheetInDocument};
use crate::AllocErr;
use crate::{Atom, LocalName, Namespace, ShrinkIfNeeded, WeakAtom};
use dom::{DocumentState, ElementState};
use fxhash::FxHashMap;
use malloc_size_of::{MallocSizeOf, MallocShallowSizeOf, MallocSizeOfOps};
#[cfg(feature = "gecko")]
@ -60,6 +59,7 @@ use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::sync::Mutex;
use std::{mem, ops};
use style_traits::dom::{DocumentState, ElementState};
use style_traits::viewport::ViewportConstraints;
/// The type of the stylesheets that the stylist contains.