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
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import ALL_AXES %>
${helpers.predefined_type(
"display",
"Display",
"computed::Display::inline()",
engines="gecko servo",
initial_specified_value="specified::Display::inline()",
animation_type="discrete",
servo_restyle_damage="rebuild_and_reflow",
affects="layout",
)}
${helpers.single_keyword(
"-moz-top-layer",
"none auto",
engines="gecko",
gecko_enum_prefix="StyleTopLayer",
gecko_ffi_name="mTopLayer",
animation_type="discrete",
enabled_in="ua",
spec="Internal (not web-exposed)",
affects="layout",
)}
// An internal-only property for elements in a top layer
${helpers.single_keyword(
"-servo-top-layer",
"none top",
engines="servo",
animation_type="none",
enabled_in="ua",
spec="Internal (not web-exposed)",
affects="layout",
)}
<%helpers:single_keyword
name="position"
values="static absolute relative fixed sticky"
engines="gecko servo"
animation_type="discrete"
gecko_enum_prefix="StylePositionProperty"
servo_restyle_damage="rebuild_and_reflow"
affects="layout"
>
impl computed_value::T {
pub fn is_absolutely_positioned(self) -> bool {
matches!(self, Self::Absolute | Self::Fixed)
}
pub fn is_relative(self) -> bool {
self == Self::Relative
}
}
</%helpers:single_keyword>
// Changes do not invalidate our element. We handle notify/invalidating
// elements that reference anchor-name elsewhere.
${helpers.predefined_type(
"anchor-name",
"AnchorName",
"computed::AnchorName::none()",
engines="gecko",
animation_type="discrete",
gecko_pref="layout.css.anchor-positioning.enabled",
affects="",
)}
// Changes do not invalidate our element. We handle notify/invalidating
// any affected descendants elsewhere.
${helpers.predefined_type(
"anchor-scope",
"AnchorScope",
"computed::AnchorScope::none()",
engines="gecko",
animation_type="discrete",
gecko_pref="layout.css.anchor-positioning.enabled",
affects="",
)}
${helpers.predefined_type(
"float",
"Float",
"computed::Float::None",
engines="gecko servo",
initial_specified_value="specified::Float::None",
animation_type="discrete",
servo_restyle_damage="rebuild_and_reflow",
gecko_ffi_name="mFloat",
affects="layout",
)}
${helpers.predefined_type(
"clear",
"Clear",
"computed::Clear::None",
engines="gecko servo",
animation_type="discrete",
servo_restyle_damage="rebuild_and_reflow",
affects="layout",
)}
${helpers.predefined_type(
"vertical-align",
"VerticalAlign",
"computed::VerticalAlign::baseline()",
engines="gecko servo",
servo_restyle_damage = "reflow",
affects="layout",
)}
${helpers.predefined_type(
"baseline-source",
"BaselineSource",
"computed::BaselineSource::Auto",
engines="gecko servo",
animation_type="discrete",
servo_restyle_damage = "reflow",
affects="layout",
)}
// CSS 2.1, Section 11 - Visual effects
${helpers.single_keyword(
"-servo-overflow-clip-box",
"padding-box content-box",
engines="servo",
animation_type="none",
enabled_in="ua",
spec="Internal, not web-exposed, \
affects="layout",
)}
% for direction in ["inline", "block"]:
${helpers.predefined_type(
"overflow-clip-box-" + direction,
"OverflowClipBox",
"computed::OverflowClipBox::PaddingBox",
engines="gecko",
enabled_in="chrome",
gecko_pref="layout.css.overflow-clip-box.enabled",
animation_type="discrete",
spec="Internal, may be standardized in the future: \
affects="layout",
)}
% endfor
% for (axis, logical) in ALL_AXES:
<% full_name = "overflow-{}".format(axis) %>
${helpers.predefined_type(
full_name,
"Overflow",
"computed::Overflow::Visible",
engines="gecko servo",
logical_group="overflow",
logical=logical,
animation_type="discrete",
servo_restyle_damage = "reflow",
affects="layout",
)}
% endfor
${helpers.predefined_type(
"overflow-anchor",
"OverflowAnchor",
"computed::OverflowAnchor::Auto",
engines="gecko",
initial_specified_value="specified::OverflowAnchor::Auto",
gecko_pref="layout.css.scroll-anchoring.enabled",
animation_type="discrete",
affects="",
)}
<% transform_extra_prefixes = "moz:layout.css.prefixes.transforms webkit" %>
${helpers.predefined_type(
"transform",
"Transform",
"generics::transform::Transform::none()",
engines="gecko servo",
extra_prefixes=transform_extra_prefixes,
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
${helpers.predefined_type(
"rotate",
"Rotate",
"generics::transform::Rotate::None",
engines="gecko servo",
boxed=True,
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage = "reflow_out_of_flow",
affects="overflow",
)}
${helpers.predefined_type(
"scale",
"Scale",
"generics::transform::Scale::None",
engines="gecko servo",
boxed=True,
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage = "reflow_out_of_flow",
affects="overflow",
)}
${helpers.predefined_type(
"translate",
"Translate",
"generics::transform::Translate::None",
engines="gecko servo",
boxed=True,
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
// Motion Path Module Level 1
${helpers.predefined_type(
"offset-path",
"OffsetPath",
"computed::OffsetPath::none()",
engines="gecko",
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
// Motion Path Module Level 1
${helpers.predefined_type(
"offset-distance",
"LengthPercentage",
"computed::LengthPercentage::zero()",
engines="gecko",
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
// Motion Path Module Level 1
${helpers.predefined_type(
"offset-rotate",
"OffsetRotate",
"computed::OffsetRotate::auto()",
engines="gecko",
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
// Motion Path Module Level 1
${helpers.predefined_type(
"offset-anchor",
"PositionOrAuto",
"computed::PositionOrAuto::auto()",
engines="gecko",
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
boxed=True,
affects="overflow",
)}
// Motion Path Module Level 1
${helpers.predefined_type(
"offset-position",
"OffsetPosition",
"computed::OffsetPosition::normal()",
engines="gecko",
flags="CAN_ANIMATE_ON_COMPOSITOR",
servo_restyle_damage="reflow_out_of_flow",
boxed=True,
affects="overflow",
)}
// CSSOM View Module
${helpers.single_keyword(
"scroll-behavior",
"auto smooth",
engines="gecko",
animation_type="discrete",
gecko_enum_prefix="StyleScrollBehavior",
affects="",
)}
${helpers.predefined_type(
"scroll-snap-align",
"ScrollSnapAlign",
"computed::ScrollSnapAlign::none()",
engines="gecko",
animation_type="discrete",
affects="paint",
)}
${helpers.predefined_type(
"scroll-snap-type",
"ScrollSnapType",
"computed::ScrollSnapType::none()",
engines="gecko",
animation_type="discrete",
affects="paint",
)}
${helpers.predefined_type(
"scroll-snap-stop",
"ScrollSnapStop",
"computed::ScrollSnapStop::Normal",
engines="gecko",
animation_type="discrete",
affects="paint",
)}
% for (axis, logical) in ALL_AXES:
${helpers.predefined_type(
"overscroll-behavior-" + axis,
"OverscrollBehavior",
"computed::OverscrollBehavior::Auto",
engines="gecko",
logical_group="overscroll-behavior",
logical=logical,
gecko_pref="layout.css.overscroll-behavior.enabled",
animation_type="discrete",
affects="paint",
)}
% endfor
// Compositing and Blending Level 1
${helpers.single_keyword(
"isolation",
"auto isolate",
engines="gecko",
gecko_enum_prefix="StyleIsolation",
animation_type="discrete",
affects="paint",
)}
${helpers.predefined_type(
"break-after",
"BreakBetween",
"computed::BreakBetween::Auto",
engines="gecko",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"break-before",
"BreakBetween",
"computed::BreakBetween::Auto",
engines="gecko",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"break-inside",
"BreakWithin",
"computed::BreakWithin::Auto",
engines="gecko",
animation_type="discrete",
affects="layout",
)}
// CSS Basic User Interface Module Level 3
${helpers.predefined_type(
"resize",
"Resize",
"computed::Resize::None",
engines="gecko",
animation_type="discrete",
gecko_ffi_name="mResize",
affects="layout",
)}
${helpers.predefined_type(
"perspective",
"Perspective",
"computed::Perspective::none()",
engines="gecko servo",
gecko_ffi_name="mChildPerspective",
extra_prefixes=transform_extra_prefixes,
servo_restyle_damage = "reflow_out_of_flow",
affects="overflow",
)}
${helpers.predefined_type(
"perspective-origin",
"Position",
"computed::position::Position::center()",
engines="gecko servo",
boxed=True,
extra_prefixes=transform_extra_prefixes,
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
${helpers.single_keyword(
"backface-visibility",
"visible hidden",
engines="gecko servo",
gecko_enum_prefix="StyleBackfaceVisibility",
extra_prefixes=transform_extra_prefixes,
animation_type="discrete",
affects="paint",
)}
${helpers.predefined_type(
"transform-box",
"TransformBox",
"computed::TransformBox::ViewBox",
engines="gecko",
animation_type="discrete",
affects="overflow",
)}
${helpers.predefined_type(
"transform-style",
"TransformStyle",
"computed::TransformStyle::Flat",
engines="gecko servo",
extra_prefixes=transform_extra_prefixes,
animation_type="discrete",
servo_restyle_damage = "reflow_out_of_flow",
affects="overflow",
)}
${helpers.predefined_type(
"transform-origin",
"TransformOrigin",
"computed::TransformOrigin::initial_value()",
engines="gecko servo",
extra_prefixes=transform_extra_prefixes,
gecko_ffi_name="mTransformOrigin",
boxed=True,
servo_restyle_damage="reflow_out_of_flow",
affects="overflow",
)}
${helpers.predefined_type(
"contain",
"Contain",
"specified::Contain::empty()",
engines="gecko",
animation_type="none",
affects="layout",
)}
${helpers.predefined_type(
"content-visibility",
"ContentVisibility",
"computed::ContentVisibility::Visible",
engines="gecko",
affects="layout",
)}
${helpers.predefined_type(
"container-type",
"ContainerType",
"computed::ContainerType::Normal",
engines="gecko servo",
animation_type="none",
servo_pref="layout.container-queries.enabled",
affects="layout",
)}
${helpers.predefined_type(
"container-name",
"ContainerName",
"computed::ContainerName::none()",
engines="gecko servo",
animation_type="none",
servo_pref="layout.container-queries.enabled",
affects="",
)}
${helpers.predefined_type(
"appearance",
"Appearance",
"computed::Appearance::None",
engines="gecko",
aliases="-moz-appearance -webkit-appearance",
animation_type="discrete",
gecko_ffi_name="mAppearance",
affects="paint",
)}
// The inherent widget type of an element, selected by specifying
// `appearance: auto`.
${helpers.predefined_type(
"-moz-default-appearance",
"Appearance",
"computed::Appearance::None",
engines="gecko",
animation_type="none",
spec="Internal (not web-exposed)",
enabled_in="chrome",
gecko_ffi_name="mDefaultAppearance",
affects="paint",
)}
${helpers.single_keyword(
"-moz-orient",
"inline block horizontal vertical",
engines="gecko",
gecko_ffi_name="mOrient",
gecko_enum_prefix="StyleOrient",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"will-change",
"WillChange",
"computed::WillChange::auto()",
engines="gecko",
animation_type="none",
affects="layout",
)}
// The spec issue for the parse_method: https://github.com/w3c/csswg-drafts/issues/4102.
${helpers.predefined_type(
"shape-image-threshold",
"Opacity",
"0.0",
engines="gecko",
affects="layout",
)}
${helpers.predefined_type(
"shape-margin",
"NonNegativeLengthPercentage",
"computed::NonNegativeLengthPercentage::zero()",
engines="gecko",
affects="layout",
)}
${helpers.predefined_type(
"shape-outside",
"basic_shape::ShapeOutside",
"generics::basic_shape::ShapeOutside::None",
engines="gecko",
affects="layout",
)}
${helpers.predefined_type(
"touch-action",
"TouchAction",
"computed::TouchAction::auto()",
engines="gecko",
animation_type="discrete",
affects="paint",
)}
${helpers.predefined_type(
"-webkit-line-clamp",
"LineClamp",
"computed::LineClamp::none()",
engines="gecko",
affects="layout",
)}
${helpers.predefined_type(
"scrollbar-gutter",
"ScrollbarGutter",
"computed::ScrollbarGutter::AUTO",
engines="gecko",
animation_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"zoom",
"Zoom",
"computed::box_::Zoom::ONE",
engines="gecko servo",
spec="Non-standard (https://github.com/atanassov/css-zoom/ is the closest)",
gecko_pref="layout.css.zoom.enabled",
servo_pref="layout.unimplemented",
affects="layout",
enabled_in="chrome",
)}