mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Remove support for XBL resources.
So much unsound code going away :-) Differential Revision: https://phabricator.services.mozilla.com/D28380
This commit is contained in:
parent
50312e1457
commit
e5b5cd78a9
10 changed files with 22 additions and 208 deletions
|
@ -145,11 +145,6 @@ impl PerDocumentStyleData {
|
|||
/// Create a `PerDocumentStyleData`.
|
||||
pub fn new(document: *const structs::Document) -> Self {
|
||||
let device = Device::new(document);
|
||||
|
||||
// FIXME(emilio, tlin): How is this supposed to work with XBL? This is
|
||||
// right now not always honored, see bug 1405543...
|
||||
//
|
||||
// Should we just force XBL Stylists to be NoQuirks?
|
||||
let quirks_mode = device.document().mCompatMode;
|
||||
|
||||
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
||||
|
|
|
@ -172,15 +172,7 @@ impl<'lr> TShadowRoot for GeckoShadowRoot<'lr> {
|
|||
Self: 'a,
|
||||
{
|
||||
let author_styles = unsafe { self.0.mServoStyles.mPtr.as_ref()? };
|
||||
|
||||
let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);
|
||||
|
||||
debug_assert!(
|
||||
author_styles.quirks_mode == self.as_node().owner_doc().quirks_mode() ||
|
||||
author_styles.stylesheets.is_empty() ||
|
||||
author_styles.stylesheets.dirty()
|
||||
);
|
||||
|
||||
Some(&author_styles.data)
|
||||
}
|
||||
|
||||
|
@ -536,11 +528,6 @@ impl<'lb> GeckoXBLBinding<'lb> {
|
|||
self.0.mContent.raw::<nsIContent>()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inherits_style(&self) -> bool {
|
||||
unsafe { bindings::Gecko_XBLBinding_InheritsStyle(self.0) }
|
||||
}
|
||||
|
||||
// This duplicates the logic in Gecko's
|
||||
// nsBindingManager::GetBindingWithContent.
|
||||
fn binding_with_content(&self) -> Option<Self> {
|
||||
|
@ -552,22 +539,6 @@ impl<'lb> GeckoXBLBinding<'lb> {
|
|||
binding = binding.base_binding()?;
|
||||
}
|
||||
}
|
||||
|
||||
fn each_xbl_cascade_data<F>(&self, f: &mut F)
|
||||
where
|
||||
F: FnMut(&'lb CascadeData, QuirksMode),
|
||||
{
|
||||
if let Some(base) = self.base_binding() {
|
||||
base.each_xbl_cascade_data(f);
|
||||
}
|
||||
|
||||
let data = unsafe { bindings::Gecko_XBLBinding_GetRawServoStyles(self.0).as_ref() };
|
||||
|
||||
if let Some(data) = data {
|
||||
let data: &'lb _ = AuthorStyles::<GeckoStyleSheet>::from_ffi(data);
|
||||
f(&data.data, data.quirks_mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A simple wrapper over a non-null Gecko `Element` pointer.
|
||||
|
@ -1250,14 +1221,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
fn has_same_xbl_proto_binding_as(&self, other: Self) -> bool {
|
||||
match (self.xbl_binding(), other.xbl_binding()) {
|
||||
(None, None) => true,
|
||||
(Some(a), Some(b)) => a.0.mPrototypeBinding == b.0.mPrototypeBinding,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn each_anonymous_content_child<F>(&self, mut f: F)
|
||||
where
|
||||
F: FnMut(Self),
|
||||
|
@ -1436,7 +1399,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
|
||||
#[inline]
|
||||
fn matches_user_and_author_rules(&self) -> bool {
|
||||
!self.is_in_native_anonymous_subtree()
|
||||
!self.rule_hash_target().is_in_native_anonymous_subtree()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -1599,43 +1562,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
self.may_have_animations() && unsafe { Gecko_ElementHasCSSTransitions(self.0) }
|
||||
}
|
||||
|
||||
fn each_xbl_cascade_data<'a, F>(&self, mut f: F) -> bool
|
||||
where
|
||||
'le: 'a,
|
||||
F: FnMut(&'a CascadeData, QuirksMode),
|
||||
{
|
||||
// Walk the binding scope chain, starting with the binding attached to
|
||||
// our content, up till we run out of scopes or we get cut off.
|
||||
//
|
||||
// If we are a NAC pseudo-element, we want to get rules from our
|
||||
// rule_hash_target, that is, our originating element.
|
||||
let mut current = Some(self.rule_hash_target());
|
||||
while let Some(element) = current {
|
||||
if let Some(binding) = element.xbl_binding() {
|
||||
binding.each_xbl_cascade_data(&mut f);
|
||||
|
||||
// If we're not looking at our original element, allow the
|
||||
// binding to cut off style inheritance.
|
||||
if element != *self && !binding.inherits_style() {
|
||||
// Go no further; we're not inheriting style from
|
||||
// anything above here.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if element.is_root_of_native_anonymous_subtree() {
|
||||
// Deliberately cut off style inheritance here.
|
||||
break;
|
||||
}
|
||||
|
||||
current = element.xbl_binding_parent();
|
||||
}
|
||||
|
||||
// If current has something, this means we cut off inheritance at some
|
||||
// point in the loop.
|
||||
current.is_some()
|
||||
}
|
||||
|
||||
fn xbl_binding_anonymous_content(&self) -> Option<GeckoNode<'le>> {
|
||||
self.xbl_binding_with_content()
|
||||
.map(|b| unsafe { GeckoNode::from_content(&*b.anon_content()) })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue