Diff
Modified: trunk/LayoutTests/ChangeLog (289788 => 289789)
--- trunk/LayoutTests/ChangeLog 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/LayoutTests/ChangeLog 2022-02-15 06:29:39 UTC (rev 289789)
@@ -1,3 +1,12 @@
+2022-02-14 Antti Koivisto <[email protected]>
+
+ [CSS Container Queries] Support range operators in size queries
+ https://bugs.webkit.org/show_bug.cgi?id=236600
+
+ Reviewed by Sam Weinig.
+
+ * TestExpectations:
+
2022-02-14 Ryosuke Niwa <[email protected]>
REGRESSION (r288804): fast/forms/visual-hebrew-text-field.html is failing
Modified: trunk/LayoutTests/TestExpectations (289788 => 289789)
--- trunk/LayoutTests/TestExpectations 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/LayoutTests/TestExpectations 2022-02-15 06:29:39 UTC (rev 289789)
@@ -4756,8 +4756,6 @@
# Container queries
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/display-in-container.html [ ImageOnlyFailure ]
webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/pseudo-elements-002.tentative.html [ ImageOnlyFailure ]
-webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/multicol-inside-container.html [ ImageOnlyFailure ]
-webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/inline-size-bfc-floats.html [ ImageOnlyFailure ]
# Flaky css-contain test
imported/w3c/web-platform-tests/css/css-contain/content-visibility/animation-display-lock.html [ Failure Pass ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289788 => 289789)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-15 06:29:39 UTC (rev 289789)
@@ -1,5 +1,15 @@
2022-02-14 Antti Koivisto <[email protected]>
+ [CSS Container Queries] Support range operators in size queries
+ https://bugs.webkit.org/show_bug.cgi?id=236600
+
+ Reviewed by Sam Weinig.
+
+ * web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt:
+ * web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt:
+
+2022-02-14 Antti Koivisto <[email protected]>
+
[CSS Container Queries] Implement full query parser and evaluator
https://bugs.webkit.org/show_bug.cgi?id=236580
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt (289788 => 289789)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt 2022-02-15 06:29:39 UTC (rev 289789)
@@ -1,13 +1,13 @@
Test
-FAIL size(width < 100px) (.horizontal) assert_equals: expected "" but got "true"
-FAIL size(width >= 100px) (.horizontal) assert_equals: expected "true" but got ""
+PASS size(width < 100px) (.horizontal)
+PASS size(width >= 100px) (.horizontal)
PASS size(min-width: 100px) (.horizontal)
PASS size(min-width: 101px) (.horizontal)
PASS size(max-width: 100px) (.horizontal)
PASS size(max-width: 99px) (.horizontal)
-FAIL size(height < 200px) (.horizontal) assert_equals: expected "" but got "true"
-FAIL size(height >= 200px) (.horizontal) assert_equals: expected "true" but got ""
+PASS size(height < 200px) (.horizontal)
+PASS size(height >= 200px) (.horizontal)
PASS size(min-height: 200px) (.horizontal)
PASS size(min-height: 201px) (.horizontal)
PASS size(max-height: 200px) (.horizontal)
@@ -28,14 +28,14 @@
FAIL size(orientation: portrait) (.horizontal) assert_equals: expected "true" but got ""
FAIL size(aspect-ratio: 1/2) (.horizontal) assert_equals: expected "true" but got ""
PASS size(aspect-ratio: 2/1) (.horizontal)
-FAIL size(width < 100px) (.vertical) assert_equals: expected "" but got "true"
-FAIL size(width >= 100px) (.vertical) assert_equals: expected "true" but got ""
+PASS size(width < 100px) (.vertical)
+PASS size(width >= 100px) (.vertical)
PASS size(min-width: 100px) (.vertical)
PASS size(min-width: 101px) (.vertical)
PASS size(max-width: 100px) (.vertical)
PASS size(max-width: 99px) (.vertical)
-FAIL size(height < 200px) (.vertical) assert_equals: expected "" but got "true"
-FAIL size(height >= 200px) (.vertical) assert_equals: expected "true" but got ""
+PASS size(height < 200px) (.vertical)
+PASS size(height >= 200px) (.vertical)
PASS size(min-height: 200px) (.vertical)
PASS size(min-height: 201px) (.vertical)
PASS size(max-height: 200px) (.vertical)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt (289788 => 289789)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt 2022-02-15 06:29:39 UTC (rev 289789)
@@ -1,9 +1,9 @@
Test
-FAIL size(width > 0px) assert_equals: expected "true" but got ""
-PASS size(height > 0px)
-FAIL size((height > 0px) or (width > 0px)) assert_equals: expected "true" but got ""
-FAIL size((width > 0px) or (height > 0px)) assert_equals: expected "true" but got ""
+PASS size(width > 0px)
+FAIL size(height > 0px) assert_equals: expected "" but got "true"
+PASS size((height > 0px) or (width > 0px))
+PASS size((width > 0px) or (height > 0px))
FAIL size((orientation: landscape) or (width > 0px)) assert_equals: expected "true" but got ""
FAIL size((width > 0px) or (orientation: landscape)) assert_equals: expected "true" but got ""
PASS size((height > 0px) or (orientation: landscape))
Modified: trunk/Source/WebCore/ChangeLog (289788 => 289789)
--- trunk/Source/WebCore/ChangeLog 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/Source/WebCore/ChangeLog 2022-02-15 06:29:39 UTC (rev 289789)
@@ -1,3 +1,22 @@
+2022-02-14 Antti Koivisto <[email protected]>
+
+ [CSS Container Queries] Support range operators in size queries
+ https://bugs.webkit.org/show_bug.cgi?id=236600
+
+ Reviewed by Sam Weinig.
+
+ Support (width > 100px) and similar.
+
+ * css/ContainerQueryParser.cpp:
+ (WebCore::ContainerQueryParser::consumeSizeQuery):
+ (WebCore::ContainerQueryParser::consumeSizeFeature):
+
+ Factor into a function.
+ Add operator support. No reverse (100px < width) or full range (10px < width < 100px) yet.
+ The evaluator supports these already.
+
+ * css/ContainerQueryParser.h:
+
2022-02-14 Dan Glastonbury <[email protected]>
Move PDFDocument.cpp/h in correct position in WebCore.xcodeproj
Modified: trunk/Source/WebCore/css/ContainerQueryParser.cpp (289788 => 289789)
--- trunk/Source/WebCore/css/ContainerQueryParser.cpp 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/Source/WebCore/css/ContainerQueryParser.cpp 2022-02-15 06:29:39 UTC (rev 289789)
@@ -143,35 +143,78 @@
return { *sizeCondition };
}
+ auto sizeFeature = consumeSizeFeature(range);
+ if (!sizeFeature)
+ return { };
+
+ range.consumeWhitespace();
+ if (!range.atEnd())
+ return { };
+
+ return { *sizeFeature };
+}
+
+std::optional<CQ::SizeFeature> ContainerQueryParser::consumeSizeFeature(CSSParserTokenRange& range)
+{
+ // FIXME: Support value-first (100px < width) and full range (100px < width < 200px) notations.
+
auto nameToken = range.consumeIncludingWhitespace();
+ ASSERT(nameToken.type() == IdentToken);
+
auto name = nameToken.value();
if (range.atEnd())
return CQ::SizeFeature { CQ::ComparisonOperator::True, name.toAtomString(), { } };
- auto opToken = range.consumeIncludingWhitespace();
- if (range.atEnd())
+ auto consumeOperator = [&]() -> std::optional<CQ::ComparisonOperator> {
+ auto opToken = range.consume();
+ if (range.atEnd())
+ return { };
+ if (opToken.type() == ColonToken) {
+ if (name.startsWith("min-")) {
+ name = name.substring(4);
+ return CQ::ComparisonOperator::GreaterThanOrEqual;
+ }
+ if (name.startsWith("max-")) {
+ name = name.substring(4);
+ return CQ::ComparisonOperator::LessThanOrEqual;
+ }
+ return CQ::ComparisonOperator::Equal;
+ }
+ if (opToken.type() == DelimiterToken) {
+ switch (opToken.delimiter()) {
+ case '=':
+ return CQ::ComparisonOperator::Equal;
+ case '<':
+ if (range.peek().type() == DelimiterToken && range.peek().delimiter() == '=') {
+ range.consume();
+ return CQ::ComparisonOperator::LessThanOrEqual;
+ }
+ return CQ::ComparisonOperator::LessThan;
+ case '>':
+ if (range.peek().type() == DelimiterToken && range.peek().delimiter() == '=') {
+ range.consume();
+ return CQ::ComparisonOperator::GreaterThanOrEqual;
+ }
+ return CQ::ComparisonOperator::GreaterThan;
+ default:
+ return { };
+ }
+ }
return { };
+ };
- // FIXME: Support '<' style operators and ranges.
- auto op = CQ::ComparisonOperator::Equal;
- if (opToken.type() == ColonToken) {
- if (name.startsWith("min-"))
- op = CQ::ComparisonOperator::GreaterThanOrEqual;
- else if (name.startsWith("max-"))
- op = CQ::ComparisonOperator::LessThanOrEqual;
+ auto op = consumeOperator();
+ if (!op)
+ return { };
- if (op != CQ::ComparisonOperator::Equal)
- name = name.substring(4);
- if (name.isEmpty())
- return { };
- }
+ range.consumeWhitespace();
auto length = CSSPropertyParserHelpers::consumeLength(range, m_context.mode, ValueRange::All);
if (!length)
return { };
- return CQ::SizeFeature { op, name.toAtomString(), length };
+ return CQ::SizeFeature { *op, name.toAtomString(), length };
}
}
Modified: trunk/Source/WebCore/css/ContainerQueryParser.h (289788 => 289789)
--- trunk/Source/WebCore/css/ContainerQueryParser.h 2022-02-15 03:55:25 UTC (rev 289788)
+++ trunk/Source/WebCore/css/ContainerQueryParser.h 2022-02-15 06:29:39 UTC (rev 289789)
@@ -37,6 +37,7 @@
std::optional<CQ::ContainerQuery> consumeContainerQuery(CSSParserTokenRange&);
std::optional<CQ::SizeQuery> consumeSizeQuery(CSSParserTokenRange&);
template<typename ConditionType> std::optional<ConditionType> consumeCondition(CSSParserTokenRange&);
+ std::optional<CQ::SizeFeature> consumeSizeFeature(CSSParserTokenRange&);
ContainerQueryParser(const CSSParserContext& context)
: m_context(context) { }