if ExtendedDOMSlots are used before slots, use FatSlots to have fewer allocations.

Bug: 1419661
This commit is contained in:
Olli Pettay 2018-06-30 01:30:37 +03:00 committed by Emilio Cobos Álvarez
parent 8488875a56
commit 6483a89848
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -651,7 +651,10 @@ impl<'le> GeckoElement<'le> {
#[inline]
fn extended_slots(&self) -> Option<&structs::FragmentOrElement_nsExtendedDOMSlots> {
self.dom_slots().and_then(|s| unsafe {
(s._base.mExtendedSlots.mPtr as *const structs::FragmentOrElement_nsExtendedDOMSlots)
// For the bit usage, see nsContentSlots::GetExtendedSlots.
let e_slots = s._base.mExtendedSlots &
!structs::nsIContent_nsContentSlots_sNonOwningExtendedSlotsFlag;
(e_slots as *const structs::FragmentOrElement_nsExtendedDOMSlots)
.as_ref()
})
}