зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #18894 - style: Remove the ElementExt trait (from emilio:bye-elementext); r=nox
It is likely it's the most useless trait ever existing. Source-Repo: https://github.com/servo/servo Source-Revision: 7d05c76d1828bc80e578c9b77f0c57b0e1afafc2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 7a3ba2d317d5a408030414318627442a31e66a89
This commit is contained in:
Родитель
edb0dd8898
Коммит
c32536d209
|
@ -20,8 +20,8 @@ use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
|
|||
#[cfg(feature = "gecko")] use properties::LonghandId;
|
||||
#[cfg(feature = "gecko")] use properties::animated_properties::AnimationValue;
|
||||
use rule_tree::CascadeLevel;
|
||||
use selector_parser::{AttrValue, ElementExt};
|
||||
use selector_parser::{PseudoClassStringArg, PseudoElement};
|
||||
use selector_parser::{AttrValue, PseudoClassStringArg, PseudoElement, SelectorImpl};
|
||||
use selectors::Element as SelectorsElement;
|
||||
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
||||
use selectors::sink::Push;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
|
@ -242,8 +242,17 @@ pub trait PresentationalHintsSynthesizer {
|
|||
}
|
||||
|
||||
/// The element trait, the main abstraction the style crate acts over.
|
||||
pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
||||
ElementExt + PresentationalHintsSynthesizer {
|
||||
pub trait TElement
|
||||
: Eq
|
||||
+ PartialEq
|
||||
+ Debug
|
||||
+ Hash
|
||||
+ Sized
|
||||
+ Copy
|
||||
+ Clone
|
||||
+ SelectorsElement<Impl = SelectorImpl>
|
||||
+ PresentationalHintsSynthesizer
|
||||
{
|
||||
/// The concrete node type.
|
||||
type ConcreteNode: TNode<ConcreteElement = Self>;
|
||||
|
||||
|
@ -263,6 +272,11 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
|||
/// font-size used for rem units.
|
||||
fn owner_doc_matches_for_testing(&self, _: &Device) -> bool { true }
|
||||
|
||||
/// Whether this element should match user and author rules.
|
||||
///
|
||||
/// We use this for Native Anonymous Content in Gecko.
|
||||
fn matches_user_and_author_rules(&self) -> bool { true }
|
||||
|
||||
/// Returns the depth of this element in the DOM.
|
||||
fn depth(&self) -> usize {
|
||||
let mut depth = 0;
|
||||
|
|
|
@ -75,7 +75,7 @@ use properties::animated_properties::{AnimationValue, AnimationValueMap};
|
|||
use properties::animated_properties::TransitionProperty;
|
||||
use properties::style_structs::Font;
|
||||
use rule_tree::CascadeLevel as ServoCascadeLevel;
|
||||
use selector_parser::{AttrValue, ElementExt, PseudoClassStringArg};
|
||||
use selector_parser::{AttrValue, PseudoClassStringArg};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
|
@ -1105,6 +1105,11 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
self.flags() & (NODE_IS_NATIVE_ANONYMOUS as u32) != 0
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn matches_user_and_author_rules(&self) -> bool {
|
||||
!self.is_in_native_anonymous_subtree()
|
||||
}
|
||||
|
||||
fn implemented_pseudo_element(&self) -> Option<PseudoElement> {
|
||||
if !self.is_native_anonymous() {
|
||||
return None;
|
||||
|
@ -2069,10 +2074,3 @@ impl<'a> NamespaceConstraintHelpers for NamespaceConstraint<&'a Namespace> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> ElementExt for GeckoElement<'le> {
|
||||
#[inline]
|
||||
fn matches_user_and_author_rules(&self) -> bool {
|
||||
!self.is_in_native_anonymous_subtree()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use cssparser::{Parser as CssParser, ParserInput};
|
||||
use selectors::Element;
|
||||
use selectors::parser::SelectorList;
|
||||
use std::fmt::{self, Debug};
|
||||
use style_traits::ParseError;
|
||||
|
@ -103,14 +102,6 @@ pub enum PseudoElementCascadeType {
|
|||
Precomputed,
|
||||
}
|
||||
|
||||
/// An extension to rust-selector's `Element` trait.
|
||||
pub trait ElementExt: Element<Impl=SelectorImpl> + Debug {
|
||||
/// Whether this element should match user and author rules.
|
||||
///
|
||||
/// We use this for Native Anonymous Content in Gecko.
|
||||
fn matches_user_and_author_rules(&self) -> bool;
|
||||
}
|
||||
|
||||
/// A per-functional-pseudo map, from a given pseudo to a `T`.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
|
|
@ -16,14 +16,12 @@ use invalidation::element::element_wrapper::ElementSnapshot;
|
|||
use properties::ComputedValues;
|
||||
use properties::PropertyFlags;
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, ElementExt, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::Element;
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
use selectors::parser::{SelectorMethods, SelectorParseErrorKind};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use std::fmt::Debug;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
|
@ -715,13 +713,6 @@ impl ServoElementSnapshot {
|
|||
}
|
||||
}
|
||||
|
||||
impl<E: Element<Impl=SelectorImpl> + Debug> ElementExt for E {
|
||||
#[inline]
|
||||
fn matches_user_and_author_rules(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether the language is matched, as defined by
|
||||
/// [RFC 4647](https://tools.ietf.org/html/rfc4647#section-3.3.2).
|
||||
pub fn extended_filtering(tag: &str, range: &str) -> bool {
|
||||
|
|
Загрузка…
Ссылка в новой задаче