mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Remove some XBL code in the style system.
Differential Revision: https://phabricator.services.mozilla.com/D50554
This commit is contained in:
parent
854c480177
commit
5f30ecc9b1
6 changed files with 3 additions and 125 deletions
|
@ -189,15 +189,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Override the quirks mode we're matching against.
|
|
||||||
///
|
|
||||||
/// FIXME(emilio): This is a hack for XBL quirks-mode mismatches.
|
|
||||||
#[inline]
|
|
||||||
pub fn set_quirks_mode(&mut self, quirks_mode: QuirksMode) {
|
|
||||||
self.quirks_mode = quirks_mode;
|
|
||||||
self.classes_and_ids_case_sensitivity = quirks_mode.classes_and_ids_case_sensitivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether we're matching a nested selector.
|
/// Whether we're matching a nested selector.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_nested(&self) -> bool {
|
pub fn is_nested(&self) -> bool {
|
||||||
|
|
|
@ -25,7 +25,6 @@ servo-layout-2020 = []
|
||||||
gecko_debug = []
|
gecko_debug = []
|
||||||
gecko_refcount_logging = []
|
gecko_refcount_logging = []
|
||||||
gecko_profiler = []
|
gecko_profiler = []
|
||||||
moz_xbl = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app_units = "0.7"
|
app_units = "0.7"
|
||||||
|
|
|
@ -776,14 +776,6 @@ pub trait TElement:
|
||||||
return data.hint.has_animation_hint();
|
return data.hint.has_animation_hint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the anonymous content for the current element's XBL binding,
|
|
||||||
/// given if any.
|
|
||||||
///
|
|
||||||
/// This is used in Gecko for XBL.
|
|
||||||
fn xbl_binding_anonymous_content(&self) -> Option<Self::ConcreteNode> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The shadow root this element is a host of.
|
/// The shadow root this element is a host of.
|
||||||
fn shadow_root(&self) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>;
|
fn shadow_root(&self) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>;
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,6 @@ use crate::gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWThe
|
||||||
use crate::gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
use crate::gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||||
use crate::gecko_bindings::structs;
|
use crate::gecko_bindings::structs;
|
||||||
use crate::gecko_bindings::structs::nsChangeHint;
|
use crate::gecko_bindings::structs::nsChangeHint;
|
||||||
#[cfg(feature = "moz_xbl")]
|
|
||||||
use crate::gecko_bindings::structs::nsXBLBinding as RawGeckoXBLBinding;
|
|
||||||
use crate::gecko_bindings::structs::Document_DocumentTheme as DocumentTheme;
|
use crate::gecko_bindings::structs::Document_DocumentTheme as DocumentTheme;
|
||||||
use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
||||||
use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
|
use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
|
||||||
|
@ -86,8 +84,6 @@ use std::fmt;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
#[cfg(not(feature = "moz_xbl"))]
|
|
||||||
use values::Impossible;
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn elements_with_id<'a, 'le>(
|
fn elements_with_id<'a, 'le>(
|
||||||
|
@ -317,7 +313,7 @@ impl<'ln> GeckoNode<'ln> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(parent) = parent_el {
|
if let Some(parent) = parent_el {
|
||||||
if parent.shadow_root().is_some() || parent.xbl_binding().is_some() {
|
if parent.shadow_root().is_some() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,52 +526,6 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Simple wrapper over a non-null Gecko `nsXBLBinding` pointer.
|
|
||||||
#[cfg(feature = "moz_xbl")]
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
pub struct GeckoXBLBinding<'lb>(pub &'lb RawGeckoXBLBinding);
|
|
||||||
|
|
||||||
#[cfg(feature = "moz_xbl")]
|
|
||||||
impl<'lb> GeckoXBLBinding<'lb> {
|
|
||||||
#[inline]
|
|
||||||
fn base_binding(&self) -> Option<Self> {
|
|
||||||
unsafe { self.0.mNextBinding.mRawPtr.as_ref().map(GeckoXBLBinding) }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn anon_content(&self) -> *const nsIContent {
|
|
||||||
self.0.mContent.raw::<nsIContent>()
|
|
||||||
}
|
|
||||||
|
|
||||||
// This duplicates the logic in Gecko's
|
|
||||||
// nsBindingManager::GetBindingWithContent.
|
|
||||||
fn binding_with_content(&self) -> Option<Self> {
|
|
||||||
let mut binding = *self;
|
|
||||||
loop {
|
|
||||||
if !binding.anon_content().is_null() {
|
|
||||||
return Some(binding);
|
|
||||||
}
|
|
||||||
binding = binding.base_binding()?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A stub wraper for GeckoXBLBinding.
|
|
||||||
#[cfg(not(feature = "moz_xbl"))]
|
|
||||||
pub struct GeckoXBLBinding<'lb>(&'lb Impossible);
|
|
||||||
|
|
||||||
#[cfg(not(feature = "moz_xbl"))]
|
|
||||||
impl<'lb> GeckoXBLBinding<'lb> {
|
|
||||||
#[inline]
|
|
||||||
fn anon_content(&self) -> *const nsIContent {
|
|
||||||
match *self.0 {}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn binding_with_content(&self) -> Option<Self> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A simple wrapper over a non-null Gecko `Element` pointer.
|
/// A simple wrapper over a non-null Gecko `Element` pointer.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct GeckoElement<'le>(pub &'le RawGeckoElement);
|
pub struct GeckoElement<'le>(pub &'le RawGeckoElement);
|
||||||
|
@ -701,39 +651,6 @@ impl<'le> GeckoElement<'le> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "moz_xbl")]
|
|
||||||
#[inline]
|
|
||||||
fn may_be_in_binding_manager(&self) -> bool {
|
|
||||||
self.flags() & (structs::NODE_MAY_BE_IN_BINDING_MNGR as u32) != 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "moz_xbl")]
|
|
||||||
#[inline]
|
|
||||||
fn xbl_binding(&self) -> Option<GeckoXBLBinding<'le>> {
|
|
||||||
if !self.may_be_in_binding_manager() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let slots = self.extended_slots()?;
|
|
||||||
unsafe { slots.mXBLBinding.mRawPtr.as_ref().map(GeckoXBLBinding) }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "moz_xbl"))]
|
|
||||||
#[inline]
|
|
||||||
fn xbl_binding(&self) -> Option<GeckoXBLBinding<'le>> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn xbl_binding_with_content(&self) -> Option<GeckoXBLBinding<'le>> {
|
|
||||||
self.xbl_binding().and_then(|b| b.binding_with_content())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn has_xbl_binding_with_content(&self) -> bool {
|
|
||||||
!self.xbl_binding_with_content().is_none()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn namespace_id(&self) -> i32 {
|
fn namespace_id(&self) -> i32 {
|
||||||
self.as_node().node_info().mInner.mNamespaceID
|
self.as_node().node_info().mInner.mNamespaceID
|
||||||
|
@ -1107,9 +1024,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
// This condition is similar to the check that
|
// This condition is similar to the check that
|
||||||
// StyleChildrenIterator::IsNeeded does, except that it might return
|
// StyleChildrenIterator::IsNeeded does, except that it might return
|
||||||
// true if we used to (but no longer) have anonymous content from
|
// true if we used to (but no longer) have anonymous content from
|
||||||
// ::before/::after, XBL bindings, or nsIAnonymousContentCreators.
|
// ::before/::after, or nsIAnonymousContentCreators.
|
||||||
if self.is_in_anonymous_subtree() ||
|
if self.is_in_anonymous_subtree() ||
|
||||||
self.has_xbl_binding_with_content() ||
|
|
||||||
self.is_html_slot_element() ||
|
self.is_html_slot_element() ||
|
||||||
self.shadow_root().is_some() ||
|
self.shadow_root().is_some() ||
|
||||||
self.may_have_anonymous_children()
|
self.may_have_anonymous_children()
|
||||||
|
@ -1595,11 +1511,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
self.may_have_animations() && unsafe { Gecko_ElementHasCSSTransitions(self.0) }
|
self.may_have_animations() && unsafe { Gecko_ElementHasCSSTransitions(self.0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn xbl_binding_anonymous_content(&self) -> Option<GeckoNode<'le>> {
|
|
||||||
self.xbl_binding_with_content()
|
|
||||||
.map(|b| unsafe { GeckoNode::from_content(&*b.anon_content()) })
|
|
||||||
}
|
|
||||||
|
|
||||||
fn might_need_transitions_update(
|
fn might_need_transitions_update(
|
||||||
&self,
|
&self,
|
||||||
old_style: Option<&ComputedValues>,
|
old_style: Option<&ComputedValues>,
|
||||||
|
|
|
@ -31,9 +31,6 @@ impl Default for InvalidationMatchingData {
|
||||||
/// An invalidation processor for style changes due to state and attribute
|
/// An invalidation processor for style changes due to state and attribute
|
||||||
/// changes.
|
/// changes.
|
||||||
pub struct DocumentStateInvalidationProcessor<'a, E: TElement, I> {
|
pub struct DocumentStateInvalidationProcessor<'a, E: TElement, I> {
|
||||||
// TODO(emilio): We might want to just run everything for every possible
|
|
||||||
// binding along with the document data, or just apply the XBL stuff to the
|
|
||||||
// bound subtrees.
|
|
||||||
rules: I,
|
rules: I,
|
||||||
matching_context: MatchingContext<'a, E::Impl>,
|
matching_context: MatchingContext<'a, E::Impl>,
|
||||||
document_states_changed: DocumentState,
|
document_states_changed: DocumentState,
|
||||||
|
|
|
@ -28,7 +28,7 @@ where
|
||||||
|
|
||||||
/// Whether the invalidation processor only cares about light-tree
|
/// Whether the invalidation processor only cares about light-tree
|
||||||
/// descendants of a given element, that is, doesn't invalidate
|
/// descendants of a given element, that is, doesn't invalidate
|
||||||
/// pseudo-elements, NAC, or XBL anon content.
|
/// pseudo-elements, NAC, shadow dom...
|
||||||
fn light_tree_only(&self) -> bool {
|
fn light_tree_only(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -455,11 +455,6 @@ where
|
||||||
|
|
||||||
let mut sibling_invalidations = InvalidationVector::new();
|
let mut sibling_invalidations = InvalidationVector::new();
|
||||||
for child in parent.dom_children() {
|
for child in parent.dom_children() {
|
||||||
// TODO(emilio): We handle <xbl:children> fine, because they appear
|
|
||||||
// in selector-matching (note bug 1374247, though).
|
|
||||||
//
|
|
||||||
// This probably needs a shadow root check on `child` here, and
|
|
||||||
// recursing if that's the case.
|
|
||||||
let child = match child.as_element() {
|
let child = match child.as_element() {
|
||||||
Some(e) => e,
|
Some(e) => e,
|
||||||
None => continue,
|
None => continue,
|
||||||
|
@ -574,13 +569,6 @@ where
|
||||||
any_descendant |= self.invalidate_dom_descendants_of(root.as_node(), invalidations);
|
any_descendant |= self.invalidate_dom_descendants_of(root.as_node(), invalidations);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is needed for XBL (technically) unconditionally, because XBL
|
|
||||||
// bindings do not block combinators in any way. However this is kinda
|
|
||||||
// broken anyway, since we should be looking at XBL rules too.
|
|
||||||
if let Some(anon_content) = self.element.xbl_binding_anonymous_content() {
|
|
||||||
any_descendant |= self.invalidate_dom_descendants_of(anon_content, invalidations);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(marker) = self.element.marker_pseudo_element() {
|
if let Some(marker) = self.element.marker_pseudo_element() {
|
||||||
any_descendant |= self.invalidate_pseudo_element_or_nac(marker, invalidations);
|
any_descendant |= self.invalidate_pseudo_element_or_nac(marker, invalidations);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue