Changeset 276293 in webkit
- Timestamp:
- Apr 20, 2021 2:14:49 AM (15 months ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-display/parsing/display-valid-expected.txt (modified) (3 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-other-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSValueKeywords.in (modified) (1 diff)
-
Source/WebCore/css/parser/CSSParserFastPaths.cpp (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r276291 r276293 1 2021-04-20 Tim Nguyen <ntim@apple.com> 2 3 Implement CSS display property 2-value syntax 4 https://bugs.webkit.org/show_bug.cgi?id=224574 5 6 Reviewed by Darin Adler. 7 8 Except for list-item which doesn't have layout support for different variants. 9 Also fix a WPT to expect the most backwards-compatible form for `display: flow` computed value. 10 11 Test: web-platform-tests/css/css-display/parsing/display-valid.html 12 13 * platform/mac-wk1/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt: 14 1 15 2021-04-20 Diego Pino Garcia <dpino@igalia.com> 2 16 -
trunk/LayoutTests/imported/w3c/ChangeLog
r276264 r276293 1 2021-04-20 Tim Nguyen <ntim@apple.com> 2 3 Implement CSS display property 2-value syntax 4 https://bugs.webkit.org/show_bug.cgi?id=224574 5 6 Reviewed by Darin Adler. 7 8 Except for list-item which doesn't have layout support for different variants. 9 Also fix a WPT to expect the most backwards-compatible form for `display: flow` computed value. 10 11 Test: web-platform-tests/css/css-display/parsing/display-valid.html 12 13 * web-platform-tests/css/css-display/parsing/display-valid-expected.txt: 14 * web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt: 15 * web-platform-tests/html/rendering/widgets/button-layout/computed-style.html: 16 * web-platform-tests/html/rendering/widgets/button-layout/display-other-expected.txt: 17 1 18 2021-04-19 Manuel Rego Casasnovas <rego@igalia.com> 2 19 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-display/parsing/display-valid-expected.txt
r267650 r276293 18 18 PASS e.style['display'] = "none" should set the property value 19 19 FAIL e.style['display'] = "run-in" should set the property value assert_not_equals: property should be set got disallowed value "" 20 FAIL e.style['display'] = "flow" should set the property value assert_not_equals: property should be set got disallowed value "" 20 PASS e.style['display'] = "flow" should set the property value 21 21 PASS e.style['display'] = "flow-root" should set the property value 22 22 FAIL e.style['display'] = "ruby" should set the property value assert_not_equals: property should be set got disallowed value "" … … 25 25 FAIL e.style['display'] = "flow-root list-item" should set the property value assert_not_equals: property should be set got disallowed value "" 26 26 FAIL e.style['display'] = "list-item flow-root" should set the property value assert_not_equals: property should be set got disallowed value "" 27 FAIL e.style['display'] = "block flow" should set the property value assert_not_equals: property should be set got disallowed value "" 28 FAIL e.style['display'] = "flow block" should set the property value assert_not_equals: property should be set got disallowed value "" 29 FAIL e.style['display'] = "flow-root block" should set the property value assert_not_equals: property should be set got disallowed value "" 30 FAIL e.style['display'] = "block flow-root" should set the property value assert_not_equals: property should be set got disallowed value "" 31 FAIL e.style['display'] = "flex block" should set the property value assert_not_equals: property should be set got disallowed value "" 32 FAIL e.style['display'] = "block flex" should set the property value assert_not_equals: property should be set got disallowed value "" 33 FAIL e.style['display'] = "grid block" should set the property value assert_not_equals: property should be set got disallowed value "" 34 FAIL e.style['display'] = "block grid" should set the property value assert_not_equals: property should be set got disallowed value "" 35 FAIL e.style['display'] = "table block" should set the property value assert_not_equals: property should be set got disallowed value "" 36 FAIL e.style['display'] = "block table" should set the property value assert_not_equals: property should be set got disallowed value "" 27 PASS e.style['display'] = "block flow" should set the property value 28 PASS e.style['display'] = "flow block" should set the property value 29 PASS e.style['display'] = "flow-root block" should set the property value 30 PASS e.style['display'] = "block flow-root" should set the property value 31 PASS e.style['display'] = "flex block" should set the property value 32 PASS e.style['display'] = "block flex" should set the property value 33 PASS e.style['display'] = "grid block" should set the property value 34 PASS e.style['display'] = "block grid" should set the property value 35 PASS e.style['display'] = "table block" should set the property value 36 PASS e.style['display'] = "block table" should set the property value 37 37 FAIL e.style['display'] = "block ruby" should set the property value assert_not_equals: property should be set got disallowed value "" 38 38 FAIL e.style['display'] = "ruby block" should set the property value assert_not_equals: property should be set got disallowed value "" … … 51 51 FAIL e.style['display'] = "list-item block flow-root" should set the property value assert_not_equals: property should be set got disallowed value "" 52 52 FAIL e.style['display'] = "list-item flow-root block" should set the property value assert_not_equals: property should be set got disallowed value "" 53 FAIL e.style['display'] = "inline flow" should set the property value assert_not_equals: property should be set got disallowed value "" 54 FAIL e.style['display'] = "flow inline" should set the property value assert_not_equals: property should be set got disallowed value "" 55 FAIL e.style['display'] = "flow-root inline" should set the property value assert_not_equals: property should be set got disallowed value "" 56 FAIL e.style['display'] = "inline flow-root" should set the property value assert_not_equals: property should be set got disallowed value "" 57 FAIL e.style['display'] = "flex inline" should set the property value assert_not_equals: property should be set got disallowed value "" 58 FAIL e.style['display'] = "inline flex" should set the property value assert_not_equals: property should be set got disallowed value "" 59 FAIL e.style['display'] = "grid inline" should set the property value assert_not_equals: property should be set got disallowed value "" 60 FAIL e.style['display'] = "inline grid" should set the property value assert_not_equals: property should be set got disallowed value "" 61 FAIL e.style['display'] = "table inline" should set the property value assert_not_equals: property should be set got disallowed value "" 62 FAIL e.style['display'] = "inline table" should set the property value assert_not_equals: property should be set got disallowed value "" 53 PASS e.style['display'] = "inline flow" should set the property value 54 PASS e.style['display'] = "flow inline" should set the property value 55 PASS e.style['display'] = "flow-root inline" should set the property value 56 PASS e.style['display'] = "inline flow-root" should set the property value 57 PASS e.style['display'] = "flex inline" should set the property value 58 PASS e.style['display'] = "inline flex" should set the property value 59 PASS e.style['display'] = "grid inline" should set the property value 60 PASS e.style['display'] = "inline grid" should set the property value 61 PASS e.style['display'] = "table inline" should set the property value 62 PASS e.style['display'] = "inline table" should set the property value 63 63 FAIL e.style['display'] = "inline ruby" should set the property value assert_not_equals: property should be set got disallowed value "" 64 64 FAIL e.style['display'] = "ruby inline" should set the property value assert_not_equals: property should be set got disallowed value "" -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt
r267646 r276293 81 81 PASS computed display of <input type=color> with display: contents 82 82 PASS computed display of <button type=submit> with display: contents 83 FAIL computed display of <input type=reset> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 84 FAIL computed display of <input type=button> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 85 FAIL computed display of <input type=submit> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 86 FAIL computed display of <input type=color> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 87 FAIL computed display of <button type=submit> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 83 PASS computed display of <input type=reset> with display: flow 84 PASS computed display of <input type=button> with display: flow 85 PASS computed display of <input type=submit> with display: flow 86 PASS computed display of <input type=color> with display: flow 87 PASS computed display of <button type=submit> with display: flow 88 88 PASS computed display of <input type=reset> with display: flow-root 89 89 PASS computed display of <input type=button> with display: flow-root -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style.html
r249886 r276293 25 25 expectedVal = 'none'; // https://drafts.csswg.org/css-display/#unbox-html 26 26 } 27 if (val == 'flow') { 28 // Use the more backwards-compatible form, `block` is better than `flow` 29 // https://drafts.csswg.org/cssom/#serializing-css-values 30 expectedVal = 'block'; 31 } 27 32 assert_equals(getComputedStyle(el).display, expectedVal); 28 33 }, `computed display of ${tag} with display: ${val}`); -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-other-expected.txt
r267646 r276293 3 3 FAIL display: block assert_equals: buttonTop expected 0 but got 2 4 4 FAIL display: run-in assert_true: display: run-in is not supported expected true got false 5 FAIL display: flow assert_true: display: flow is not supported expected true got false 5 PASS display: flow 6 6 PASS display: flow-root 7 7 PASS display: table -
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt
r267658 r276293 81 81 PASS computed display of <input type=text> with display: contents 82 82 PASS computed display of <button type=submit> with display: contents 83 FAIL computed display of <input type=reset> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 84 FAIL computed display of <input type=button> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 85 FAIL computed display of <input type=submit> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 86 FAIL computed display of <input type=text> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 87 FAIL computed display of <button type=submit> with display: flow assert_not_equals: display: flow is not supported got disallowed value "" 83 PASS computed display of <input type=reset> with display: flow 84 PASS computed display of <input type=button> with display: flow 85 PASS computed display of <input type=submit> with display: flow 86 PASS computed display of <input type=text> with display: flow 87 PASS computed display of <button type=submit> with display: flow 88 88 PASS computed display of <input type=reset> with display: flow-root 89 89 PASS computed display of <input type=button> with display: flow-root -
trunk/Source/WebCore/ChangeLog
r276287 r276293 1 2021-04-20 Tim Nguyen <ntim@apple.com> 2 3 Implement CSS display property 2-value syntax 4 https://bugs.webkit.org/show_bug.cgi?id=224574 5 6 Reviewed by Darin Adler. 7 8 Except for list-item which doesn't have layout support for different variants. 9 Also fix a WPT to expect the most backwards-compatible form for `display: flow` computed value. 10 11 Test: web-platform-tests/css/css-display/parsing/display-valid.html 12 13 * css/CSSValueKeywords.in: 14 * css/parser/CSSParserFastPaths.cpp: 15 (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 16 (WebCore::CSSParserFastPaths::isKeywordPropertyID): 17 * css/parser/CSSPropertyParser.cpp: 18 (WebCore::consumeDisplay): 19 (WebCore::CSSPropertyParser::parseSingleValue): 20 1 21 2021-04-19 Antti Koivisto <antti@apple.com> 2 22 -
trunk/Source/WebCore/css/CSSValueKeywords.in
r276216 r276293 474 474 inline-grid 475 475 flow-root 476 flow 476 477 //none 477 478 // -
trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp
r276216 r276293 632 632 case CSSPropertyDirection: // ltr | rtl 633 633 return valueID == CSSValueLtr || valueID == CSSValueRtl; 634 case CSSPropertyDisplay:635 // inline | block | list-item | inline-block | table |636 // inline-table | table-row-group | table-header-group | table-footer-group | table-row |637 // table-column-group | table-column | table-cell | table-caption | -webkit-box | -webkit-inline-box | none638 // flex | inline-flex | -webkit-flex | -webkit-inline-flex | grid | inline-grid639 return (valueID >= CSSValueInline && valueID <= CSSValueContents) || valueID == CSSValueNone640 || valueID == CSSValueGrid || valueID == CSSValueInlineGrid || valueID == CSSValueFlowRoot;641 634 case CSSPropertyDominantBaseline: 642 635 // auto | use-script | no-change | reset-size | ideographic | … … 930 923 case CSSPropertyColumnRuleStyle: 931 924 case CSSPropertyDirection: 932 case CSSPropertyDisplay:933 925 case CSSPropertyEmptyCells: 934 926 case CSSPropertyFlexDirection: -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r276152 r276293 381 381 382 382 // Methods for consuming non-shorthand properties starts here. 383 static RefPtr<CSSValue> consumeDisplay(CSSParserTokenRange& range) 384 { 385 // Parse single keyword values 386 auto singleKeyword = consumeIdent< 387 // <display-box> 388 CSSValueContents, 389 CSSValueNone, 390 // <display-internal> 391 CSSValueTableCaption, 392 CSSValueTableCell, 393 CSSValueTableColumnGroup, 394 CSSValueTableColumn, 395 CSSValueTableHeaderGroup, 396 CSSValueTableFooterGroup, 397 CSSValueTableRow, 398 CSSValueTableRowGroup, 399 // <display-legacy> 400 CSSValueInlineBlock, 401 CSSValueInlineFlex, 402 CSSValueInlineGrid, 403 CSSValueInlineTable, 404 // Prefixed values 405 CSSValueWebkitInlineBox, 406 CSSValueWebkitBox, 407 CSSValueWebkitInlineFlex, 408 CSSValueWebkitFlex, 409 // No layout support for the full <display-listitem> syntax, so treat it as <display-legacy> 410 CSSValueListItem 411 >(range); 412 413 if (singleKeyword) 414 return singleKeyword; 415 416 // Empty value, stop parsing 417 if (range.atEnd()) 418 return nullptr; 419 420 // Parse [ <display-outside> || <display-inside> ] 421 Optional<CSSValueID> parsedDisplayOutside; 422 Optional<CSSValueID> parsedDisplayInside; 423 while (!range.atEnd()) { 424 auto nextValueID = range.peek().id(); 425 switch (nextValueID) { 426 // <display-outside> 427 case CSSValueBlock: 428 case CSSValueInline: 429 if (parsedDisplayOutside) 430 return nullptr; 431 parsedDisplayOutside = nextValueID; 432 break; 433 // <display-inside> 434 case CSSValueFlex: 435 case CSSValueFlow: 436 case CSSValueFlowRoot: 437 case CSSValueGrid: 438 case CSSValueTable: 439 if (parsedDisplayInside) 440 return nullptr; 441 parsedDisplayInside = nextValueID; 442 break; 443 default: 444 return nullptr; 445 } 446 consumeIdent(range); 447 } 448 449 // Set defaults when one of the two values are unspecified 450 CSSValueID displayOutside = parsedDisplayOutside.valueOr(CSSValueBlock); 451 CSSValueID displayInside = parsedDisplayInside.valueOr(CSSValueFlow); 452 453 auto selectShortValue = [&]() -> CSSValueID { 454 if (displayOutside == CSSValueBlock) { 455 // Alias display: flow to display: block 456 return displayInside == CSSValueFlow ? CSSValueBlock : displayInside; 457 } 458 459 // Convert `display: inline <display-inside>` to the equivalent short value 460 switch (displayInside) { 461 case CSSValueFlex: 462 return CSSValueInlineFlex; 463 case CSSValueFlow: 464 return CSSValueInline; 465 case CSSValueFlowRoot: 466 return CSSValueInlineBlock; 467 case CSSValueGrid: 468 return CSSValueInlineGrid; 469 case CSSValueTable: 470 return CSSValueInlineTable; 471 default: 472 ASSERT_NOT_REACHED(); 473 return CSSValueInline; 474 } 475 }; 476 477 return CSSValuePool::singleton().createValue(selectShortValue()); 478 } 479 383 480 static RefPtr<CSSValue> consumeWillChange(CSSParserTokenRange& range) 384 481 { … … 3885 3982 } 3886 3983 switch (property) { 3984 case CSSPropertyDisplay: 3985 return consumeDisplay(m_range); 3887 3986 case CSSPropertyWillChange: 3888 3987 return consumeWillChange(m_range);
Note: See TracChangeset
for help on using the changeset viewer.