Changeset 289789 in webkit
- Timestamp:
- Feb 14, 2022 10:29:39 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/ContainerQueryParser.cpp (modified) (3 diffs)
-
Source/WebCore/css/ContainerQueryParser.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r289787 r289789 1 2022-02-14 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Support range operators in size queries 4 https://bugs.webkit.org/show_bug.cgi?id=236600 5 6 Reviewed by Sam Weinig. 7 8 * TestExpectations: 9 1 10 2022-02-14 Ryosuke Niwa <rniwa@webkit.org> 2 11 -
trunk/LayoutTests/TestExpectations
r289742 r289789 4757 4757 webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/display-in-container.html [ ImageOnlyFailure ] 4758 4758 webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/pseudo-elements-002.tentative.html [ ImageOnlyFailure ] 4759 webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/multicol-inside-container.html [ ImageOnlyFailure ]4760 webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/inline-size-bfc-floats.html [ ImageOnlyFailure ]4761 4759 4762 4760 # Flaky css-contain test -
trunk/LayoutTests/imported/w3c/ChangeLog
r289742 r289789 1 2022-02-14 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Support range operators in size queries 4 https://bugs.webkit.org/show_bug.cgi?id=236600 5 6 Reviewed by Sam Weinig. 7 8 * web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt: 9 * web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt: 10 1 11 2022-02-14 Antti Koivisto <antti@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/size-feature-evaluation-expected.txt
r289742 r289789 1 1 Test 2 2 3 FAIL size(width < 100px) (.horizontal) assert_equals: expected "" but got "true" 4 FAIL size(width >= 100px) (.horizontal) assert_equals: expected "true" but got "" 3 PASS size(width < 100px) (.horizontal) 4 PASS size(width >= 100px) (.horizontal) 5 5 PASS size(min-width: 100px) (.horizontal) 6 6 PASS size(min-width: 101px) (.horizontal) 7 7 PASS size(max-width: 100px) (.horizontal) 8 8 PASS size(max-width: 99px) (.horizontal) 9 FAIL size(height < 200px) (.horizontal) assert_equals: expected "" but got "true" 10 FAIL size(height >= 200px) (.horizontal) assert_equals: expected "true" but got "" 9 PASS size(height < 200px) (.horizontal) 10 PASS size(height >= 200px) (.horizontal) 11 11 PASS size(min-height: 200px) (.horizontal) 12 12 PASS size(min-height: 201px) (.horizontal) … … 29 29 FAIL size(aspect-ratio: 1/2) (.horizontal) assert_equals: expected "true" but got "" 30 30 PASS size(aspect-ratio: 2/1) (.horizontal) 31 FAIL size(width < 100px) (.vertical) assert_equals: expected "" but got "true" 32 FAIL size(width >= 100px) (.vertical) assert_equals: expected "true" but got "" 31 PASS size(width < 100px) (.vertical) 32 PASS size(width >= 100px) (.vertical) 33 33 PASS size(min-width: 100px) (.vertical) 34 34 PASS size(min-width: 101px) (.vertical) 35 35 PASS size(max-width: 100px) (.vertical) 36 36 PASS size(max-width: 99px) (.vertical) 37 FAIL size(height < 200px) (.vertical) assert_equals: expected "" but got "true" 38 FAIL size(height >= 200px) (.vertical) assert_equals: expected "true" but got "" 37 PASS size(height < 200px) (.vertical) 38 PASS size(height >= 200px) (.vertical) 39 39 PASS size(min-height: 200px) (.vertical) 40 40 PASS size(min-height: 201px) (.vertical) -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/unsupported-axis-expected.txt
r289222 r289789 1 1 Test 2 2 3 FAIL size(width > 0px) assert_equals: expected "true" but got "" 4 PASS size(height > 0px) 5 FAIL size((height > 0px) or (width > 0px)) assert_equals: expected "true" but got "" 6 FAIL size((width > 0px) or (height > 0px)) assert_equals: expected "true" but got "" 3 PASS size(width > 0px) 4 FAIL size(height > 0px) assert_equals: expected "" but got "true" 5 PASS size((height > 0px) or (width > 0px)) 6 PASS size((width > 0px) or (height > 0px)) 7 7 FAIL size((orientation: landscape) or (width > 0px)) assert_equals: expected "true" but got "" 8 8 FAIL size((width > 0px) or (orientation: landscape)) assert_equals: expected "true" but got "" -
trunk/Source/WebCore/ChangeLog
r289778 r289789 1 2022-02-14 Antti Koivisto <antti@apple.com> 2 3 [CSS Container Queries] Support range operators in size queries 4 https://bugs.webkit.org/show_bug.cgi?id=236600 5 6 Reviewed by Sam Weinig. 7 8 Support (width > 100px) and similar. 9 10 * css/ContainerQueryParser.cpp: 11 (WebCore::ContainerQueryParser::consumeSizeQuery): 12 (WebCore::ContainerQueryParser::consumeSizeFeature): 13 14 Factor into a function. 15 Add operator support. No reverse (100px < width) or full range (10px < width < 100px) yet. 16 The evaluator supports these already. 17 18 * css/ContainerQueryParser.h: 19 1 20 2022-02-14 Dan Glastonbury <djg@apple.com> 2 21 -
trunk/Source/WebCore/css/ContainerQueryParser.cpp
r289742 r289789 144 144 } 145 145 146 auto sizeFeature = consumeSizeFeature(range); 147 if (!sizeFeature) 148 return { }; 149 150 range.consumeWhitespace(); 151 if (!range.atEnd()) 152 return { }; 153 154 return { *sizeFeature }; 155 } 156 157 std::optional<CQ::SizeFeature> ContainerQueryParser::consumeSizeFeature(CSSParserTokenRange& range) 158 { 159 // FIXME: Support value-first (100px < width) and full range (100px < width < 200px) notations. 160 146 161 auto nameToken = range.consumeIncludingWhitespace(); 162 ASSERT(nameToken.type() == IdentToken); 163 147 164 auto name = nameToken.value(); 148 165 … … 150 167 return CQ::SizeFeature { CQ::ComparisonOperator::True, name.toAtomString(), { } }; 151 168 152 auto opToken = range.consumeIncludingWhitespace(); 153 if (range.atEnd()) 154 return { }; 155 156 // FIXME: Support '<' style operators and ranges. 157 auto op = CQ::ComparisonOperator::Equal; 158 if (opToken.type() == ColonToken) { 159 if (name.startsWith("min-")) 160 op = CQ::ComparisonOperator::GreaterThanOrEqual; 161 else if (name.startsWith("max-")) 162 op = CQ::ComparisonOperator::LessThanOrEqual; 163 164 if (op != CQ::ComparisonOperator::Equal) 165 name = name.substring(4); 166 if (name.isEmpty()) 167 return { }; 168 } 169 auto consumeOperator = [&]() -> std::optional<CQ::ComparisonOperator> { 170 auto opToken = range.consume(); 171 if (range.atEnd()) 172 return { }; 173 if (opToken.type() == ColonToken) { 174 if (name.startsWith("min-")) { 175 name = name.substring(4); 176 return CQ::ComparisonOperator::GreaterThanOrEqual; 177 } 178 if (name.startsWith("max-")) { 179 name = name.substring(4); 180 return CQ::ComparisonOperator::LessThanOrEqual; 181 } 182 return CQ::ComparisonOperator::Equal; 183 } 184 if (opToken.type() == DelimiterToken) { 185 switch (opToken.delimiter()) { 186 case '=': 187 return CQ::ComparisonOperator::Equal; 188 case '<': 189 if (range.peek().type() == DelimiterToken && range.peek().delimiter() == '=') { 190 range.consume(); 191 return CQ::ComparisonOperator::LessThanOrEqual; 192 } 193 return CQ::ComparisonOperator::LessThan; 194 case '>': 195 if (range.peek().type() == DelimiterToken && range.peek().delimiter() == '=') { 196 range.consume(); 197 return CQ::ComparisonOperator::GreaterThanOrEqual; 198 } 199 return CQ::ComparisonOperator::GreaterThan; 200 default: 201 return { }; 202 } 203 } 204 return { }; 205 }; 206 207 auto op = consumeOperator(); 208 if (!op) 209 return { }; 210 211 range.consumeWhitespace(); 169 212 170 213 auto length = CSSPropertyParserHelpers::consumeLength(range, m_context.mode, ValueRange::All); … … 172 215 return { }; 173 216 174 return CQ::SizeFeature { op, name.toAtomString(), length };175 } 176 177 } 217 return CQ::SizeFeature { *op, name.toAtomString(), length }; 218 } 219 220 } -
trunk/Source/WebCore/css/ContainerQueryParser.h
r289742 r289789 38 38 std::optional<CQ::SizeQuery> consumeSizeQuery(CSSParserTokenRange&); 39 39 template<typename ConditionType> std::optional<ConditionType> consumeCondition(CSSParserTokenRange&); 40 std::optional<CQ::SizeFeature> consumeSizeFeature(CSSParserTokenRange&); 40 41 41 42 ContainerQueryParser(const CSSParserContext& context)
Note: See TracChangeset
for help on using the changeset viewer.