Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5
//! States elements can be in.
6
7
bitflags! {
8
/// Event-based element states.
9
///
10
/// NB: Is important for this to remain in sync with Gecko's
11
/// dom/events/EventStates.h.
12
///
13
/// Please keep in that order in order for this to be easily auditable.
14
///
15
/// TODO(emilio): We really really want to use the NS_EVENT_STATE bindings
16
/// for this.
17
#[derive(MallocSizeOf)]
18
pub struct ElementState: u64 {
19
/// The mouse is down on this element.
21
/// FIXME(#7333): set/unset this when appropriate
22
const IN_ACTIVE_STATE = 1 << 0;
23
/// This element has focus.
25
const IN_FOCUS_STATE = 1 << 1;
26
/// The mouse is hovering over this element.
28
const IN_HOVER_STATE = 1 << 2;
29
/// Content is enabled (and can be disabled).
31
const IN_ENABLED_STATE = 1 << 3;
32
/// Content is disabled.
34
const IN_DISABLED_STATE = 1 << 4;
35
/// Content is checked.
37
const IN_CHECKED_STATE = 1 << 5;
39
const IN_INDETERMINATE_STATE = 1 << 6;
41
const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7;
43
const IN_TARGET_STATE = 1 << 8;
45
const IN_FULLSCREEN_STATE = 1 << 9;
47
const IN_VALID_STATE = 1 << 10;
49
const IN_INVALID_STATE = 1 << 11;
51
const IN_MOZ_UI_VALID_STATE = 1 << 12;
53
const IN_MOZ_UI_INVALID_STATE = 1 << 13;
55
const IN_BROKEN_STATE = 1 << 14;
57
const IN_USER_DISABLED_STATE = 1 << 15;
59
const IN_SUPPRESSED_STATE = 1 << 16;
61
const IN_LOADING_STATE = 1 << 17;
63
const IN_HANDLER_BLOCKED_STATE = 1 << 18;
65
const IN_HANDLER_DISABLED_STATE = 1 << 19;
67
const IN_HANDLER_CRASHED_STATE = 1 << 20;
69
const IN_REQUIRED_STATE = 1 << 21;
71
const IN_OPTIONAL_STATE = 1 << 22;
73
const IN_READ_WRITE_STATE = 1 << 22;
75
const IN_DEFINED_STATE = 1 << 23;
77
const IN_VISITED_STATE = 1 << 24;
79
const IN_UNVISITED_STATE = 1 << 25;
81
const IN_VISITED_OR_UNVISITED_STATE = ElementState::IN_VISITED_STATE.bits |
82
ElementState::IN_UNVISITED_STATE.bits;
84
const IN_DRAGOVER_STATE = 1 << 26;
86
const IN_INRANGE_STATE = 1 << 27;
88
const IN_OUTOFRANGE_STATE = 1 << 28;
90
const IN_MOZ_READONLY_STATE = 1 << 29;
92
const IN_MOZ_READWRITE_STATE = 1 << 30;
94
const IN_DEFAULT_STATE = 1 << 31;
96
const IN_MOZ_SUBMITINVALID_STATE = 1 << 32;
97
/// Non-standard & undocumented.
98
const IN_OPTIMUM_STATE = 1 << 33;
99
/// Non-standard & undocumented.
100
const IN_SUB_OPTIMUM_STATE = 1 << 34;
101
/// Non-standard & undocumented.
102
const IN_SUB_SUB_OPTIMUM_STATE = 1 << 35;
103
/// Non-standard & undocumented.
104
const IN_DEVTOOLS_HIGHLIGHTED_STATE = 1 << 36;
105
/// Non-standard & undocumented.
106
const IN_STYLEEDITOR_TRANSITIONING_STATE = 1 << 37;
107
/// Non-standard & undocumented.
108
const IN_INCREMENT_SCRIPT_LEVEL_STATE = 1 << 38;
110
const IN_FOCUSRING_STATE = 1 << 39;
111
/// Non-standard & undocumented.
112
const IN_HANDLER_CLICK_TO_PLAY_STATE = 1 << 40;
113
/// Non-standard & undocumented.
114
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41;
115
/// Non-standard & undocumented.
116
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42;
118
const IN_FOCUS_WITHIN_STATE = 1 << 43;
119
/// :dir matching; the states are used for dynamic change detection.
120
/// State that elements that match :dir(ltr) are in.
121
const IN_LTR_STATE = 1 << 44;
122
/// State that elements that match :dir(rtl) are in.
123
const IN_RTL_STATE = 1 << 45;
124
/// State that HTML elements that have a "dir" attr are in.
125
const IN_HAS_DIR_ATTR_STATE = 1 << 46;
126
/// State that HTML elements with dir="ltr" (or something
127
/// case-insensitively equal to "ltr") are in.
128
const IN_HAS_DIR_ATTR_LTR_STATE = 1 << 47;
129
/// State that HTML elements with dir="rtl" (or something
130
/// case-insensitively equal to "rtl") are in.
131
const IN_HAS_DIR_ATTR_RTL_STATE = 1 << 48;
132
/// State that HTML <bdi> elements without a valid-valued "dir" attr or
133
/// any HTML elements (including <bdi>) with dir="auto" (or something
134
/// case-insensitively equal to "auto") are in.
135
const IN_HAS_DIR_ATTR_LIKE_AUTO_STATE = 1 << 49;
136
/// Non-standard & undocumented.
137
const IN_AUTOFILL_STATE = 1 << 50;
138
/// Non-standard & undocumented.
139
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51;
140
}
141
}
142
143
bitflags! {
144
/// Event-based document states.
145
///
146
/// NB: Is important for this to remain in sync with Gecko's
147
/// dom/base/Document.h.
148
#[derive(MallocSizeOf)]
149
pub struct DocumentState: u64 {
150
/// RTL locale: specific to the XUL localedir attribute
151
const NS_DOCUMENT_STATE_RTL_LOCALE = 1 << 0;
152
/// Window activation status
153
const NS_DOCUMENT_STATE_WINDOW_INACTIVE = 1 << 1;
154
}
155
}