Bug 1591297 - Remove some XBL code in the style system. r=hiro

Differential Revision: https://phabricator.services.mozilla.com/D50554

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-25 12:19:21 +00:00
Родитель bf00169ed5
Коммит 6a021aec24
11 изменённых файлов: 3 добавлений и 132 удалений

Просмотреть файл

@ -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.
#[inline]
pub fn is_nested(&self) -> bool {

Просмотреть файл

@ -25,7 +25,6 @@ servo-layout-2020 = []
gecko_debug = []
gecko_refcount_logging = []
gecko_profiler = []
moz_xbl = []
[dependencies]
app_units = "0.7"

Просмотреть файл

@ -776,14 +776,6 @@ pub trait TElement:
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.
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::structs;
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::EffectCompositor_CascadeLevel as CascadeLevel;
use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
@ -86,8 +84,6 @@ use std::fmt;
use std::hash::{Hash, Hasher};
use std::mem;
use std::ptr;
#[cfg(not(feature = "moz_xbl"))]
use values::Impossible;
#[inline]
fn elements_with_id<'a, 'le>(
@ -317,7 +313,7 @@ impl<'ln> GeckoNode<'ln> {
}
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;
}
}
@ -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.
#[derive(Clone, Copy)]
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]
fn namespace_id(&self) -> i32 {
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
// StyleChildrenIterator::IsNeeded does, except that it might return
// 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() ||
self.has_xbl_binding_with_content() ||
self.is_html_slot_element() ||
self.shadow_root().is_some() ||
self.may_have_anonymous_children()
@ -1595,11 +1511,6 @@ impl<'le> TElement for GeckoElement<'le> {
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(
&self,
old_style: Option<&ComputedValues>,

Просмотреть файл

@ -31,9 +31,6 @@ impl Default for InvalidationMatchingData {
/// An invalidation processor for style changes due to state and attribute
/// changes.
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,
matching_context: MatchingContext<'a, E::Impl>,
document_states_changed: DocumentState,

Просмотреть файл

@ -28,7 +28,7 @@ where
/// Whether the invalidation processor only cares about light-tree
/// 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 {
false
}
@ -455,11 +455,6 @@ where
let mut sibling_invalidations = InvalidationVector::new();
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() {
Some(e) => e,
None => continue,
@ -574,13 +569,6 @@ where
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() {
any_descendant |= self.invalidate_pseudo_element_or_nac(marker, invalidations);
}

Просмотреть файл

@ -12,7 +12,6 @@ path = "lib.rs"
gecko_debug = ["style/gecko_debug", "nsstring/gecko_debug"]
gecko_profiler = ["style/gecko_profiler"]
gecko_refcount_logging = ["style/gecko_refcount_logging", "servo_arc/gecko_refcount_logging"]
moz_xbl = ["style/moz_xbl"]
[dependencies]
atomic_refcell = "0.1"

Просмотреть файл

@ -27,7 +27,6 @@ new_xulstore = ["gkrust-shared/new_xulstore"]
new_cert_storage = ["gkrust-shared/new_cert_storage"]
fuzzing_interfaces = ["gkrust-shared/fuzzing_interfaces", "gecko-fuzz-targets"]
webrtc = ["gkrust-shared/webrtc"]
moz_xbl = ["gkrust-shared/moz_xbl"]
[dependencies]
bench-collections-gtest = { path = "../../../../xpcom/rust/gtest/bench-collections" }

Просмотреть файл

@ -28,7 +28,6 @@ new_xulstore = ["gkrust-shared/new_xulstore"]
new_cert_storage = ["gkrust-shared/new_cert_storage"]
fuzzing_interfaces = ["gkrust-shared/fuzzing_interfaces"]
webrtc = ["gkrust-shared/webrtc"]
moz_xbl = ["gkrust-shared/moz_xbl"]
[dependencies]
gkrust-shared = { path = "shared" }

Просмотреть файл

@ -25,9 +25,6 @@ if CONFIG['MOZ_AUDIOUNIT_RUST']:
if CONFIG['MOZ_RUST_SIMD']:
gkrust_features += ['simd-accel']
if CONFIG['MOZ_XBL']:
gkrust_features += ['moz_xbl']
# This feature is not yet supported on all platforms, and this check needs to
# match MOZ_CUBEB_REMOTING in CubebUtils.cpp.
if (CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android') or CONFIG['OS_ARCH'] == 'Darwin' or (CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['CPU_ARCH'] != 'aarch64'):

Просмотреть файл

@ -69,7 +69,6 @@ new_xulstore = ["xulstore"]
new_cert_storage = ["cert_storage"]
fuzzing_interfaces = []
webrtc = ["mdns_service"]
moz_xbl = ["geckoservo/moz_xbl"]
[lib]
path = "lib.rs"