From fedccdb473db35724aa119b6396e529725d7536e Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Thu, 7 Aug 2014 10:30:17 -0600 Subject: [PATCH] Fix the NodeFlags methods that are called by layout. They should never borrow. --- src/components/script/dom/node.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index edfed94b54c..41a1815013a 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -782,13 +782,13 @@ pub trait RawLayoutNodeHelpers { impl RawLayoutNodeHelpers for Node { unsafe fn get_hover_state_for_layout(&self) -> bool { - self.flags.deref().borrow().contains(InHoverState) + (*self.unsafe_get_flags()).contains(InHoverState) } unsafe fn get_disabled_state_for_layout(&self) -> bool { - self.flags.deref().borrow().contains(InDisabledState) + (*self.unsafe_get_flags()).contains(InDisabledState) } unsafe fn get_enabled_state_for_layout(&self) -> bool { - self.flags.deref().borrow().contains(InEnabledState) + (*self.unsafe_get_flags()).contains(InEnabledState) } } @@ -1414,6 +1414,10 @@ impl Node { } } } + + pub unsafe fn unsafe_get_flags(&self) -> *const NodeFlags { + mem::transmute(&self.flags) + } } impl<'a> NodeMethods for JSRef<'a, Node> {