diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-06-21 13:06:20 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-06-22 10:47:21 +0200 |
commit | eb2c508df0ca8a286db9d30d5fb2ba8e47b41fa2 (patch) | |
tree | 0dd27854dd7c3e761a75b0d22c2914153f891f7f /components/script/dom/node.rs | |
parent | a217ffb00a844c4396f5abb1d3ead2f2bb520a6c (diff) | |
download | servo-eb2c508df0ca8a286db9d30d5fb2ba8e47b41fa2.tar.gz servo-eb2c508df0ca8a286db9d30d5fb2ba8e47b41fa2.zip |
Implement the LayoutData getters on LayoutJS<Node> rather than Node itself.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index af957f2beca..919136a4afd 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1091,6 +1091,13 @@ pub trait LayoutNodeHelpers { unsafe fn get_flag(&self, flag: NodeFlags) -> bool; #[allow(unsafe_code)] unsafe fn set_flag(&self, flag: NodeFlags, value: bool); + + #[allow(unsafe_code)] + unsafe fn layout_data(&self) -> Ref<Option<LayoutData>>; + #[allow(unsafe_code)] + unsafe fn layout_data_mut(&self) -> RefMut<Option<LayoutData>>; + #[allow(unsafe_code)] + unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData>; } impl LayoutNodeHelpers for LayoutJS<Node> { @@ -1162,6 +1169,24 @@ impl LayoutNodeHelpers for LayoutJS<Node> { (*this).flags.set(flags); } + + #[inline] + #[allow(unsafe_code)] + unsafe fn layout_data(&self) -> Ref<Option<LayoutData>> { + (*self.unsafe_get()).layout_data.borrow() + } + + #[inline] + #[allow(unsafe_code)] + unsafe fn layout_data_mut(&self) -> RefMut<Option<LayoutData>> { + (*self.unsafe_get()).layout_data.borrow_mut() + } + + #[inline] + #[allow(unsafe_code)] + unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> { + (*self.unsafe_get()).layout_data.borrow_unchecked() + } } pub trait RawLayoutNodeHelpers { @@ -1461,22 +1486,6 @@ impl Node { } } - #[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] - #[allow(unsafe_code)] - pub unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> { - self.layout_data.borrow_unchecked() - } - // https://dom.spec.whatwg.org/#concept-node-adopt pub fn adopt(node: &Node, document: &Document) { // Step 1. |