Don't expose any AtomicRefCell directly from style traits

This lets us experiment with how we store this data on the DOM side.
This commit is contained in:
Anthony Ramine 2020-04-03 14:34:37 +02:00
parent 4c61baee30
commit 516e8e0aa6
9 changed files with 67 additions and 42 deletions

View file

@ -22,7 +22,7 @@ use crate::shared_lock::Locked;
use crate::stylist::CascadeData;
use crate::traversal_flags::TraversalFlags;
use crate::{Atom, LocalName, Namespace, WeakAtom};
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use atomic_refcell::{AtomicRef, AtomicRefMut};
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
use selectors::sink::Push;
use selectors::Element as SelectorsElement;
@ -689,18 +689,14 @@ pub trait TElement:
/// Unsafe following the same reasoning as ensure_data.
unsafe fn clear_data(&self);
/// Gets a reference to the ElementData container.
fn get_data(&self) -> Option<&AtomicRefCell<ElementData>>;
/// Whether there is an ElementData container.
fn has_data(&self) -> bool;
/// Immutably borrows the ElementData.
fn borrow_data(&self) -> Option<AtomicRef<ElementData>> {
self.get_data().map(|x| x.borrow())
}
fn borrow_data(&self) -> Option<AtomicRef<ElementData>>;
/// Mutably borrows the ElementData.
fn mutate_data(&self) -> Option<AtomicRefMut<ElementData>> {
self.get_data().map(|x| x.borrow_mut())
}
fn mutate_data(&self) -> Option<AtomicRefMut<ElementData>>;
/// Whether we should skip any root- or item-based display property
/// blockification on this element. (This function exists so that Gecko