diff options
author | Anthony Ramine <nox@nox.paris> | 2020-04-03 14:34:37 +0200 |
---|---|---|
committer | Anthony Ramine <nox@nox.paris> | 2020-04-04 13:08:51 +0200 |
commit | 516e8e0aa600cdef34e506e0ed7180d12dd9ac7d (patch) | |
tree | 4a41cf0ddf45c1a5a3a70e957d8fa17a767accac /components/style/dom.rs | |
parent | 4c61baee30016b0e60c509111b659873283b4dcf (diff) | |
download | servo-516e8e0aa600cdef34e506e0ed7180d12dd9ac7d.tar.gz servo-516e8e0aa600cdef34e506e0ed7180d12dd9ac7d.zip |
Don't expose any AtomicRefCell directly from style traits
This lets us experiment with how we store this data on the DOM side.
Diffstat (limited to 'components/style/dom.rs')
-rw-r--r-- | components/style/dom.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/components/style/dom.rs b/components/style/dom.rs index 7629bb11e18..d07cac998ae 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -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 |