aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorTim Taubert <tim@timtaubert.de>2014-10-13 00:32:48 +0200
committerTim Taubert <tim@timtaubert.de>2014-10-13 13:25:44 +0200
commit28061b1c913c432d46e935e632862e0164d2cbfd (patch)
treee11ed9157aa363b0e36e279b2dcb2ab5c62c4797 /components/script/dom
parentda7590d108be2f000bae2c00f9ea721ebd11f626 (diff)
downloadservo-28061b1c913c432d46e935e632862e0164d2cbfd.tar.gz
servo-28061b1c913c432d46e935e632862e0164d2cbfd.zip
Privatize Node
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/node.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 448d50620fb..81946a2738e 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -73,9 +73,10 @@ use uuid;
/// An HTML node.
#[jstraceable]
#[must_root]
+#[privatize]
pub struct Node {
/// The JavaScript reflector for this node.
- pub eventtarget: EventTarget,
+ eventtarget: EventTarget,
/// The type of node that this is.
type_id: NodeTypeId,
@@ -108,7 +109,7 @@ pub struct Node {
///
/// Must be sent back to the layout task to be destroyed when this
/// node is finalized.
- pub layout_data: LayoutDataRef,
+ layout_data: LayoutDataRef,
unique_id: RefCell<String>,
}
@@ -1149,6 +1150,21 @@ impl Node {
&self.eventtarget
}
+ #[inline]
+ pub fn layout_data(&self) -> Ref<Option<LayoutData>> {
+ self.layout_data.borrow()
+ }
+
+ #[inline]
+ pub fn layout_data_mut(&self) -> RefMut<Option<LayoutData>> {
+ self.layout_data.borrow_mut()
+ }
+
+ #[inline]
+ pub unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> {
+ self.layout_data.borrow_unchecked()
+ }
+
// http://dom.spec.whatwg.org/#concept-node-adopt
pub fn adopt(node: JSRef<Node>, document: JSRef<Document>) {
// Step 1.