Bug 1900229: Parse position-try shorthand. r=firefox-style-system-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D221988
This commit is contained in:
David Shin 2024-09-12 20:08:09 +00:00
Родитель 07471ed168
Коммит eaa4082b34
7 изменённых файлов: 747 добавлений и 895 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13489,6 +13489,71 @@ if (IsCSSPropertyPrefEnabled("layout.css.anchor-positioning.enabled")) {
"anchors-visible always",
],
};
gCSSProperties["position-try"] = {
domProp: "positionTry",
inherited: false,
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: ["position-try-order", "position-try-fallbacks"],
initial_values: ["none"],
other_values: [
"--foo",
"flip-block",
"flip-inline",
"flip-start",
"left",
"span-y-start",
"span-block-start inline-end",
"span-all self-block-end",
"end span-start",
"center span-all",
"most-width --foo",
"most-width flip-block",
"most-width flip-inline",
"most-width flip-start",
"most-width left",
"most-width span-y-start",
"most-width span-block-start inline-end",
"most-width span-all self-block-end",
"most-width end span-start",
"most-width center span-all",
"most-height --foo",
"most-height flip-block",
"most-height flip-inline",
"most-height flip-start",
"most-height left",
"most-height span-y-start",
"most-height span-block-start inline-end",
"most-height span-all self-block-end",
"most-height end span-start",
"most-height center span-all",
"most-block-size --foo",
"most-block-size flip-block",
"most-block-size flip-inline",
"most-block-size flip-start",
"most-block-size left",
"most-block-size span-y-start",
"most-block-size span-block-start inline-end",
"most-block-size span-all self-block-end",
"most-block-size end span-start",
"most-block-size center span-all",
"most-inline-size --foo",
"most-inline-size flip-block",
"most-inline-size flip-inline",
"most-inline-size flip-start",
"most-inline-size left",
"most-inline-size span-y-start",
"most-inline-size span-block-start inline-end",
"most-inline-size span-all self-block-end",
"most-inline-size end span-start",
"most-inline-size center span-all",
],
invalid_values: [
"foo",
"--foo none none",
"--foo span-y-start self-block-end",
],
};
}
if (false) {

Просмотреть файл

@ -861,6 +861,39 @@
}
</%helpers:shorthand>
<%helpers:shorthand
name="position-try"
engines="gecko"
gecko_pref="layout.css.anchor-positioning.enabled",
sub_properties="position-try-order position-try-fallbacks"
spec="https://drafts.csswg.org/css-anchor-position-1/#position-try-prop"
>
use crate::values::specified::position::{PositionTryOrder, PositionTryFallbacks};
use crate::parser::Parse;
pub fn parse_value<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
let order = input.try_parse(|i| PositionTryOrder::parse(i)).unwrap_or(PositionTryOrder::normal());
let fallbacks = PositionTryFallbacks::parse(context, input)?;
Ok(expanded! {
position_try_order: order,
position_try_fallbacks: fallbacks,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
if *self.position_try_order != PositionTryOrder::Normal {
self.position_try_order.to_css(dest)?;
dest.write_char(' ')?;
}
self.position_try_fallbacks.to_css(dest)
}
}
</%helpers:shorthand>
// See https://github.com/w3c/csswg-drafts/issues/3525 for the quirks stuff.
${helpers.four_sides_shorthand(
"inset",

Просмотреть файл

@ -1,21 +0,0 @@
[position-try-computed.html]
[Property position-try value 'none']
expected: FAIL
[Property position-try value 'normal none']
expected: FAIL
[Property position-try value 'flip-block']
expected: FAIL
[Property position-try value 'most-width none']
expected: FAIL
[Property position-try value 'most-height flip-block, flip-inline']
expected: FAIL
[Property position-try value 'most-width --foo, --bar']
expected: FAIL
[Property position-try value 'normal --foo']
expected: FAIL

Просмотреть файл

@ -1,69 +1,6 @@
[position-try-parsing.html]
[e.style['position-try'\] = "flip-inline" should set the property value]
expected: FAIL
[e.style['position-try'\] = "most-height none" should set the property value]
expected: FAIL
[e.style['position-try'\] = "--bar, --baz" should set the property value]
expected: FAIL
[e.style['position-try'\] = "most-inline-size --baz, flip-inline" should set the property value]
expected: FAIL
[e.style['position-try'\] = "most-block-size flip-inline flip-block, --bar, --baz" should set the property value]
expected: FAIL
[e.style['position-try'\] = "normal none" should set the property value]
expected: FAIL
[e.style['position-try'\] = "most-width none" should set the property value]
expected: FAIL
[e.style['position-try'\] = "normal --foo" should set the property value]
expected: FAIL
[e.style['position-try'\] = "flip-inline" should set position-try-order]
expected: FAIL
[e.style['position-try'\] = "flip-inline" should not set unrelated longhands]
expected: FAIL
[e.style['position-try'\] = "most-width none" should set position-try-order]
expected: FAIL
[e.style['position-try'\] = "most-width none" should not set unrelated longhands]
expected: FAIL
[e.style['position-try'\] = "--foo, --bar" should set position-try-order]
expected: FAIL
[e.style['position-try'\] = "--foo, --bar" should not set unrelated longhands]
expected: FAIL
[e.style['position-try'\] = "most-inline-size --foo, flip-inline" should set position-try-order]
expected: FAIL
[e.style['position-try'\] = "most-inline-size --foo, flip-inline" should not set unrelated longhands]
expected: FAIL
[e.style['position-try'\] = "most-inline-size flip-inline flip-block, --foo, --bar" should set position-try-order]
expected: FAIL
[e.style['position-try'\] = "most-inline-size flip-inline flip-block, --foo, --bar" should not set unrelated longhands]
expected: FAIL
[e.style['position-try'\] = "flip-inline" should set position-try-fallbacks]
expected: FAIL
[e.style['position-try'\] = "most-width none" should set position-try-fallbacks]
expected: FAIL
[e.style['position-try'\] = "--foo, --bar" should set position-try-fallbacks]
expected: FAIL
[e.style['position-try'\] = "most-inline-size --foo, flip-inline" should set position-try-fallbacks]
expected: FAIL
[e.style['position-try'\] = "most-inline-size flip-inline flip-block, --foo, --bar" should set position-try-fallbacks]
expected: FAIL

Просмотреть файл

@ -1,81 +0,0 @@
[position-try-order-basic.html]
[--right | --right]
expected: FAIL
[--left | --left]
expected: FAIL
[--top | --top]
expected: FAIL
[--bottom | --bottom]
expected: FAIL
[--right, --left, --bottom, --top | --right]
expected: FAIL
[normal --right, --left, --bottom, --top | --right]
expected: FAIL
[normal --top, --left, --bottom, --right | --top]
expected: FAIL
[most-block-size --right, --left | --right]
expected: FAIL
[most-height --right, --left | --right]
expected: FAIL
[most-inline-size --right, --left | --left]
expected: FAIL
[most-width --right, --left | --left]
expected: FAIL
[most-inline-size --bottom, --top | --bottom]
expected: FAIL
[most-width --bottom, --top | --bottom]
expected: FAIL
[most-block-size --bottom, --top | --top]
expected: FAIL
[most-height --bottom, --top | --top]
expected: FAIL
[most-inline-size --right, --left, --bottom, --top | --bottom]
expected: FAIL
[most-inline-size --right, --left, --top, --bottom | --top]
expected: FAIL
[most-block-size --bottom, --top, --right, --left | --right]
expected: FAIL
[most-block-size --bottom, --top, --left, --right | --left]
expected: FAIL
[most-inline-size --left-sweep, --bottom-sweep | --left-sweep]
expected: FAIL
[most-inline-size --bottom-sweep, --left-sweep | --bottom-sweep]
expected: FAIL
[most-block-size --left-sweep, --bottom-sweep | --left-sweep]
expected: FAIL
[most-block-size --bottom-sweep, --left-sweep | --left-sweep]
expected: FAIL
[most-inline-size --right-sweep, --left-sweep, --bottom-sweep, --top-sweep | --left-sweep]
expected: FAIL
[most-block-size --right-sweep, --left-sweep, --bottom-sweep, --top-sweep | --top-sweep]
expected: FAIL
[most-inline-size\n --right-sweep, --left-sweep, --bottom-sweep, --top-sweep,\n --right, --left, --bottom, --top\n | --left-sweep]
expected: FAIL
[most-block-size\n --right-sweep, --left-sweep, --bottom-sweep, --top-sweep,\n --right, --left, --bottom, --top\n | --right]
expected: FAIL

Просмотреть файл

@ -1,81 +0,0 @@
[position-try-order-position-area.html]
[--right | --right]
expected: FAIL
[--left | --left]
expected: FAIL
[--top | --top]
expected: FAIL
[--bottom | --bottom]
expected: FAIL
[--right, --left, --bottom, --top | --right]
expected: FAIL
[normal --right, --left, --bottom, --top | --right]
expected: FAIL
[normal --top, --left, --bottom, --right | --top]
expected: FAIL
[most-block-size --right, --left | --right]
expected: FAIL
[most-height --right, --left | --right]
expected: FAIL
[most-inline-size --right, --left | --left]
expected: FAIL
[most-width --right, --left | --left]
expected: FAIL
[most-inline-size --bottom, --top | --bottom]
expected: FAIL
[most-width --bottom, --top | --bottom]
expected: FAIL
[most-block-size --bottom, --top | --top]
expected: FAIL
[most-height --bottom, --top | --top]
expected: FAIL
[most-inline-size --right, --left, --bottom, --top | --bottom]
expected: FAIL
[most-inline-size --right, --left, --top, --bottom | --top]
expected: FAIL
[most-block-size --bottom, --top, --right, --left | --right]
expected: FAIL
[most-block-size --bottom, --top, --left, --right | --left]
expected: FAIL
[most-inline-size --left-sweep, --bottom-sweep | --left-sweep]
expected: FAIL
[most-inline-size --bottom-sweep, --left-sweep | --bottom-sweep]
expected: FAIL
[most-block-size --left-sweep, --bottom-sweep | --left-sweep]
expected: FAIL
[most-block-size --bottom-sweep, --left-sweep | --left-sweep]
expected: FAIL
[most-inline-size --right-sweep, --left-sweep, --bottom-sweep, --top-sweep | --left-sweep]
expected: FAIL
[most-block-size --right-sweep, --left-sweep, --bottom-sweep, --top-sweep | --top-sweep]
expected: FAIL
[most-inline-size\n --right-sweep, --left-sweep, --bottom-sweep, --top-sweep,\n --right, --left, --bottom, --top\n | --left-sweep]
expected: FAIL
[most-block-size\n --right-sweep, --left-sweep, --bottom-sweep, --top-sweep,\n --right, --left, --bottom, --top\n | --right]
expected: FAIL