aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-07-23 12:40:52 -0600
committerbors-servo <metajack+bors@gmail.com>2015-07-23 12:40:52 -0600
commitf44d75e5b2e4229728d97b6a70de3babd3496eb1 (patch)
tree2a2552ea57300d692292a4a7a6435f2056d1b853 /components/script/dom/node.rs
parent658c3d05ae72b52e543342c7a33d37a345eb4374 (diff)
parent487eef88e314874a275ebc25e8e4658186f68dff (diff)
downloadservo-f44d75e5b2e4229728d97b6a70de3babd3496eb1.tar.gz
servo-f44d75e5b2e4229728d97b6a70de3babd3496eb1.zip
Auto merge of #6715 - Ms2ger:layoutelement, r=jdm
Implement more methods on LayoutJS. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6715) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs47
1 files changed, 21 insertions, 26 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 20984bfbac5..0a06a5253c5 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -1086,6 +1086,11 @@ pub trait LayoutNodeHelpers {
unsafe fn layout_data_mut(&self) -> RefMut<Option<LayoutData>>;
#[allow(unsafe_code)]
unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData>;
+
+ fn get_hover_state_for_layout(&self) -> bool;
+ fn get_focus_state_for_layout(&self) -> bool;
+ fn get_disabled_state_for_layout(&self) -> bool;
+ fn get_enabled_state_for_layout(&self) -> bool;
}
impl LayoutNodeHelpers for LayoutJS<Node> {
@@ -1175,44 +1180,34 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> {
(*self.unsafe_get()).layout_data.borrow_unchecked()
}
-}
-
-pub trait RawLayoutNodeHelpers {
- #[allow(unsafe_code)]
- unsafe fn get_hover_state_for_layout(&self) -> bool;
- #[allow(unsafe_code)]
- unsafe fn get_focus_state_for_layout(&self) -> bool;
- #[allow(unsafe_code)]
- unsafe fn get_disabled_state_for_layout(&self) -> bool;
- #[allow(unsafe_code)]
- unsafe fn get_enabled_state_for_layout(&self) -> bool;
- fn type_id_for_layout(&self) -> NodeTypeId;
-}
-impl RawLayoutNodeHelpers for Node {
#[inline]
#[allow(unsafe_code)]
- unsafe fn get_hover_state_for_layout(&self) -> bool {
- self.flags.get().contains(IN_HOVER_STATE)
+ fn get_hover_state_for_layout(&self) -> bool {
+ unsafe {
+ self.get_flag(IN_HOVER_STATE)
+ }
}
#[inline]
#[allow(unsafe_code)]
- unsafe fn get_focus_state_for_layout(&self) -> bool {
- self.flags.get().contains(IN_FOCUS_STATE)
+ fn get_focus_state_for_layout(&self) -> bool {
+ unsafe {
+ self.get_flag(IN_FOCUS_STATE)
+ }
}
#[inline]
#[allow(unsafe_code)]
- unsafe fn get_disabled_state_for_layout(&self) -> bool {
- self.flags.get().contains(IN_DISABLED_STATE)
+ fn get_disabled_state_for_layout(&self) -> bool {
+ unsafe {
+ self.get_flag(IN_DISABLED_STATE)
+ }
}
#[inline]
#[allow(unsafe_code)]
- unsafe fn get_enabled_state_for_layout(&self) -> bool {
- self.flags.get().contains(IN_ENABLED_STATE)
- }
- #[inline]
- fn type_id_for_layout(&self) -> NodeTypeId {
- self.type_id
+ fn get_enabled_state_for_layout(&self) -> bool {
+ unsafe {
+ self.get_flag(IN_ENABLED_STATE)
+ }
}
}