summaryrefslogtreecommitdiffstats
path: root/servo/components/style/properties/longhands/background.mako.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /servo/components/style/properties/longhands/background.mako.rs
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/properties/longhands/background.mako.rs')
-rw-r--r--servo/components/style/properties/longhands/background.mako.rs116
1 files changed, 116 insertions, 0 deletions
diff --git a/servo/components/style/properties/longhands/background.mako.rs b/servo/components/style/properties/longhands/background.mako.rs
new file mode 100644
index 0000000000..76b71b12cd
--- /dev/null
+++ b/servo/components/style/properties/longhands/background.mako.rs
@@ -0,0 +1,116 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+
+<%namespace name="helpers" file="/helpers.mako.rs" />
+
+<% data.new_style_struct("Background", inherited=False) %>
+
+${helpers.predefined_type(
+ "background-color",
+ "Color",
+ "computed::Color::transparent()",
+ engines="gecko servo-2013 servo-2020",
+ initial_specified_value="SpecifiedValue::transparent()",
+ spec="https://drafts.csswg.org/css-backgrounds/#background-color",
+ animation_value_type="AnimatedColor",
+ ignored_when_colors_disabled=True,
+ allow_quirks="Yes",
+ flags="CAN_ANIMATE_ON_COMPOSITOR",
+)}
+
+${helpers.predefined_type(
+ "background-image",
+ "Image",
+ engines="gecko servo-2013 servo-2020",
+ initial_value="computed::Image::None",
+ initial_specified_value="specified::Image::None",
+ spec="https://drafts.csswg.org/css-backgrounds/#the-background-image",
+ vector="True",
+ animation_value_type="discrete",
+ ignored_when_colors_disabled="True",
+)}
+
+% for (axis, direction, initial) in [("x", "Horizontal", "left"), ("y", "Vertical", "top")]:
+ ${helpers.predefined_type(
+ "background-position-" + axis,
+ "position::" + direction + "Position",
+ "computed::LengthPercentage::zero_percent()",
+ engines="gecko servo-2013 servo-2020",
+ initial_specified_value="SpecifiedValue::initial_specified_value()",
+ spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis,
+ animation_value_type="ComputedValue",
+ vector=True,
+ vector_animation_type="repeatable_list",
+ )}
+% endfor
+
+${helpers.predefined_type(
+ "background-repeat",
+ "BackgroundRepeat",
+ "computed::BackgroundRepeat::repeat()",
+ engines="gecko servo-2013 servo-2020",
+ initial_specified_value="specified::BackgroundRepeat::repeat()",
+ animation_value_type="discrete",
+ vector=True,
+ spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat",
+)}
+
+${helpers.single_keyword(
+ "background-attachment",
+ "scroll" + (" fixed" if engine in ["gecko", "servo-2013"] else "") + (" local" if engine == "gecko" else ""),
+ engines="gecko servo-2013 servo-2020",
+ vector=True,
+ gecko_enum_prefix="StyleImageLayerAttachment",
+ spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment",
+ animation_value_type="discrete",
+)}
+
+${helpers.single_keyword(
+ "background-clip",
+ "border-box padding-box content-box",
+ engines="gecko servo-2013 servo-2020",
+ extra_gecko_values="text",
+ vector=True, extra_prefixes="webkit",
+ gecko_enum_prefix="StyleGeometryBox",
+ gecko_inexhaustive=True,
+ spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip",
+ animation_value_type="discrete",
+)}
+
+${helpers.single_keyword(
+ "background-origin",
+ "padding-box border-box content-box",
+ engines="gecko servo-2013 servo-2020",
+ vector=True, extra_prefixes="webkit",
+ gecko_enum_prefix="StyleGeometryBox",
+ gecko_inexhaustive=True,
+ spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin",
+ animation_value_type="discrete",
+)}
+
+${helpers.predefined_type(
+ "background-size",
+ "BackgroundSize",
+ engines="gecko servo-2013 servo-2020",
+ initial_value="computed::BackgroundSize::auto()",
+ initial_specified_value="specified::BackgroundSize::auto()",
+ spec="https://drafts.csswg.org/css-backgrounds/#the-background-size",
+ vector=True,
+ vector_animation_type="repeatable_list",
+ animation_value_type="BackgroundSizeList",
+ extra_prefixes="webkit")}
+
+// https://drafts.fxtf.org/compositing/#background-blend-mode
+${helpers.single_keyword(
+ "background-blend-mode",
+ """normal multiply screen overlay darken lighten color-dodge
+ color-burn hard-light soft-light difference exclusion hue
+ saturation color luminosity""",
+ gecko_enum_prefix="StyleBlend",
+ vector=True,
+ engines="gecko",
+ animation_value_type="discrete",
+ gecko_inexhaustive=True,
+ spec="https://drafts.fxtf.org/compositing/#background-blend-mode",
+)}