position.mako.rs (14029B)
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 <% from data import ALL_SIZES, PHYSICAL_SIDES, LOGICAL_SIDES, DEFAULT_RULES_AND_POSITION_TRY %> 7 8 // "top" / "left" / "bottom" / "right" 9 % for index, side in enumerate(PHYSICAL_SIDES): 10 ${helpers.predefined_type( 11 side, 12 "Inset", 13 "computed::Inset::auto()", 14 engines="gecko servo", 15 spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side, 16 allow_quirks="Yes", 17 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 18 gecko_ffi_name="mOffset.{}".format(index), 19 servo_restyle_damage="rebuild_box", 20 logical_group="inset", 21 affects="layout", 22 )} 23 % endfor 24 // inset-* logical properties, map to "top" / "left" / "bottom" / "right" 25 % for side in LOGICAL_SIDES: 26 ${helpers.predefined_type( 27 "inset-%s" % side, 28 "Inset", 29 "computed::Inset::auto()", 30 engines="gecko servo", 31 spec="https://drafts.csswg.org/css-logical-props/#propdef-inset-%s" % side, 32 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 33 logical=True, 34 logical_group="inset", 35 affects="layout", 36 )} 37 % endfor 38 39 ${helpers.predefined_type( 40 "z-index", 41 "ZIndex", 42 "computed::ZIndex::auto()", 43 engines="gecko servo", 44 spec="https://www.w3.org/TR/CSS2/visuren.html#z-index", 45 affects="paint", 46 servo_restyle_damage="rebuild_stacking_context", 47 )} 48 49 // CSS Flexible Box Layout Module Level 1 50 // http://www.w3.org/TR/css3-flexbox/ 51 52 // Flex container properties 53 ${helpers.single_keyword( 54 "flex-direction", 55 "row row-reverse column column-reverse", 56 engines="gecko servo", 57 spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property", 58 extra_prefixes="webkit", 59 animation_type="discrete", 60 servo_restyle_damage = "rebuild_box", 61 gecko_enum_prefix = "StyleFlexDirection", 62 affects="layout", 63 )} 64 65 ${helpers.single_keyword( 66 "flex-wrap", 67 "nowrap wrap wrap-reverse", 68 engines="gecko servo", 69 spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property", 70 extra_prefixes="webkit", 71 animation_type="discrete", 72 servo_restyle_damage = "rebuild_box", 73 gecko_enum_prefix = "StyleFlexWrap", 74 affects="layout", 75 )} 76 77 ${helpers.predefined_type( 78 "justify-content", 79 "ContentDistribution", 80 "specified::ContentDistribution::normal()", 81 engines="gecko servo", 82 parse_method="parse_inline", 83 spec="https://drafts.csswg.org/css-align/#propdef-justify-content", 84 extra_prefixes="webkit", 85 animation_type="discrete", 86 servo_restyle_damage="rebuild_box", 87 affects="layout", 88 )} 89 90 ${helpers.predefined_type( 91 "align-content", 92 "ContentDistribution", 93 "specified::ContentDistribution::normal()", 94 parse_method="parse_block", 95 engines="gecko servo", 96 spec="https://drafts.csswg.org/css-align/#propdef-align-content", 97 extra_prefixes="webkit", 98 animation_type="discrete", 99 servo_restyle_damage="rebuild_box", 100 affects="layout", 101 )} 102 103 ${helpers.predefined_type( 104 "align-items", 105 "ItemPlacement", 106 "specified::ItemPlacement::normal()", 107 engines="gecko servo", 108 parse_method="parse_block", 109 spec="https://drafts.csswg.org/css-align/#propdef-align-items", 110 extra_prefixes="webkit", 111 animation_type="discrete", 112 servo_restyle_damage="rebuild_box", 113 affects="layout", 114 )} 115 116 ${helpers.predefined_type( 117 "justify-items", 118 "JustifyItems", 119 "computed::JustifyItems::legacy()", 120 engines="gecko servo", 121 spec="https://drafts.csswg.org/css-align/#propdef-justify-items", 122 animation_type="discrete", 123 affects="layout", 124 )} 125 126 // Flex item properties 127 ${helpers.predefined_type( 128 "flex-grow", 129 "NonNegativeNumber", 130 "From::from(0.0)", 131 engines="gecko servo", 132 spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property", 133 extra_prefixes="webkit", 134 servo_restyle_damage="rebuild_box", 135 affects="layout", 136 )} 137 138 ${helpers.predefined_type( 139 "flex-shrink", 140 "NonNegativeNumber", 141 "From::from(1.0)", 142 engines="gecko servo", 143 spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property", 144 extra_prefixes="webkit", 145 servo_restyle_damage = "rebuild_box", 146 affects="layout", 147 )} 148 149 // https://drafts.csswg.org/css-align/#align-self-property 150 ${helpers.predefined_type( 151 "align-self", 152 "SelfAlignment", 153 "specified::SelfAlignment::auto()", 154 engines="gecko servo", 155 parse_method="parse_block", 156 spec="https://drafts.csswg.org/css-align/#align-self-property", 157 extra_prefixes="webkit", 158 animation_type="discrete", 159 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 160 affects="layout", 161 )} 162 ${helpers.predefined_type( 163 "justify-self", 164 "SelfAlignment", 165 "specified::SelfAlignment::auto()", 166 parse_method="parse_inline", 167 engines="gecko servo", 168 spec="https://drafts.csswg.org/css-align/#justify-self-property", 169 animation_type="discrete", 170 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 171 affects="layout", 172 )} 173 174 // https://drafts.csswg.org/css-flexbox/#propdef-order 175 ${helpers.predefined_type( 176 "order", 177 "Integer", 178 "0", 179 engines="gecko servo", 180 extra_prefixes="webkit", 181 spec="https://drafts.csswg.org/css-flexbox/#order-property", 182 servo_restyle_damage="rebuild_box", 183 affects="layout", 184 )} 185 186 ${helpers.predefined_type( 187 "flex-basis", 188 "FlexBasis", 189 "computed::FlexBasis::auto()", 190 engines="gecko servo", 191 spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property", 192 extra_prefixes="webkit", 193 servo_restyle_damage="rebuild_box", 194 boxed=True, 195 affects="layout", 196 )} 197 198 % for (size, logical) in ALL_SIZES: 199 <% 200 spec = "https://drafts.csswg.org/css-box/#propdef-%s" 201 if logical: 202 spec = "https://drafts.csswg.org/css-logical-props/#propdef-%s" 203 %> 204 // width, height, block-size, inline-size 205 ${helpers.predefined_type( 206 size, 207 "Size", 208 "computed::Size::auto()", 209 engines="gecko servo", 210 logical=logical, 211 logical_group="size", 212 allow_quirks="No" if logical else "Yes", 213 parse_method="parse_size_for_width_or_height", 214 spec=spec % size, 215 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 216 servo_restyle_damage="rebuild_box", 217 affects="layout", 218 )} 219 // min-width, min-height, min-block-size, min-inline-size 220 ${helpers.predefined_type( 221 "min-%s" % size, 222 "Size", 223 "computed::Size::auto()", 224 engines="gecko servo", 225 logical=logical, 226 logical_group="min-size", 227 allow_quirks="No" if logical else "Yes", 228 spec=spec % size, 229 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 230 servo_restyle_damage="rebuild_box", 231 affects="layout", 232 )} 233 ${helpers.predefined_type( 234 "max-%s" % size, 235 "MaxSize", 236 "computed::MaxSize::none()", 237 engines="gecko servo", 238 logical=logical, 239 logical_group="max-size", 240 allow_quirks="No" if logical else "Yes", 241 spec=spec % size, 242 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 243 servo_restyle_damage="rebuild_box", 244 affects="layout", 245 )} 246 % endfor 247 248 ${helpers.predefined_type( 249 "position-anchor", 250 "PositionAnchor", 251 "computed::PositionAnchor::None", 252 engines="gecko", 253 animation_type="discrete", 254 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 255 gecko_pref="layout.css.anchor-positioning.enabled", 256 spec="https://drafts.csswg.org/css-anchor-position-1/#propdef-position-anchor", 257 affects="layout", 258 )} 259 260 ${helpers.predefined_type( 261 "position-area", 262 "PositionArea", 263 "computed::PositionArea::none()", 264 engines="gecko", 265 initial_specified_value="specified::PositionArea::none()", 266 animation_type="discrete", 267 rule_types_allowed=DEFAULT_RULES_AND_POSITION_TRY, 268 gecko_pref="layout.css.anchor-positioning.enabled", 269 spec="https://drafts.csswg.org/css-anchor-position-1/#typedef-position-area", 270 affects="layout", 271 )} 272 273 ${helpers.predefined_type( 274 "position-visibility", 275 "PositionVisibility", 276 "computed::PositionVisibility::ANCHORS_VISIBLE", 277 engines="gecko", 278 initial_specified_value="specified::PositionVisibility::ANCHORS_VISIBLE", 279 animation_type="discrete", 280 gecko_pref="layout.css.anchor-positioning.enabled", 281 spec="https://drafts.csswg.org/css-anchor-position-1/#propdef-position-visibility", 282 affects="layout", 283 )} 284 285 ${helpers.predefined_type( 286 "position-try-fallbacks", 287 "PositionTryFallbacks", 288 "computed::PositionTryFallbacks::none()", 289 engines="gecko", 290 initial_specified_value="specified::PositionTryFallbacks::none()", 291 animation_type="discrete", 292 gecko_pref="layout.css.anchor-positioning.enabled", 293 spec="https://drafts.csswg.org/css-anchor-position-1/#position-try-fallbacks", 294 affects="layout", 295 )} 296 297 ${helpers.predefined_type( 298 "position-try-order", 299 "PositionTryOrder", 300 "computed::PositionTryOrder::normal()", 301 engines="gecko", 302 initial_specified_value="specified::PositionTryOrder::normal()", 303 animation_type="discrete", 304 gecko_pref="layout.css.anchor-positioning.position-try-order.enabled", 305 spec="https://drafts.csswg.org/css-anchor-position-1/#position-try-order-property", 306 affects="layout", 307 )} 308 309 ${helpers.single_keyword( 310 "box-sizing", 311 "content-box border-box", 312 engines="gecko servo", 313 extra_prefixes="moz:layout.css.prefixes.box-sizing webkit", 314 spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing", 315 gecko_enum_prefix="StyleBoxSizing", 316 custom_consts={ "content-box": "Content", "border-box": "Border" }, 317 animation_type="discrete", 318 servo_restyle_damage = "rebuild_box", 319 affects="layout", 320 )} 321 322 ${helpers.single_keyword( 323 "object-fit", 324 "fill contain cover none scale-down", 325 engines="gecko servo", 326 animation_type="discrete", 327 spec="https://drafts.csswg.org/css-images/#propdef-object-fit", 328 gecko_enum_prefix = "StyleObjectFit", 329 affects="layout", 330 )} 331 332 ${helpers.predefined_type( 333 "object-position", 334 "Position", 335 "computed::Position::center()", 336 engines="gecko servo", 337 boxed=True, 338 spec="https://drafts.csswg.org/css-images-3/#the-object-position", 339 affects="layout", 340 )} 341 342 % for kind in ["row", "column"]: 343 % for range in ["start", "end"]: 344 ${helpers.predefined_type( 345 "grid-%s-%s" % (kind, range), 346 "GridLine", 347 "Default::default()", 348 engines="gecko servo", 349 servo_pref="layout.grid.enabled", 350 animation_type="discrete", 351 spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-%s" % (kind, range), 352 affects="layout", 353 )} 354 % endfor 355 356 ${helpers.predefined_type( 357 "grid-auto-%ss" % kind, 358 "ImplicitGridTracks", 359 "Default::default()", 360 engines="gecko servo", 361 servo_pref="layout.grid.enabled", 362 animation_type="discrete", 363 spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-%ss" % kind, 364 affects="layout", 365 )} 366 367 ${helpers.predefined_type( 368 "grid-template-%ss" % kind, 369 "GridTemplateComponent", 370 "specified::GenericGridTemplateComponent::None", 371 engines="gecko servo", 372 servo_pref="layout.grid.enabled", 373 spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-%ss" % kind, 374 affects="layout", 375 )} 376 377 % endfor 378 379 ${helpers.predefined_type( 380 "masonry-auto-flow", 381 "MasonryAutoFlow", 382 "computed::MasonryAutoFlow::initial()", 383 engines="gecko", 384 gecko_pref="layout.css.grid-template-masonry-value.enabled", 385 animation_type="discrete", 386 spec="https://github.com/w3c/csswg-drafts/issues/4650", 387 affects="layout", 388 )} 389 390 ${helpers.predefined_type( 391 "grid-auto-flow", 392 "GridAutoFlow", 393 "computed::GridAutoFlow::ROW", 394 engines="gecko servo", 395 servo_pref="layout.grid.enabled", 396 animation_type="discrete", 397 spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-flow", 398 affects="layout", 399 )} 400 401 ${helpers.predefined_type( 402 "grid-template-areas", 403 "GridTemplateAreas", 404 "computed::GridTemplateAreas::none()", 405 engines="gecko servo", 406 servo_pref="layout.grid.enabled", 407 animation_type="discrete", 408 spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-areas", 409 affects="layout", 410 )} 411 412 ${helpers.predefined_type( 413 "column-gap", 414 "length::NonNegativeLengthPercentageOrNormal", 415 "computed::length::NonNegativeLengthPercentageOrNormal::normal()", 416 engines="gecko servo", 417 aliases="grid-column-gap", 418 spec="https://drafts.csswg.org/css-align-3/#propdef-column-gap", 419 servo_restyle_damage="rebuild_box", 420 affects="layout", 421 )} 422 423 // no need for -moz- prefixed alias for this property 424 ${helpers.predefined_type( 425 "row-gap", 426 "length::NonNegativeLengthPercentageOrNormal", 427 "computed::length::NonNegativeLengthPercentageOrNormal::normal()", 428 engines="gecko servo", 429 aliases="grid-row-gap", 430 spec="https://drafts.csswg.org/css-align-3/#propdef-row-gap", 431 servo_restyle_damage="rebuild_box", 432 affects="layout", 433 )} 434 435 ${helpers.predefined_type( 436 "aspect-ratio", 437 "AspectRatio", 438 "computed::AspectRatio::auto()", 439 engines="gecko servo", 440 spec="https://drafts.csswg.org/css-sizing-4/#aspect-ratio", 441 servo_restyle_damage="rebuild_box", 442 affects="layout", 443 )} 444 445 % for (size, logical) in ALL_SIZES: 446 ${helpers.predefined_type( 447 "contain-intrinsic-" + size, 448 "ContainIntrinsicSize", 449 "computed::ContainIntrinsicSize::None", 450 engines="gecko", 451 logical_group="contain-intrinsic-size", 452 logical=logical, 453 spec="https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override", 454 affects="layout", 455 )} 456 % endfor