Bug 1763828 - Change order of container shorthand. r=emilio

Since the initial value of container-type is an open issue [1],
I'm leaving that as-is for now.

[1] https://github.com/w3c/csswg-drafts/issues/7202

Differential Revision: https://phabricator.services.mozilla.com/D147338
This commit is contained in:
Oriol Brufau 2022-05-27 09:47:28 +00:00
Родитель 3483700fe2
Коммит 4ccb54a537
3 изменённых файлов: 9 добавлений и 81 удалений

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

@ -36,7 +36,7 @@ ${helpers.two_properties_shorthand(
<%helpers:shorthand
engines="gecko"
name="container"
sub_properties="container-type container-name"
sub_properties="container-name container-type"
gecko_pref="layout.css.container-queries.enabled",
spec="https://drafts.csswg.org/css-contain-3/#container-shorthand"
>
@ -48,24 +48,24 @@ ${helpers.two_properties_shorthand(
use crate::values::specified::box_::{ContainerName, ContainerType};
// See https://github.com/w3c/csswg-drafts/issues/7180 for why we don't
// match the spec.
let container_type = ContainerType::parse(context, input)?;
let container_name = if input.try_parse(|input| input.expect_delim('/')).is_ok() {
ContainerName::parse(context, input)?
let container_name = ContainerName::parse(context, input)?;
let container_type = if input.try_parse(|input| input.expect_delim('/')).is_ok() {
ContainerType::parse(context, input)?
} else {
ContainerName::none()
ContainerType::NONE
};
Ok(expanded! {
container_type: container_type,
container_name: container_name,
container_type: container_type,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.container_type.to_css(dest)?;
if !self.container_name.is_none() {
self.container_name.to_css(dest)?;
if !self.container_type.is_empty() {
dest.write_str(" / ")?;
self.container_name.to_css(dest)?;
self.container_type.to_css(dest)?;
}
Ok(())
}

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

@ -1,27 +0,0 @@
[container-computed.html]
[Property container value 'block-size / size']
expected: FAIL
[Property container value 'name / size style']
expected: FAIL
[Property container value 'name /inline-size style']
expected: FAIL
[Property container value 'foo / inline-size']
expected: FAIL
[Property container value 'foo /inline-size']
expected: FAIL
[Property container value 'foo/ inline-size']
expected: FAIL
[Property container value 'foo/inline-size']
expected: FAIL
[Property container value 'FoO / size']
expected: FAIL
[Property container value 'foo bar / size']
expected: FAIL

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

@ -1,45 +0,0 @@
[container-parsing.html]
[e.style['container'\] = "block-size / size" should set the property value]
expected: FAIL
[e.style['container'\] = "none / size style" should set the property value]
expected: FAIL
[e.style['container'\] = "foo" should set the property value]
expected: FAIL
[e.style['container'\] = "foo / none" should set the property value]
expected: FAIL
[e.style['container'\] = "foo bar / size" should set the property value]
expected: FAIL
[e.style['container'\] = "foo bar / none" should set the property value]
expected: FAIL
[e.style['container'\] = "FOO / size" should set the property value]
expected: FAIL
[e.style['container'\] = "FOO/size" should set the property value]
expected: FAIL
[e.style['container'\] = " FOO /size" should set the property value]
expected: FAIL
[e.style['container'\] = "none / inline-size inline-size" should not set the property value]
expected: FAIL
[e.style['container'\] = "none / inline-size block-size unknown" should not set the property value]
expected: FAIL
[e.style['container'\] = "none / inline-size block-size" should not set the property value]
expected: FAIL
[e.style['container'\] = "none / size block-size" should not set the property value]
expected: FAIL
[e.style['container'\] = "none / foo" should not set the property value]
expected: FAIL
[e.style['container'\] = "none / block-size" should not set the property value]
expected: FAIL