зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1658690 - Replace :-moz-native-anonymous-no-specificity with :where(:-moz-native-anonymous). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D88255
This commit is contained in:
Родитель
847b52119e
Коммит
4215d524dc
|
@ -17,7 +17,7 @@
|
|||
//! is non-trivial. This module encapsulates those details and presents an
|
||||
//! easy-to-use API for the parser.
|
||||
|
||||
use crate::parser::{Combinator, Component, NonTSPseudoClass, SelectorImpl};
|
||||
use crate::parser::{Combinator, Component, SelectorImpl};
|
||||
use crate::sink::Push;
|
||||
use servo_arc::{Arc, HeaderWithLength, ThinArc};
|
||||
use smallvec::{self, SmallVec};
|
||||
|
@ -322,14 +322,10 @@ where
|
|||
Component::NthLastOfType(..) |
|
||||
Component::FirstOfType |
|
||||
Component::LastOfType |
|
||||
Component::OnlyOfType => {
|
||||
Component::OnlyOfType |
|
||||
Component::NonTSPseudoClass(..) => {
|
||||
specificity.class_like_selectors += 1;
|
||||
},
|
||||
Component::NonTSPseudoClass(ref pseudo) => {
|
||||
if !pseudo.has_zero_specificity() {
|
||||
specificity.class_like_selectors += 1;
|
||||
}
|
||||
},
|
||||
Component::Is(ref list) => {
|
||||
// https://drafts.csswg.org/selectors/#specificity-rules:
|
||||
//
|
||||
|
|
|
@ -53,9 +53,6 @@ pub trait NonTSPseudoClass: Sized + ToCss {
|
|||
/// https://drafts.csswg.org/selectors-4/#useraction-pseudos
|
||||
fn is_user_action_state(&self) -> bool;
|
||||
|
||||
/// Whether this pseudo-class has zero specificity.
|
||||
fn has_zero_specificity(&self) -> bool;
|
||||
|
||||
fn visit<V>(&self, _visitor: &mut V) -> bool
|
||||
where
|
||||
V: SelectorVisitor<Impl = Self::Impl>,
|
||||
|
@ -2564,11 +2561,6 @@ pub mod tests {
|
|||
fn is_user_action_state(&self) -> bool {
|
||||
self.is_active_or_hover()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_zero_specificity(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for PseudoClass {
|
||||
|
|
|
@ -98,7 +98,6 @@ macro_rules! apply_non_ts_list {
|
|||
("-moz-last-node", MozLastNode, _, _),
|
||||
("-moz-only-whitespace", MozOnlyWhitespace, _, _),
|
||||
("-moz-native-anonymous", MozNativeAnonymous, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
|
||||
("-moz-native-anonymous-no-specificity", MozNativeAnonymousNoSpecificity, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
|
||||
("-moz-use-shadow-tree-root", MozUseShadowTreeRoot, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
|
||||
("-moz-is-html", MozIsHTML, _, _),
|
||||
("-moz-placeholder", MozPlaceholder, _, _),
|
||||
|
|
|
@ -215,7 +215,6 @@ impl NonTSPseudoClass {
|
|||
NonTSPseudoClass::MozIsHTML |
|
||||
// We prevent style sharing for NAC.
|
||||
NonTSPseudoClass::MozNativeAnonymous |
|
||||
NonTSPseudoClass::MozNativeAnonymousNoSpecificity |
|
||||
// :-moz-placeholder is parsed but never matches.
|
||||
NonTSPseudoClass::MozPlaceholder |
|
||||
// :-moz-locale-dir and :-moz-window-inactive depend only on
|
||||
|
@ -248,11 +247,6 @@ impl ::selectors::parser::NonTSPseudoClass for NonTSPseudoClass {
|
|||
)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_zero_specificity(&self) -> bool {
|
||||
matches!(*self, NonTSPseudoClass::MozNativeAnonymousNoSpecificity)
|
||||
}
|
||||
|
||||
fn visit<V>(&self, visitor: &mut V) -> bool
|
||||
where
|
||||
V: SelectorVisitor<Impl = Self::Impl>,
|
||||
|
|
|
@ -2103,10 +2103,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
}
|
||||
true
|
||||
},
|
||||
NonTSPseudoClass::MozNativeAnonymous |
|
||||
NonTSPseudoClass::MozNativeAnonymousNoSpecificity => {
|
||||
self.is_in_native_anonymous_subtree()
|
||||
},
|
||||
NonTSPseudoClass::MozNativeAnonymous => self.is_in_native_anonymous_subtree(),
|
||||
NonTSPseudoClass::MozUseShadowTreeRoot => self.is_root_of_use_element_shadow_tree(),
|
||||
NonTSPseudoClass::MozTableBorderNonzero => unsafe {
|
||||
bindings::Gecko_IsTableBorderNonzero(self.0)
|
||||
|
|
|
@ -311,11 +311,6 @@ impl ::selectors::parser::NonTSPseudoClass for NonTSPseudoClass {
|
|||
)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_zero_specificity(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn visit<V>(&self, _: &mut V) -> bool
|
||||
where
|
||||
V: SelectorVisitor<Impl = Self::Impl>,
|
||||
|
|
|
@ -34,11 +34,7 @@
|
|||
|
||||
/* Rules required for style caching of anonymous content scrollbar parts */
|
||||
@supports -moz-bool-pref("layout.css.cached-scrollbar-styles.enabled") {
|
||||
scrollcorner:-moz-native-anonymous-no-specificity,
|
||||
resizer:-moz-native-anonymous-no-specificity,
|
||||
scrollbar:-moz-native-anonymous-no-specificity,
|
||||
scrollbarbutton:-moz-native-anonymous-no-specificity,
|
||||
slider:-moz-native-anonymous-no-specificity {
|
||||
:is(scrollcorner, resizer, scrollbar, scrollbarbutton, slider):where(:-moz-native-anonymous) {
|
||||
/* All scrollbar parts must not inherit any properties from the scrollable
|
||||
* element (except for visibility and pointer-events), for the anonymous
|
||||
* content style caching system to work.
|
||||
|
@ -98,9 +94,7 @@
|
|||
* expecting them to inherit into its children. Explicitly inherit those,
|
||||
* overriding the 'all: initial; direction: ltr;' declarations above.
|
||||
*/
|
||||
scrollbarbutton:-moz-native-anonymous-no-specificity,
|
||||
slider:-moz-native-anonymous-no-specificity,
|
||||
thumb:-moz-native-anonymous-no-specificity {
|
||||
:is(scrollbarbutton, slider, thumb):where(:-moz-native-anonymous) {
|
||||
direction: inherit;
|
||||
cursor: inherit;
|
||||
}
|
||||
|
|
|
@ -670,7 +670,6 @@ STATIC_ATOMS = [
|
|||
Atom("mozCustomContentContainer", "moz-custom-content-container"),
|
||||
Atom("mozGrabber", "mozGrabber"),
|
||||
Atom("mozNativeAnonymous", "-moz-native-anonymous"),
|
||||
Atom("mozNativeAnonymousNoSpecificity", "-moz-native-anonymous-no-specificity"),
|
||||
Atom("mozprivatebrowsing", "mozprivatebrowsing"),
|
||||
Atom("mozResizer", "mozResizer"),
|
||||
Atom("mozResizingInfo", "mozResizingInfo"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче