aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/layout_dom')
-rw-r--r--components/script/layout_dom/element.rs12
-rw-r--r--components/script/layout_dom/node.rs5
-rw-r--r--components/script/layout_dom/shadow_root.rs6
3 files changed, 23 insertions, 0 deletions
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index 4ecd3ca2de1..05349205c82 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -89,12 +89,24 @@ impl<'dom> ServoLayoutElement<'dom> {
self.as_node().style_data()
}
+ /// Unset the snapshot flags on the underlying DOM object for this element.
+ ///
+ /// # Safety
+ ///
+ /// This function accesses and modifies the underlying DOM object and should
+ /// not be used by more than a single thread at once.
pub unsafe fn unset_snapshot_flags(&self) {
self.as_node()
.node
.set_flag(NodeFlags::HAS_SNAPSHOT | NodeFlags::HANDLED_SNAPSHOT, false);
}
+ /// Unset the snapshot flags on the underlying DOM object for this element.
+ ///
+ /// # Safety
+ ///
+ /// This function accesses and modifies the underlying DOM object and should
+ /// not be used by more than a single thread at once.
pub unsafe fn set_has_snapshot(&self) {
self.as_node().node.set_flag(NodeFlags::HAS_SNAPSHOT, true);
}
diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs
index efb05a2f121..0b2b939cda4 100644
--- a/components/script/layout_dom/node.rs
+++ b/components/script/layout_dom/node.rs
@@ -76,6 +76,11 @@ impl<'dom> ServoLayoutNode<'dom> {
ServoLayoutNode { node: n }
}
+ /// Create a new [`ServoLayoutNode`] for this given [`TrustedNodeAddress`].
+ ///
+ /// # Safety
+ ///
+ /// The address pointed to by `address` should point to a valid node in memory.
pub unsafe fn new(address: &TrustedNodeAddress) -> Self {
ServoLayoutNode::from_layout_js(LayoutDom::from_trusted_node_address(*address))
}
diff --git a/components/script/layout_dom/shadow_root.rs b/components/script/layout_dom/shadow_root.rs
index 9137e863972..0763e150eff 100644
--- a/components/script/layout_dom/shadow_root.rs
+++ b/components/script/layout_dom/shadow_root.rs
@@ -48,6 +48,12 @@ impl<'dom> ServoShadowRoot<'dom> {
ServoShadowRoot { shadow_root }
}
+ /// Flush the stylesheets for the underlying shadow root.
+ ///
+ /// # Safety
+ ///
+ /// This modifies a DOM object, so should care should be taken that only one
+ /// thread has a reference to this object.
pub unsafe fn flush_stylesheets(
&self,
stylist: &mut Stylist,