Skip to content

Commit

Permalink
[CSS Container Queries] Remove size() function syntax
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=237639

Reviewed by Antoine Quint.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt:
* web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt:

Source/WebCore:

Per w3c/csswg-drafts#6870

* css/ContainerQueryParser.cpp:
(WebCore::ContainerQueryParser::consumeContainerQuery):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeSingleContainerName):

Also disallow strings as container names (they need to be identifiers).



Canonical link: https://commits.webkit.org/248220@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291046 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
anttijk committed Mar 9, 2022
1 parent f0c5446 commit fe33dbe
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 23 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/imported/w3c/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2022-03-09 Antti Koivisto <[email protected]>

[CSS Container Queries] Remove size() function syntax
https://bugs.webkit.org/show_bug.cgi?id=237639

Reviewed by Antoine Quint.

* web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt:
* web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt:

2022-03-09 Antoine Quint <[email protected]>

[web-animations] color-interpolation-filters should support discrete animation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PASS (width < 100px)
PASS (100px < width)
PASS (100px < width < 200px)
PASS foo(width)
FAIL size(width) assert_equals: expected "" but got "true"
PASS size(width)
PASS (asdf)
PASS (resolution > 100dpi)
PASS (resolution: 150dpi)
Expand All @@ -50,6 +50,6 @@ PASS Container selector: 1px
PASS Container selector: 50gil
PASS Container selector: name(foo)
PASS Container selector: type(inline-size)
FAIL Container selector: "foo" assert_equals: expected 0 but got 1
FAIL Container selector: "inherit" assert_equals: expected 0 but got 1
PASS Container selector: "foo"
PASS Container selector: "inherit"

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ PASS e.style['container-name'] = "foo, bar" should not set the property value
PASS e.style['container-name'] = "#fff" should not set the property value
PASS e.style['container-name'] = "1px" should not set the property value
PASS e.style['container-name'] = "default" should not set the property value
FAIL e.style['container-name'] = "\"initial\"" should not set the property value assert_equals: expected "" but got "\"initial\""
FAIL e.style['container-name'] = "\"inherit\"" should not set the property value assert_equals: expected "" but got "\"inherit\""
FAIL e.style['container-name'] = "\"unset\"" should not set the property value assert_equals: expected "" but got "\"unset\""
FAIL e.style['container-name'] = "\"revert\"" should not set the property value assert_equals: expected "" but got "\"revert\""
FAIL e.style['container-name'] = "\"none\"" should not set the property value assert_equals: expected "" but got "\"none\""
FAIL e.style['container-name'] = "\"foo\"" should not set the property value assert_equals: expected "" but got "\"foo\""
PASS e.style['container-name'] = "\"initial\"" should not set the property value
PASS e.style['container-name'] = "\"inherit\"" should not set the property value
PASS e.style['container-name'] = "\"unset\"" should not set the property value
PASS e.style['container-name'] = "\"revert\"" should not set the property value
PASS e.style['container-name'] = "\"none\"" should not set the property value
PASS e.style['container-name'] = "\"foo\"" should not set the property value

16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2022-03-09 Antti Koivisto <[email protected]>

[CSS Container Queries] Remove size() function syntax
https://bugs.webkit.org/show_bug.cgi?id=237639

Reviewed by Antoine Quint.

Per https://github.com/w3c/csswg-drafts/issues/6870

* css/ContainerQueryParser.cpp:
(WebCore::ContainerQueryParser::consumeContainerQuery):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeSingleContainerName):

Also disallow strings as container names (they need to be identifiers).

2022-03-09 Fujii Hironori <[email protected]>

[WinCairo] SpatialNavigation.h(93): error C2365: 'WebCore::None': redefinition; previous definition was 'enumerator'
Expand Down
15 changes: 3 additions & 12 deletions Source/WebCore/css/ContainerQueryParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,9 @@ std::optional<ContainerQuery> ContainerQueryParser::consumeContainerQuery(CSSPar
std::optional<CQ::ContainerQuery> ContainerQueryParser::consumeContainerQuery(CSSParserTokenRange& range)
{
if (range.peek().type() == FunctionToken) {
bool isSizeQuery = range.peek().functionId() == CSSValueSize;

auto blockRange = range.consumeBlock();
blockRange.consumeWhitespace();

if (!isSizeQuery)
return CQ::UnknownQuery { };

auto sizeQuery = consumeSizeQuery(blockRange);
if (!sizeQuery)
return { };
return { *sizeQuery };
range.consumeBlock();
// This is where we would support style() queries.
return CQ::UnknownQuery { };
}

if (range.peek().type() == LeftParenthesisToken) {
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4285,8 +4285,6 @@ RefPtr<CSSPrimitiveValue> consumeSingleContainerName(CSSParserTokenRange& range)
return nullptr;
if (auto ident = consumeCustomIdent(range))
return ident;
if (auto string = consumeString(range))
return string;
return nullptr;
}

Expand Down

0 comments on commit fe33dbe

Please sign in to comment.