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 http://mozilla.org/MPL/2.0/. */ 4 5 <%namespace name="helpers" file="/helpers.mako.rs" /> 6 7 <% data.new_style_struct("Background", inherited=False) %> 8 9 ${helpers.predefined_type( 10 "background-color", 11 "Color", 12 "computed_value::T::transparent()", 13 initial_specified_value="SpecifiedValue::transparent()", 14 spec="https://drafts.csswg.org/css-backgrounds/#background-color", 15 animation_value_type="AnimatedColor", 16 ignored_when_colors_disabled=True, 17 allow_quirks=True, 18 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", 19 )} 20 21 ${helpers.predefined_type("background-image", "ImageLayer", 22 initial_value="Either::First(None_)", 23 initial_specified_value="Either::First(None_)", 24 spec="https://drafts.csswg.org/css-backgrounds/#the-background-image", 25 vector="True", 26 animation_value_type="discrete", 27 ignored_when_colors_disabled="True", 28 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} 29 30 % for (axis, direction, initial) in [("x", "Horizontal", "left"), ("y", "Vertical", "top")]: 31 ${helpers.predefined_type( 32 "background-position-" + axis, 33 "position::" + direction + "Position", 34 initial_value="computed::LengthOrPercentage::zero()", 35 initial_specified_value="SpecifiedValue::initial_specified_value()", 36 spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis, 37 animation_value_type="ComputedValue", 38 vector=True, 39 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", 40 )} 41 % endfor 42 43 ${helpers.predefined_type( 44 "background-repeat", 45 "BackgroundRepeat", 46 "computed::BackgroundRepeat::repeat()", 47 initial_specified_value="specified::BackgroundRepeat::repeat()", 48 animation_value_type="discrete", 49 vector=True, 50 spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat", 51 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", 52 )} 53 54 ${helpers.single_keyword("background-attachment", 55 "scroll fixed" + (" local" if product == "gecko" else ""), 56 vector=True, 57 gecko_constant_prefix="NS_STYLE_IMAGELAYER_ATTACHMENT", 58 spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment", 59 animation_value_type="discrete", 60 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} 61 62 ${helpers.single_keyword("background-clip", 63 "border-box padding-box content-box", 64 extra_gecko_values="text", 65 vector=True, extra_prefixes="webkit", 66 gecko_enum_prefix="StyleGeometryBox", 67 spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip", 68 animation_value_type="discrete", 69 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} 70 71 ${helpers.single_keyword("background-origin", 72 "padding-box border-box content-box", 73 vector=True, extra_prefixes="webkit", 74 gecko_enum_prefix="StyleGeometryBox", 75 spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin", 76 animation_value_type="discrete", 77 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} 78 79 ${helpers.predefined_type("background-size", "BackgroundSize", 80 initial_value="computed::BackgroundSize::auto()", 81 initial_specified_value="specified::BackgroundSize::auto()", 82 spec="https://drafts.csswg.org/css-backgrounds/#the-background-size", 83 vector=True, 84 animation_value_type="BackgroundSizeList", 85 need_animatable=True, 86 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", 87 extra_prefixes="webkit")} 88 89 // https://drafts.fxtf.org/compositing/#background-blend-mode 90 ${helpers.single_keyword("background-blend-mode", 91 """normal multiply screen overlay darken lighten color-dodge 92 color-burn hard-light soft-light difference exclusion hue 93 saturation color luminosity""", 94 gecko_constant_prefix="NS_STYLE_BLEND", 95 gecko_pref="layout.css.background-blend-mode.enabled", 96 vector=True, products="gecko", animation_value_type="discrete", 97 spec="https://drafts.fxtf.org/compositing/#background-blend-mode", 98 flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} 99