Skip to content

Commit

Permalink
make Node.type_id field private
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Sep 5, 2014
1 parent 64a9075 commit 375e475
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/wrapper.rs
Expand Up @@ -383,7 +383,7 @@ impl<'le> TElement for LayoutElement<'le> {

fn get_link(&self) -> Option<&'static str> {
// FIXME: This is HTML only.
match self.element.node.type_id {
match self.element.node.type_id_for_layout() {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#
// selector-link
ElementNodeTypeId(HTMLAnchorElementTypeId) |
Expand Down
7 changes: 6 additions & 1 deletion src/components/script/dom/node.rs
Expand Up @@ -73,7 +73,7 @@ pub struct Node {
pub eventtarget: EventTarget,

/// The type of node that this is.
pub type_id: NodeTypeId,
type_id: NodeTypeId,

/// The parent of this node.
parent_node: Cell<Option<JS<Node>>>,
Expand Down Expand Up @@ -762,6 +762,7 @@ pub trait RawLayoutNodeHelpers {
unsafe fn get_hover_state_for_layout(&self) -> bool;
unsafe fn get_disabled_state_for_layout(&self) -> bool;
unsafe fn get_enabled_state_for_layout(&self) -> bool;
fn type_id_for_layout(&self) -> NodeTypeId;
}

impl RawLayoutNodeHelpers for Node {
Expand All @@ -774,6 +775,10 @@ impl RawLayoutNodeHelpers for Node {
unsafe fn get_enabled_state_for_layout(&self) -> bool {
(*self.unsafe_get_flags()).contains(InEnabledState)
}

fn type_id_for_layout(&self) -> NodeTypeId {
self.type_id
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/components/script/script_task.rs
Expand Up @@ -208,7 +208,7 @@ trait PrivateScriptTaskHelpers {

impl<'a> PrivateScriptTaskHelpers for JSRef<'a, Node> {
fn click_event_filter_by_disabled_state(&self) -> bool {
match self.type_id {
match self.type_id() {
ElementNodeTypeId(HTMLButtonElementTypeId) |
ElementNodeTypeId(HTMLInputElementTypeId) |
// ElementNodeTypeId(HTMLKeygenElementTypeId) |
Expand Down

0 comments on commit 375e475

Please sign in to comment.