mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
make Node.type_id field private
This commit is contained in:
parent
64a9075535
commit
375e475f99
3 changed files with 8 additions and 3 deletions
|
@ -383,7 +383,7 @@ impl<'le> TElement for LayoutElement<'le> {
|
||||||
|
|
||||||
fn get_link(&self) -> Option<&'static str> {
|
fn get_link(&self) -> Option<&'static str> {
|
||||||
// FIXME: This is HTML only.
|
// 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#
|
// http://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#
|
||||||
// selector-link
|
// selector-link
|
||||||
ElementNodeTypeId(HTMLAnchorElementTypeId) |
|
ElementNodeTypeId(HTMLAnchorElementTypeId) |
|
||||||
|
|
|
@ -73,7 +73,7 @@ pub struct Node {
|
||||||
pub eventtarget: EventTarget,
|
pub eventtarget: EventTarget,
|
||||||
|
|
||||||
/// The type of node that this is.
|
/// The type of node that this is.
|
||||||
pub type_id: NodeTypeId,
|
type_id: NodeTypeId,
|
||||||
|
|
||||||
/// The parent of this node.
|
/// The parent of this node.
|
||||||
parent_node: Cell<Option<JS<Node>>>,
|
parent_node: Cell<Option<JS<Node>>>,
|
||||||
|
@ -762,6 +762,7 @@ pub trait RawLayoutNodeHelpers {
|
||||||
unsafe fn get_hover_state_for_layout(&self) -> bool;
|
unsafe fn get_hover_state_for_layout(&self) -> bool;
|
||||||
unsafe fn get_disabled_state_for_layout(&self) -> bool;
|
unsafe fn get_disabled_state_for_layout(&self) -> bool;
|
||||||
unsafe fn get_enabled_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 {
|
impl RawLayoutNodeHelpers for Node {
|
||||||
|
@ -774,6 +775,10 @@ impl RawLayoutNodeHelpers for Node {
|
||||||
unsafe fn get_enabled_state_for_layout(&self) -> bool {
|
unsafe fn get_enabled_state_for_layout(&self) -> bool {
|
||||||
(*self.unsafe_get_flags()).contains(InEnabledState)
|
(*self.unsafe_get_flags()).contains(InEnabledState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn type_id_for_layout(&self) -> NodeTypeId {
|
||||||
|
self.type_id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ trait PrivateScriptTaskHelpers {
|
||||||
|
|
||||||
impl<'a> PrivateScriptTaskHelpers for JSRef<'a, Node> {
|
impl<'a> PrivateScriptTaskHelpers for JSRef<'a, Node> {
|
||||||
fn click_event_filter_by_disabled_state(&self) -> bool {
|
fn click_event_filter_by_disabled_state(&self) -> bool {
|
||||||
match self.type_id {
|
match self.type_id() {
|
||||||
ElementNodeTypeId(HTMLButtonElementTypeId) |
|
ElementNodeTypeId(HTMLButtonElementTypeId) |
|
||||||
ElementNodeTypeId(HTMLInputElementTypeId) |
|
ElementNodeTypeId(HTMLInputElementTypeId) |
|
||||||
// ElementNodeTypeId(HTMLKeygenElementTypeId) |
|
// ElementNodeTypeId(HTMLKeygenElementTypeId) |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue