diff --git a/components/style/element_state.rs b/components/style/element_state.rs index 842285c8e9b..530de486caf 100644 --- a/components/style/element_state.rs +++ b/components/style/element_state.rs @@ -4,64 +4,116 @@ //! States elements can be in. -#![deny(missing_docs)] - bitflags! { - #[doc = "Event-based element states."] + /// Event-based element states. + /// + /// NB: Is important for this to remain in sync with Gecko's + /// dom/events/EventStates.h. + /// + /// Please keep in that order in order for this to be easily auditable. + /// + /// TODO(emilio): We really really want to use the NS_EVENT_STATE bindings + /// for this. #[cfg_attr(feature = "servo", derive(HeapSizeOf))] - pub flags ElementState: u32 { - #[doc = "The mouse is down on this element. \ - https://html.spec.whatwg.org/multipage/#selector-active \ - FIXME(#7333): set/unset this when appropriate"] + pub flags ElementState: u64 { + /// The mouse is down on this element. + /// https://html.spec.whatwg.org/multipage/#selector-active + /// FIXME(#7333): set/unset this when appropriate const IN_ACTIVE_STATE = 1 << 0, - #[doc = "This element has focus. \ - https://html.spec.whatwg.org/multipage/#selector-focus"] + /// This element has focus. + /// https://html.spec.whatwg.org/multipage/#selector-focus const IN_FOCUS_STATE = 1 << 1, - #[doc = "The mouse is hovering over this element. \ - https://html.spec.whatwg.org/multipage/#selector-hover"] + /// The mouse is hovering over this element. + /// https://html.spec.whatwg.org/multipage/#selector-hover const IN_HOVER_STATE = 1 << 2, - #[doc = "Content is enabled (and can be disabled). \ - http://www.whatwg.org/html/#selector-enabled"] + /// Content is enabled (and can be disabled). + /// http://www.whatwg.org/html/#selector-enabled const IN_ENABLED_STATE = 1 << 3, - #[doc = "Content is disabled. \ - http://www.whatwg.org/html/#selector-disabled"] + /// Content is disabled. + /// http://www.whatwg.org/html/#selector-disabled const IN_DISABLED_STATE = 1 << 4, - #[doc = "Content is checked. \ - https://html.spec.whatwg.org/multipage/#selector-checked"] + /// Content is checked. + /// https://html.spec.whatwg.org/multipage/#selector-checked const IN_CHECKED_STATE = 1 << 5, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-indeterminate"] + /// https://html.spec.whatwg.org/multipage/#selector-indeterminate const IN_INDETERMINATE_STATE = 1 << 6, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-placeholder-shown"] + /// https://html.spec.whatwg.org/multipage/#selector-placeholder-shown const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-target"] + /// https://html.spec.whatwg.org/multipage/#selector-target const IN_TARGET_STATE = 1 << 8, - #[doc = "https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class"] + /// https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class const IN_FULLSCREEN_STATE = 1 << 9, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-valid"] + /// https://html.spec.whatwg.org/multipage/#selector-valid const IN_VALID_STATE = 1 << 10, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-invalid"] + /// https://html.spec.whatwg.org/multipage/#selector-invalid const IN_INVALID_STATE = 1 << 11, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-valid"] + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-valid const IN_MOZ_UI_VALID_STATE = 1 << 12, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-broken"] - const IN_BROKEN_STATE = 1 << 13, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-user-disabled"] - const IN_USER_DISABLED_STATE = 1 << 14, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-suppressed"] - const IN_SUPPRESSED_STATE = 1 << 15, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading"] - const IN_LOADING_STATE = 1 << 16, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-blocked"] - const IN_HANDLER_BLOCKED_STATE = 1 << 17, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-disabled"] - const IN_HANDLER_DISABLED_STATE = 1 << 18, - #[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed"] - const IN_HANDLER_CRASHED_STATE = 1 << 19, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-required"] - const IN_REQUIRED_STATE = 1 << 20, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-optional"] - const IN_OPTIONAL_STATE = 1 << 21, - #[doc = "https://html.spec.whatwg.org/multipage/#selector-read-write"] + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-invalid + const IN_MOZ_UI_INVALID_STATE = 1 << 13, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-broken + const IN_BROKEN_STATE = 1 << 14, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-user-disabled + const IN_USER_DISABLED_STATE = 1 << 15, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-suppressed + const IN_SUPPRESSED_STATE = 1 << 16, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading + const IN_LOADING_STATE = 1 << 18, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-blocked + const IN_HANDLER_BLOCKED_STATE = 1 << 18, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-disabled + const IN_HANDLER_DISABLED_STATE = 1 << 19, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed + const IN_HANDLER_CRASHED_STATE = 1 << 20, + /// https://html.spec.whatwg.org/multipage/#selector-required + const IN_REQUIRED_STATE = 1 << 21, + /// https://html.spec.whatwg.org/multipage/#selector-optional + const IN_OPTIONAL_STATE = 1 << 22, + /// https://html.spec.whatwg.org/multipage/#selector-read-write const IN_READ_WRITE_STATE = 1 << 22, + /// Non-standard: Older custom-elements spec. + const IN_UNRESOLVED_STATE = 1 << 23, + /// https://html.spec.whatwg.org/multipage/#selector-visited + const IN_VISITED_STATE = 1 << 24, + /// https://html.spec.whatwg.org/multipage/#selector-link + const IN_UNVISITED_STATE = 1 << 25, + /// https://drafts.csswg.org/selectors-4/#the-any-link-pseudo + const IN_VISITED_OR_UNVISITED_STATE = IN_VISITED_STATE.bits | IN_UNVISITED_STATE.bits, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over + const IN_DRAGOVER_STATE = 1 << 26, + /// https://html.spec.whatwg.org/multipage/#selector-in-range + const IN_INRANGE_STATE = 1 << 27, + /// https://html.spec.whatwg.org/multipage/#selector-out-of-range + const IN_OUTOFRANGE_STATE = 1 << 28, + /// https://html.spec.whatwg.org/multipage/#selector-read-only + const IN_MOZ_READONLY_STATE = 1 << 29, + /// https://html.spec.whatwg.org/multipage/#selector-read-write + const IN_MOZ_READWRITE_STATE = 1 << 30, + /// https://html.spec.whatwg.org/multipage/#selector-default + const IN_DEFAULT_STATE = 1 << 31, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-submit-invalid + const IN_MOZ_SUBMITINVALID_STATE = 1 << 32, + /// Non-standard & undocumented. + const IN_OPTIMUM_STATE = 1 << 33, + /// Non-standard & undocumented. + const IN_SUB_OPTIMUM_STATE = 1 << 34, + /// Non-standard & undocumented. + const IN_SUB_SUB_OPTIMUM_STATE = 1 << 35, + /// Non-standard & undocumented. + const IN_DEVTOOLS_HIGHLIGHTED_STATE = 1 << 36, + /// Non-standard & undocumented. + const IN_STYLEEDITOR_TRANSITIONING_STATE = 1 << 37, + /// Non-standard & undocumented. + const IN_INCREMENT_SCRIPT_LEVEL_STATE = 1 << 38, + /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-focusring + const IN_FOCUSRING_STATE = 1 << 39, + /// Non-standard & undocumented. + const IN_HANDLER_CLICK_TO_PLAY_STATE = 1 << 40, + /// Non-standard & undocumented. + const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41, + /// Non-standard & undocumented. + const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42, + /// https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo + const IN_FOCUS_WITHIN_STATE = 1 << 43, } } diff --git a/components/style/gecko/non_ts_pseudo_class_list.rs b/components/style/gecko/non_ts_pseudo_class_list.rs index 43a35ae5536..4d9b91384a1 100644 --- a/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/components/style/gecko/non_ts_pseudo_class_list.rs @@ -23,6 +23,20 @@ * The string variables will be applied to pseudoclasses that are of the form * of a function with a string argument. * + * Pending pseudo-classes: + * + * :-moz-is-html -> Used only in UA sheets, should be easy to support. + * :-moz-native-anonymous -> For devtools, seems easy-ish? + * :-moz-bound-element -> Seems unused, should be easy to remove. + * + * :-moz-lwtheme, :-moz-lwtheme-brighttext, :-moz-lwtheme-darktext, + * :-moz-window-inactive. + * + * :scope ->