tor-browser

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

inherited_text.mako.rs (12139B)


      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 <%namespace name="helpers" file="/helpers.mako.rs" />
      6 
      7 ${helpers.predefined_type(
      8    "color",
      9    "ColorPropertyValue",
     10    "crate::color::AbsoluteColor::BLACK",
     11    engines="gecko servo",
     12    ignored_when_colors_disabled="True",
     13    spec="https://drafts.csswg.org/css-color/#color",
     14    servo_restyle_damage="repaint",
     15    affects="paint",
     16 )}
     17 
     18 // CSS Text Module Level 3
     19 
     20 ${helpers.predefined_type(
     21    "text-transform",
     22    "TextTransform",
     23    "computed::TextTransform::none()",
     24    engines="gecko servo",
     25    animation_type="discrete",
     26    spec="https://drafts.csswg.org/css-text/#propdef-text-transform",
     27    servo_restyle_damage="rebuild_box",
     28    affects="layout",
     29 )}
     30 
     31 ${helpers.single_keyword(
     32    "hyphens",
     33    "manual none auto",
     34    engines="gecko",
     35    gecko_enum_prefix="StyleHyphens",
     36    animation_type="discrete",
     37    extra_prefixes="moz",
     38    spec="https://drafts.csswg.org/css-text/#propdef-hyphens",
     39    affects="layout",
     40 )}
     41 
     42 // TODO: Support <percentage>
     43 ${helpers.single_keyword(
     44    "-moz-text-size-adjust",
     45    "auto none",
     46    engines="gecko",
     47    gecko_enum_prefix="StyleTextSizeAdjust",
     48    gecko_ffi_name="mTextSizeAdjust",
     49    animation_type="discrete",
     50    spec="https://drafts.csswg.org/css-size-adjust/#adjustment-control",
     51    aliases="-webkit-text-size-adjust",
     52    affects="layout",
     53 )}
     54 
     55 ${helpers.predefined_type(
     56    "text-indent",
     57    "TextIndent",
     58    "computed::TextIndent::zero()",
     59    engines="gecko servo",
     60    spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
     61    servo_restyle_damage = "rebuild_box",
     62    affects="layout",
     63 )}
     64 
     65 // Also known as "word-wrap" (which is more popular because of IE), but this is
     66 // the preferred name per CSS-TEXT 6.2.
     67 ${helpers.predefined_type(
     68    "overflow-wrap",
     69    "OverflowWrap",
     70    "computed::OverflowWrap::Normal",
     71    engines="gecko servo",
     72    animation_type="discrete",
     73    spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
     74    aliases="word-wrap",
     75    servo_restyle_damage="rebuild_box",
     76    affects="layout",
     77 )}
     78 
     79 ${helpers.predefined_type(
     80    "word-break",
     81    "WordBreak",
     82    "computed::WordBreak::Normal",
     83    engines="gecko servo",
     84    animation_type="discrete",
     85    spec="https://drafts.csswg.org/css-text/#propdef-word-break",
     86    servo_restyle_damage="rebuild_box",
     87    affects="layout",
     88 )}
     89 
     90 ${helpers.predefined_type(
     91    "text-justify",
     92    "TextJustify",
     93    "computed::TextJustify::Auto",
     94    engines="gecko servo",
     95    animation_type="discrete",
     96    spec="https://drafts.csswg.org/css-text/#propdef-text-justify",
     97    servo_restyle_damage="rebuild_box",
     98    affects="layout",
     99 )}
    100 
    101 ${helpers.predefined_type(
    102    "text-align-last",
    103    "TextAlignLast",
    104    "computed::text::TextAlignLast::Auto",
    105    engines="gecko servo",
    106    animation_type="discrete",
    107    spec="https://drafts.csswg.org/css-text/#propdef-text-align-last",
    108    affects="layout",
    109 )}
    110 
    111 // TODO make this a shorthand and implement text-align-last/text-align-all
    112 ${helpers.predefined_type(
    113    "text-align",
    114    "TextAlign",
    115    "computed::TextAlign::Start",
    116    engines="gecko servo",
    117    animation_type="discrete",
    118    spec="https://drafts.csswg.org/css-text/#propdef-text-align",
    119    servo_restyle_damage = "rebuild_box",
    120    affects="layout",
    121 )}
    122 
    123 ${helpers.predefined_type(
    124    "letter-spacing",
    125    "LetterSpacing",
    126    "computed::LetterSpacing::normal()",
    127    engines="gecko servo",
    128    spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing",
    129    servo_restyle_damage="rebuild_box",
    130    affects="layout",
    131 )}
    132 
    133 ${helpers.predefined_type(
    134    "word-spacing",
    135    "WordSpacing",
    136    "computed::WordSpacing::zero()",
    137    engines="gecko servo",
    138    spec="https://drafts.csswg.org/css-text/#propdef-word-spacing",
    139    servo_restyle_damage="rebuild_box",
    140    affects="layout",
    141 )}
    142 
    143 // TODO: `white-space-collapse: discard` not yet supported
    144 ${helpers.single_keyword(
    145    name="white-space-collapse",
    146    values="collapse preserve preserve-breaks break-spaces",
    147    extra_gecko_values="preserve-spaces",
    148    gecko_aliases="-moz-pre-space=preserve-spaces",
    149    engines="gecko servo",
    150    gecko_enum_prefix="StyleWhiteSpaceCollapse",
    151    animation_type="discrete",
    152    spec="https://drafts.csswg.org/css-text-4/#propdef-white-space-collapse",
    153    servo_restyle_damage="rebuild_box",
    154    affects="layout",
    155 )}
    156 
    157 ${helpers.predefined_type(
    158    "text-autospace",
    159    "TextAutospace",
    160    "computed::text::TextAutospace::NO_AUTOSPACE",
    161    engines="gecko",
    162    animation_type="discrete",
    163    gecko_pref="layout.css.text-autospace.enabled",
    164    has_effect_on_gecko_scrollbars=False,
    165    spec="https://drafts.csswg.org/css-text-4/#text-autospace-property",
    166    affects="layout",
    167 )}
    168 
    169 ${helpers.predefined_type(
    170    "text-shadow",
    171    "SimpleShadow",
    172    None,
    173    engines="gecko servo",
    174    vector=True,
    175    vector_animation_type="with_zero",
    176    ignored_when_colors_disabled=True,
    177    simple_vector_bindings=True,
    178    spec="https://drafts.csswg.org/css-text-decor-3/#text-shadow-property",
    179    affects="overflow",
    180 )}
    181 
    182 ${helpers.predefined_type(
    183    "text-emphasis-style",
    184    "TextEmphasisStyle",
    185    "computed::TextEmphasisStyle::None",
    186    engines="gecko",
    187    initial_specified_value="SpecifiedValue::None",
    188    animation_type="discrete",
    189    spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-style",
    190    affects="overflow",
    191 )}
    192 
    193 ${helpers.predefined_type(
    194    "text-emphasis-position",
    195    "TextEmphasisPosition",
    196    "computed::TextEmphasisPosition::AUTO",
    197    engines="gecko",
    198    initial_specified_value="specified::TextEmphasisPosition::AUTO",
    199    animation_type="discrete",
    200    spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-position",
    201    affects="layout",
    202 )}
    203 
    204 ${helpers.predefined_type(
    205    "text-emphasis-color",
    206    "Color",
    207    "computed_value::T::currentcolor()",
    208    engines="gecko",
    209    initial_specified_value="specified::Color::currentcolor()",
    210    ignored_when_colors_disabled=True,
    211    spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color",
    212    affects="paint",
    213 )}
    214 
    215 ${helpers.predefined_type(
    216    "tab-size",
    217    "NonNegativeLengthOrNumber",
    218    "generics::length::LengthOrNumber::Number(From::from(8.0))",
    219    engines="gecko",
    220    spec="https://drafts.csswg.org/css-text-3/#tab-size-property",
    221    aliases="-moz-tab-size",
    222    affects="layout",
    223 )}
    224 
    225 ${helpers.predefined_type(
    226    "line-break",
    227    "LineBreak",
    228    "computed::LineBreak::Auto",
    229    engines="gecko",
    230    animation_type="discrete",
    231    spec="https://drafts.csswg.org/css-text-3/#line-break-property",
    232    affects="layout",
    233 )}
    234 
    235 // CSS Compatibility
    236 // https://compat.spec.whatwg.org
    237 ${helpers.predefined_type(
    238    "-webkit-text-fill-color",
    239    "Color",
    240    "computed_value::T::currentcolor()",
    241    engines="gecko",
    242    ignored_when_colors_disabled=True,
    243    spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color",
    244    affects="paint",
    245 )}
    246 
    247 ${helpers.predefined_type(
    248    "-webkit-text-stroke-color",
    249    "Color",
    250    "computed_value::T::currentcolor()",
    251    initial_specified_value="specified::Color::currentcolor()",
    252    engines="gecko",
    253    ignored_when_colors_disabled=True,
    254    spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color",
    255    affects="paint",
    256 )}
    257 
    258 ${helpers.predefined_type(
    259    "-webkit-text-stroke-width",
    260    "LineWidth",
    261    "app_units::Au(0)",
    262    engines="gecko",
    263    initial_specified_value="specified::LineWidth::zero()",
    264    spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width",
    265    animation_type="discrete",
    266    affects="overflow",
    267 )}
    268 
    269 // CSS Ruby Layout Module Level 1
    270 // https://drafts.csswg.org/css-ruby/
    271 ${helpers.single_keyword(
    272    "ruby-align",
    273    "space-around start center space-between",
    274    engines="gecko",
    275    animation_type="discrete",
    276    gecko_enum_prefix="StyleRubyAlign",
    277    spec="https://drafts.csswg.org/css-ruby/#ruby-align-property",
    278    affects="layout",
    279 )}
    280 
    281 ${helpers.predefined_type(
    282    "ruby-position",
    283    "RubyPosition",
    284    "computed::RubyPosition::AlternateOver",
    285    engines="gecko",
    286    spec="https://drafts.csswg.org/css-ruby/#ruby-position-property",
    287    animation_type="discrete",
    288    affects="layout",
    289 )}
    290 
    291 // CSS Writing Modes Module Level 3
    292 // https://drafts.csswg.org/css-writing-modes-3/
    293 
    294 ${helpers.single_keyword(
    295    "text-combine-upright",
    296    "none all",
    297    engines="gecko",
    298    gecko_enum_prefix="StyleTextCombineUpright",
    299    animation_type="none",
    300    spec="https://drafts.csswg.org/css-writing-modes-3/#text-combine-upright",
    301    affects="layout",
    302 )}
    303 
    304 // SVG 2: Section 13 - Painting: Filling, Stroking and Marker Symbols
    305 ${helpers.single_keyword(
    306    "text-rendering",
    307    "auto optimizespeed optimizelegibility geometricprecision",
    308    engines="gecko servo",
    309    gecko_enum_prefix="StyleTextRendering",
    310    animation_type="discrete",
    311    spec="https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty",
    312    servo_restyle_damage="rebuild_box",
    313    affects="layout",
    314 )}
    315 
    316 ${helpers.predefined_type(
    317    "-moz-control-character-visibility",
    318    "text::MozControlCharacterVisibility",
    319    "Default::default()",
    320    engines="gecko",
    321    enabled_in="chrome",
    322    gecko_pref="layout.css.moz-control-character-visibility.enabled",
    323    has_effect_on_gecko_scrollbars=False,
    324    animation_type="none",
    325    spec="Nonstandard",
    326    affects="layout",
    327 )}
    328 
    329 // text underline offset
    330 ${helpers.predefined_type(
    331    "text-underline-offset",
    332    "LengthPercentageOrAuto",
    333    "computed::LengthPercentageOrAuto::auto()",
    334    engines="gecko",
    335    spec="https://drafts.csswg.org/css-text-decor-4/#underline-offset",
    336    affects="overflow",
    337 )}
    338 
    339 // text underline position
    340 ${helpers.predefined_type(
    341    "text-underline-position",
    342    "TextUnderlinePosition",
    343    "computed::TextUnderlinePosition::AUTO",
    344    engines="gecko",
    345    animation_type="discrete",
    346    spec="https://drafts.csswg.org/css-text-decor-3/#text-underline-position-property",
    347    affects="overflow",
    348 )}
    349 
    350 // text decoration skip ink
    351 ${helpers.predefined_type(
    352    "text-decoration-skip-ink",
    353    "TextDecorationSkipInk",
    354    "computed::TextDecorationSkipInk::Auto",
    355    engines="gecko",
    356    animation_type="discrete",
    357    spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property",
    358    affects="overflow",
    359 )}
    360 
    361 // hyphenation character
    362 ${helpers.predefined_type(
    363    "hyphenate-character",
    364    "HyphenateCharacter",
    365    "computed::HyphenateCharacter::Auto",
    366    engines="gecko",
    367    animation_type="discrete",
    368    spec="https://www.w3.org/TR/css-text-4/#hyphenate-character",
    369    affects="layout",
    370 )}
    371 
    372 ${helpers.predefined_type(
    373    "forced-color-adjust",
    374    "ForcedColorAdjust",
    375    "computed::ForcedColorAdjust::Auto",
    376    engines="gecko",
    377    animation_type="discrete",
    378    spec="https://drafts.csswg.org/css-color-adjust-1/#forced-color-adjust-prop",
    379    affects="paint",
    380 )}
    381 
    382 ${helpers.single_keyword(
    383    "-webkit-text-security",
    384    "none circle disc square",
    385    engines="gecko",
    386    gecko_enum_prefix="StyleTextSecurity",
    387    animation_type="discrete",
    388    spec="https://drafts.csswg.org/css-text/#MISSING",
    389    affects="layout",
    390 )}
    391 
    392 ${helpers.single_keyword(
    393    "text-wrap-mode",
    394    "wrap nowrap",
    395    engines="gecko servo",
    396    gecko_enum_prefix="StyleTextWrapMode",
    397    animation_type="discrete",
    398    spec="https://drafts.csswg.org/css-text-4/#propdef-text-wrap-mode",
    399    servo_restyle_damage="rebuild_box",
    400    affects="layout",
    401 )}
    402 
    403 // hyphenation length thresholds
    404 ${helpers.predefined_type(
    405    "hyphenate-limit-chars",
    406    "HyphenateLimitChars",
    407    "computed::HyphenateLimitChars::auto()",
    408    engines="gecko",
    409    spec="https://drafts.csswg.org/css-text-4/#hyphenate-char-limits",
    410    affects="layout",
    411    boxed=True,
    412 )}
    413 
    414 ${helpers.single_keyword(
    415    "text-wrap-style",
    416    "auto stable balance",
    417    engines="gecko",
    418    gecko_enum_prefix="StyleTextWrapStyle",
    419    animation_type="discrete",
    420    spec="https://drafts.csswg.org/css-text-4/#text-wrap-style",
    421    affects="layout",
    422 )}