tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

non_ts_pseudo_class_list.rs (6126B)


      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 /*
      6 * This file contains a helper macro includes all supported non-tree-structural
      7 * pseudo-classes.
      8 *
      9 * FIXME: Find a way to autogenerate this file.
     10 *
     11 * Expected usage is as follows:
     12 * ```
     13 * macro_rules! pseudo_class_macro{
     14 *     ([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
     15 *         // do stuff
     16 *     }
     17 * }
     18 * apply_non_ts_list!(pseudo_class_macro)
     19 * ```
     20 *
     21 * $state can be either "_" or an expression of type ElementState.  If present,
     22 *        the semantics are that the pseudo-class matches if any of the bits in
     23 *        $state are set on the element.
     24 * $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
     25 * see selector_parser.rs for more details.
     26 */
     27 
     28 macro_rules! apply_non_ts_list {
     29    ($apply_macro:ident) => {
     30        $apply_macro! {
     31            [
     32                ("-moz-table-border-nonzero", MozTableBorderNonzero, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     33                ("-moz-select-list-box", MozSelectListBox, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     34                ("link", Link, UNVISITED, _),
     35                ("any-link", AnyLink, VISITED_OR_UNVISITED, _),
     36                ("visited", Visited, VISITED, _),
     37                ("active", Active, ACTIVE, _),
     38                ("autofill", Autofill, AUTOFILL, _),
     39                ("checked", Checked, CHECKED, _),
     40                ("defined", Defined, DEFINED, _),
     41                ("disabled", Disabled, DISABLED, _),
     42                ("enabled", Enabled, ENABLED, _),
     43                ("focus", Focus, FOCUS, _),
     44                ("focus-within", FocusWithin, FOCUS_WITHIN, _),
     45                ("focus-visible", FocusVisible, FOCUSRING, _),
     46                ("has-slotted", HasSlotted, HAS_SLOTTED, _),
     47                ("hover", Hover, HOVER, _),
     48                ("active-view-transition", ActiveViewTransition, ACTIVE_VIEW_TRANSITION, _),
     49                ("-moz-drag-over", MozDragOver, DRAGOVER, _),
     50                ("target", Target, URLTARGET, _),
     51                ("indeterminate", Indeterminate, INDETERMINATE, _),
     52                ("-moz-inert", MozInert, INERT, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     53                ("-moz-devtools-highlighted", MozDevtoolsHighlighted, DEVTOOLS_HIGHLIGHTED, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     54                ("-moz-styleeditor-transitioning", MozStyleeditorTransitioning, STYLEEDITOR_TRANSITIONING, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     55                ("fullscreen", Fullscreen, FULLSCREEN, _),
     56                ("modal", Modal, MODAL, _),
     57                ("open", Open, OPEN, _),
     58                ("-moz-topmost-modal", MozTopmostModal, TOPMOST_MODAL, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     59                ("-moz-broken", MozBroken, BROKEN, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
     60                ("-moz-has-dir-attr", MozHasDirAttr, HAS_DIR_ATTR, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     61                ("-moz-dir-attr-ltr", MozDirAttrLTR, HAS_DIR_ATTR_LTR, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     62                ("-moz-dir-attr-rtl", MozDirAttrRTL, HAS_DIR_ATTR_RTL, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     63                ("-moz-dir-attr-like-auto", MozDirAttrLikeAuto, HAS_DIR_ATTR_LIKE_AUTO, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     64 
     65                ("-moz-autofill-preview", MozAutofillPreview, AUTOFILL_PREVIEW, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
     66                ("-moz-value-empty", MozValueEmpty, VALUE_EMPTY, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     67                ("-moz-revealed", MozRevealed, REVEALED, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     68                ("-moz-suppress-for-print-selection", MozSuppressForPrintSelection, SUPPRESS_FOR_PRINT_SELECTION, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     69 
     70                ("-moz-math-increment-script-level", MozMathIncrementScriptLevel, INCREMENT_SCRIPT_LEVEL, _),
     71 
     72                ("required", Required, REQUIRED, _),
     73                ("popover-open", PopoverOpen, POPOVER_OPEN, _),
     74                ("optional", Optional, OPTIONAL_, _),
     75                ("valid", Valid, VALID, _),
     76                ("invalid", Invalid, INVALID, _),
     77                ("in-range", InRange, INRANGE, _),
     78                ("out-of-range", OutOfRange, OUTOFRANGE, _),
     79                ("default", Default, DEFAULT, _),
     80                ("placeholder-shown", PlaceholderShown, PLACEHOLDER_SHOWN, _),
     81                ("read-only", ReadOnly, READONLY, _),
     82                ("read-write", ReadWrite, READWRITE, _),
     83                ("user-valid", UserValid, USER_VALID, _),
     84                ("user-invalid", UserInvalid, USER_INVALID, _),
     85                ("-moz-meter-optimum", MozMeterOptimum, OPTIMUM, _),
     86                ("-moz-meter-sub-optimum", MozMeterSubOptimum, SUB_OPTIMUM, _),
     87                ("-moz-meter-sub-sub-optimum", MozMeterSubSubOptimum, SUB_SUB_OPTIMUM, _),
     88 
     89                ("-moz-first-node", MozFirstNode, _, _),
     90                ("-moz-last-node", MozLastNode, _, _),
     91                ("-moz-only-whitespace", MozOnlyWhitespace, _, _),
     92                ("-moz-native-anonymous", MozNativeAnonymous, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
     93                ("-moz-placeholder", MozPlaceholder, _, _),
     94 
     95                // NOTE(emilio): Pseudo-classes below only depend on document state, and thus
     96                // conceptually they should probably be media queries instead.
     97                //
     98                // However that has a set of trade-offs that might not be worth making. In
     99                // particular, such media queries would prevent documents that match them from
    100                // sharing user-agent stylesheets with documents that don't. Also, changes between
    101                // media query results are more expensive than document state changes. So for now
    102                // making them pseudo-classes is probably the right trade-off.
    103                ("-moz-is-html", MozIsHTML, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
    104                ("-moz-window-inactive", MozWindowInactive, _, _),
    105            ]
    106        }
    107    }
    108 }