mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Add way to disable XBL in servo.
Adds a feature "moz_xbl" that when disabled causes the XBL code in servo to be stubbed out. Differential Revision: https://phabricator.services.mozilla.com/D45614
This commit is contained in:
parent
f6b587051d
commit
112a68723e
2 changed files with 33 additions and 1 deletions
|
@ -25,6 +25,7 @@ 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"
|
||||||
|
|
|
@ -54,8 +54,12 @@ use crate::gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES;
|
||||||
use crate::gecko_bindings::structs::NODE_NEEDS_FRAME;
|
use crate::gecko_bindings::structs::NODE_NEEDS_FRAME;
|
||||||
use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
|
use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
|
||||||
use crate::gecko_bindings::structs::{
|
use crate::gecko_bindings::structs::{
|
||||||
nsINode as RawGeckoNode, nsXBLBinding as RawGeckoXBLBinding, Element as RawGeckoElement,
|
nsINode as RawGeckoNode, Element as RawGeckoElement,
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "moz_xbl")]
|
||||||
|
use crate::gecko_bindings::structs::nsXBLBinding as RawGeckoXBLBinding;
|
||||||
|
#[cfg(not(feature = "moz_xbl"))]
|
||||||
|
use values::Impossible;
|
||||||
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
||||||
use crate::global_style_data::GLOBAL_STYLE_DATA;
|
use crate::global_style_data::GLOBAL_STYLE_DATA;
|
||||||
use crate::hash::FxHashMap;
|
use crate::hash::FxHashMap;
|
||||||
|
@ -529,9 +533,11 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Simple wrapper over a non-null Gecko `nsXBLBinding` pointer.
|
/// A Simple wrapper over a non-null Gecko `nsXBLBinding` pointer.
|
||||||
|
#[cfg(feature = "moz_xbl")]
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct GeckoXBLBinding<'lb>(pub &'lb RawGeckoXBLBinding);
|
pub struct GeckoXBLBinding<'lb>(pub &'lb RawGeckoXBLBinding);
|
||||||
|
|
||||||
|
#[cfg(feature = "moz_xbl")]
|
||||||
impl<'lb> GeckoXBLBinding<'lb> {
|
impl<'lb> GeckoXBLBinding<'lb> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn base_binding(&self) -> Option<Self> {
|
fn base_binding(&self) -> Option<Self> {
|
||||||
|
@ -556,6 +562,23 @@ impl<'lb> GeckoXBLBinding<'lb> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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);
|
||||||
|
@ -681,11 +704,13 @@ impl<'le> GeckoElement<'le> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "moz_xbl")]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn may_be_in_binding_manager(&self) -> bool {
|
fn may_be_in_binding_manager(&self) -> bool {
|
||||||
self.flags() & (structs::NODE_MAY_BE_IN_BINDING_MNGR as u32) != 0
|
self.flags() & (structs::NODE_MAY_BE_IN_BINDING_MNGR as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "moz_xbl")]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn xbl_binding(&self) -> Option<GeckoXBLBinding<'le>> {
|
fn xbl_binding(&self) -> Option<GeckoXBLBinding<'le>> {
|
||||||
if !self.may_be_in_binding_manager() {
|
if !self.may_be_in_binding_manager() {
|
||||||
|
@ -696,6 +721,12 @@ impl<'le> GeckoElement<'le> {
|
||||||
unsafe { slots.mXBLBinding.mRawPtr.as_ref().map(GeckoXBLBinding) }
|
unsafe { slots.mXBLBinding.mRawPtr.as_ref().map(GeckoXBLBinding) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "moz_xbl"))]
|
||||||
|
#[inline]
|
||||||
|
fn xbl_binding(&self) -> Option<GeckoXBLBinding<'le>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn xbl_binding_with_content(&self) -> Option<GeckoXBLBinding<'le>> {
|
fn xbl_binding_with_content(&self) -> Option<GeckoXBLBinding<'le>> {
|
||||||
self.xbl_binding().and_then(|b| b.binding_with_content())
|
self.xbl_binding().and_then(|b| b.binding_with_content())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue