Source code
Revision control
Copy as Markdown
Other Tools
/* 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
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import ALL_SIZES, PHYSICAL_SIDES, LOGICAL_SIDES, DEFAULT_RULES_AND_POSITION_TRY %>
// "top" / "left" / "bottom" / "right"
% for index, side in enumerate(PHYSICAL_SIDES):
${helpers.predefined_type(
side,
"Inset",
"computed::Inset::auto()",
engines="gecko servo",
allow_quirks="Yes",
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
gecko_ffi_name="mOffset.{}".format(index),
servo_restyle_damage="reflow_out_of_flow",
logical_group="inset",
affects="layout",
)}
% endfor
// inset-* logical properties, map to "top" / "left" / "bottom" / "right"
% for side in LOGICAL_SIDES:
${helpers.predefined_type(
"inset-%s" % side,
"Inset",
"computed::Inset::auto()",
engines="gecko servo",
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
logical=True,
logical_group="inset",
affects="layout",
)}
% endfor
${helpers.predefined_type(
"z-index",
"ZIndex",
"computed::ZIndex::auto()",
engines="gecko servo",
affects="paint",
)}
// CSS Flexible Box Layout Module Level 1
// Flex container properties
${helpers.single_keyword(
"flex-direction",
"row row-reverse column column-reverse",
engines="gecko servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
animation_type="discrete",
servo_restyle_damage = "reflow",
gecko_enum_prefix = "StyleFlexDirection",
affects="layout",
)}
${helpers.single_keyword(
"flex-wrap",
"nowrap wrap wrap-reverse",
engines="gecko servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
animation_type="discrete",
servo_restyle_damage = "reflow",
gecko_enum_prefix = "StyleFlexWrap",
affects="layout",
)}
${helpers.predefined_type(
"justify-content",
"JustifyContent",
"specified::JustifyContent(specified::ContentDistribution::normal())",
engines="gecko servo",
extra_prefixes="webkit",
animation_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"align-content",
"AlignContent",
"specified::AlignContent(specified::ContentDistribution::normal())",
engines="gecko servo",
extra_prefixes="webkit",
animation_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"align-items",
"AlignItems",
"specified::AlignItems::normal()",
engines="gecko servo",
extra_prefixes="webkit",
animation_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"justify-items",
"JustifyItems",
"computed::JustifyItems::legacy()",
engines="gecko servo",
animation_type="discrete",
affects="layout",
)}
// Flex item properties
${helpers.predefined_type(
"flex-grow",
"NonNegativeNumber",
"From::from(0.0)",
engines="gecko servo",
extra_prefixes="webkit",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"flex-shrink",
"NonNegativeNumber",
"From::from(1.0)",
engines="gecko servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
servo_restyle_damage = "reflow",
affects="layout",
)}
${helpers.predefined_type(
"align-self",
"AlignSelf",
"specified::AlignSelf(specified::SelfAlignment::auto())",
engines="gecko servo",
extra_prefixes="webkit",
animation_type="discrete",
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
affects="layout",
)}
${helpers.predefined_type(
"justify-self",
"JustifySelf",
"specified::JustifySelf(specified::SelfAlignment::auto())",
engines="gecko servo",
animation_type="discrete",
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
affects="layout",
)}
${helpers.predefined_type(
"order",
"Integer",
"0",
engines="gecko servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"flex-basis",
"FlexBasis",
"computed::FlexBasis::auto()",
engines="gecko servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
servo_restyle_damage="reflow",
boxed=True,
affects="layout",
)}
% for (size, logical) in ALL_SIZES:
<%
if logical:
%>
// width, height, block-size, inline-size
${helpers.predefined_type(
size,
"Size",
"computed::Size::auto()",
engines="gecko servo",
logical=logical,
logical_group="size",
allow_quirks="No" if logical else "Yes",
spec=spec % size,
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
servo_restyle_damage="reflow",
affects="layout",
)}
// min-width, min-height, min-block-size, min-inline-size
${helpers.predefined_type(
"min-%s" % size,
"Size",
"computed::Size::auto()",
engines="gecko servo",
logical=logical,
logical_group="min-size",
allow_quirks="No" if logical else "Yes",
spec=spec % size,
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"max-%s" % size,
"MaxSize",
"computed::MaxSize::none()",
engines="gecko servo",
logical=logical,
logical_group="max-size",
allow_quirks="No" if logical else "Yes",
spec=spec % size,
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
servo_restyle_damage="reflow",
affects="layout",
)}
% endfor
${helpers.predefined_type(
"position-anchor",
"PositionAnchor",
"computed::PositionAnchor::auto()",
engines="gecko",
animation_type="discrete",
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
gecko_pref="layout.css.anchor-positioning.enabled",
affects="layout",
)}
${helpers.predefined_type(
"position-area",
"PositionArea",
"computed::PositionArea::none()",
engines="gecko",
initial_specified_value="specified::PositionArea::none()",
animation_type="discrete",
rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY,
gecko_pref="layout.css.anchor-positioning.enabled",
affects="layout",
)}
${helpers.predefined_type(
"position-visibility",
"PositionVisibility",
"computed::PositionVisibility::ALWAYS",
engines="gecko",
initial_specified_value="specified::PositionVisibility::ALWAYS",
animation_type="discrete",
gecko_pref="layout.css.anchor-positioning.enabled",
affects="layout",
)}
${helpers.predefined_type(
"position-try-fallbacks",
"PositionTryFallbacks",
"computed::PositionTryFallbacks::none()",
engines="gecko",
initial_specified_value="specified::PositionTryFallbacks::none()",
animation_type="discrete",
gecko_pref="layout.css.anchor-positioning.enabled",
affects="layout",
)}
${helpers.predefined_type(
"position-try-order",
"PositionTryOrder",
"computed::PositionTryOrder::normal()",
engines="gecko",
initial_specified_value="specified::PositionTryOrder::normal()",
animation_type="discrete",
gecko_pref="layout.css.anchor-positioning.enabled",
affects="layout",
)}
${helpers.single_keyword(
"box-sizing",
"content-box border-box",
engines="gecko servo",
extra_prefixes="moz:layout.css.prefixes.box-sizing webkit",
gecko_enum_prefix="StyleBoxSizing",
custom_consts={ "content-box": "Content", "border-box": "Border" },
animation_type="discrete",
servo_restyle_damage = "reflow",
affects="layout",
)}
${helpers.single_keyword(
"object-fit",
"fill contain cover none scale-down",
engines="gecko servo",
animation_type="discrete",
gecko_enum_prefix = "StyleObjectFit",
affects="layout",
)}
${helpers.predefined_type(
"object-position",
"Position",
"computed::Position::center()",
engines="gecko servo",
boxed=True,
affects="layout",
)}
% for kind in ["row", "column"]:
% for range in ["start", "end"]:
${helpers.predefined_type(
"grid-%s-%s" % (kind, range),
"GridLine",
"Default::default()",
engines="gecko servo",
servo_pref="layout.grid.enabled",
animation_type="discrete",
affects="layout",
)}
% endfor
${helpers.predefined_type(
"grid-auto-%ss" % kind,
"ImplicitGridTracks",
"Default::default()",
engines="gecko servo",
servo_pref="layout.grid.enabled",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"grid-template-%ss" % kind,
"GridTemplateComponent",
"specified::GenericGridTemplateComponent::None",
engines="gecko servo",
servo_pref="layout.grid.enabled",
affects="layout",
)}
% endfor
${helpers.predefined_type(
"masonry-auto-flow",
"MasonryAutoFlow",
"computed::MasonryAutoFlow::initial()",
engines="gecko",
gecko_pref="layout.css.grid-template-masonry-value.enabled",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"grid-auto-flow",
"GridAutoFlow",
"computed::GridAutoFlow::ROW",
engines="gecko servo",
servo_pref="layout.grid.enabled",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"grid-template-areas",
"GridTemplateAreas",
"computed::GridTemplateAreas::none()",
engines="gecko servo",
servo_pref="layout.grid.enabled",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"column-gap",
"length::NonNegativeLengthPercentageOrNormal",
"computed::length::NonNegativeLengthPercentageOrNormal::normal()",
engines="gecko servo",
aliases="grid-column-gap",
servo_pref="layout.flexbox.enabled",
servo_restyle_damage="reflow",
affects="layout",
)}
// no need for -moz- prefixed alias for this property
${helpers.predefined_type(
"row-gap",
"length::NonNegativeLengthPercentageOrNormal",
"computed::length::NonNegativeLengthPercentageOrNormal::normal()",
engines="gecko servo",
aliases="grid-row-gap",
servo_pref="layout.flexbox.enabled",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"aspect-ratio",
"AspectRatio",
"computed::AspectRatio::auto()",
engines="gecko servo",
servo_restyle_damage="reflow",
affects="layout",
)}
% for (size, logical) in ALL_SIZES:
${helpers.predefined_type(
"contain-intrinsic-" + size,
"ContainIntrinsicSize",
"computed::ContainIntrinsicSize::None",
engines="gecko",
logical_group="contain-intrinsic-size",
logical=logical,
gecko_pref="layout.css.contain-intrinsic-size.enabled",
affects="layout",
)}
% endfor