mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Bug 1377993: Make node slots less memory hungry in common cases.
This commit is contained in:
parent
602ef8bce1
commit
c606ec13e2
1 changed files with 11 additions and 5 deletions
|
@ -505,7 +505,7 @@ impl<'le> GeckoElement<'le> {
|
|||
|
||||
/// Returns true if this element has a shadow root.
|
||||
fn has_shadow_root(&self) -> bool {
|
||||
self.get_dom_slots().map_or(false, |slots| !slots.mShadowRoot.mRawPtr.is_null())
|
||||
self.get_extended_slots().map_or(false, |slots| !slots.mShadowRoot.mRawPtr.is_null())
|
||||
}
|
||||
|
||||
/// Returns a reference to the DOM slots for this Element, if they exist.
|
||||
|
@ -514,6 +514,13 @@ impl<'le> GeckoElement<'le> {
|
|||
unsafe { slots.as_ref() }
|
||||
}
|
||||
|
||||
/// Returns a reference to the extended DOM slots for this Element.
|
||||
fn get_extended_slots(&self) -> Option<&structs::FragmentOrElement_nsExtendedDOMSlots> {
|
||||
self.get_dom_slots().and_then(|s| {
|
||||
unsafe { s.mExtendedSlots.mPtr.as_ref() }
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_xbl_binding(&self) -> Option<GeckoXBLBinding> {
|
||||
if self.flags() & (structs::NODE_MAY_BE_IN_BINDING_MNGR as u32) == 0 {
|
||||
|
@ -556,10 +563,9 @@ impl<'le> GeckoElement<'le> {
|
|||
|
||||
fn get_non_xul_xbl_binding_parent_raw_content(&self) -> *mut nsIContent {
|
||||
debug_assert!(!self.is_xul_element());
|
||||
match self.get_dom_slots() {
|
||||
Some(slots) => unsafe { *slots.__bindgen_anon_1.mBindingParent.as_ref() },
|
||||
None => ptr::null_mut(),
|
||||
}
|
||||
self.get_extended_slots().map_or(ptr::null_mut(), |slots| {
|
||||
slots.mBindingParent
|
||||
})
|
||||
}
|
||||
|
||||
fn has_xbl_binding_parent(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue