Changeset 271866 in webkit
- Timestamp:
- Jan 25, 2021 3:32:13 PM (18 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/fast/css/parsing-lab-colors-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/parsing-lab-colors.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r271861 r271866 1 2021-01-25 Sam Weinig <weinig@apple.com> 2 3 Support percentages when parsing color(srgb ...) and color(display-p3 ...) per-spec 4 https://bugs.webkit.org/show_bug.cgi?id=220940 5 6 Reviewed by Simon Fraser. 7 8 Add support for using percentages when using the color(srgb ) and color(display-p3 ) syntax. Also 9 fix color(lab ) to allow elliding parameters and defaulting them to 0 as per-spec. 10 11 * TestExpectations: 12 * fast/css/parsing-lab-colors-expected.txt: 13 * fast/css/parsing-lab-colors.html: 14 1 15 2021-01-25 Aditya Keerthi <akeerthi@apple.com> 2 16 -
trunk/LayoutTests/TestExpectations
r271807 r271866 4577 4577 4578 4578 # Unsupported css color() variants 4579 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-002.html [ ImageOnlyFailure ] 4580 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-003.html [ ImageOnlyFailure ] 4581 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-004.html [ ImageOnlyFailure ] 4582 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-006.html [ ImageOnlyFailure ] 4583 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-007.html [ ImageOnlyFailure ] 4584 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-008.html [ ImageOnlyFailure ] 4585 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-009.html [ ImageOnlyFailure ] 4586 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-010.html [ ImageOnlyFailure ] 4587 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-011.html [ ImageOnlyFailure ] 4588 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-012.html [ ImageOnlyFailure ] 4589 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-014.html [ ImageOnlyFailure ] 4590 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-015.html [ ImageOnlyFailure ] 4591 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-016.html [ ImageOnlyFailure ] 4592 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-017.html [ ImageOnlyFailure ] 4579 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-003.html [ ImageOnlyFailure ] # Invalid test, no colorspace specified 4580 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-004.html [ ImageOnlyFailure ] # Invalid test, no colorspace specified 4581 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-007.html [ ImageOnlyFailure ] # Requires a98-rgb support 4582 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-008.html [ ImageOnlyFailure ] # Requires a98-rgb support 4583 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-009.html [ ImageOnlyFailure ] # Requires prophoto-rgb support 4584 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-010.html [ ImageOnlyFailure ] # Requires prophoto-rgb support 4585 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-011.html [ ImageOnlyFailure ] # Requires rec2020 support 4586 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-012.html [ ImageOnlyFailure ] # Requires rec2020 support 4587 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-014.html [ ImageOnlyFailure ] # Requires fallback (at parse time) support 4588 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-015.html [ ImageOnlyFailure ] # Requires fallback (at parse time) support (unclear if this makes sense) 4589 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-016.html [ ImageOnlyFailure ] # Requires xyz support 4590 webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-017.html [ ImageOnlyFailure ] # Requires xyz support -
trunk/LayoutTests/fast/css/parsing-lab-colors-expected.txt
r271362 r271866 47 47 PASS computedStyle("background-color", "color(lab 0% 0 0 / 110%)") is "lab(0% 0 0)" 48 48 PASS computedStyle("background-color", "color(lab 0% 0 0 / 300%)") is "lab(0% 0 0)" 49 PASS computedStyle("background-color", "color(lab 50% -200)") is "lab(50% -200 0)" 50 PASS computedStyle("background-color", "color(lab 50%)") is "lab(50% 0 0)" 51 PASS computedStyle("background-color", "color(lab)") is "lab(0% 0 0)" 52 PASS computedStyle("background-color", "color(lab 50% -200 / 0.5)") is "lab(50% -200 0 / 0.5)" 53 PASS computedStyle("background-color", "color(lab 50% / 0.5)") is "lab(50% 0 0 / 0.5)" 54 PASS computedStyle("background-color", "color(lab / 0.5)") is "lab(0% 0 0 / 0.5)" 49 55 50 56 Test invalid values -
trunk/LayoutTests/fast/css/parsing-lab-colors.html
r271362 r271866 81 81 testComputed("background-color", "color(lab 0% 0 0 / 110%)", "lab(0% 0 0)"); 82 82 testComputed("background-color", "color(lab 0% 0 0 / 300%)", "lab(0% 0 0)"); 83 testComputed("background-color", "color(lab 50% -200)", "lab(50% -200 0)"); 84 testComputed("background-color", "color(lab 50%)", "lab(50% 0 0)"); 85 testComputed("background-color", "color(lab)", "lab(0% 0 0)"); 86 testComputed("background-color", "color(lab 50% -200 / 0.5)", "lab(50% -200 0 / 0.5)"); 87 testComputed("background-color", "color(lab 50% / 0.5)", "lab(50% 0 0 / 0.5)"); 88 testComputed("background-color", "color(lab / 0.5)", "lab(0% 0 0 / 0.5)"); 83 89 84 90 debug(''); -
trunk/Source/WebCore/ChangeLog
r271861 r271866 1 2021-01-25 Sam Weinig <weinig@apple.com> 2 3 Support percentages when parsing color(srgb ...) and color(display-p3 ...) per-spec 4 https://bugs.webkit.org/show_bug.cgi?id=220940 5 6 Reviewed by Simon Fraser. 7 8 Add support for using percentages when using the color(srgb ) and color(display-p3 ) syntax. Also 9 fix color(lab ) to allow elliding parameters and defaulting them to 0 as per-spec. 10 11 Unfails some WPT tests and adds additional parsing tests for lab to fast/css/parsing-lab-colors.html 12 13 * css/parser/CSSPropertyParserHelpers.cpp: 14 (WebCore::CSSPropertyParserHelpers::parseColorFunctionForSRGBOrDisplayP3Parameters): 15 (WebCore::CSSPropertyParserHelpers::parseColorFunctionForLabParameters): 16 1 17 2021-01-25 Aditya Keerthi <akeerthi@apple.com> 2 18 -
trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
r271695 r271866 881 881 consumeIdentRaw(args); 882 882 883 double c olorChannels[3] = { 0, 0, 0 };883 double channels[3] = { 0, 0, 0 }; 884 884 for (int i = 0; i < 3; ++i) { 885 885 double value; 886 886 if (consumeNumberRaw(args, value)) 887 colorChannels[i] = value; 887 channels[i] = value; 888 else if (auto percent = consumePercentRaw(args)) 889 channels[i] = *percent / 100.0; 888 890 else 889 891 break; … … 894 896 return { }; 895 897 896 return ColorType { clampTo<float>(c olorChannels[0], 0.0, 1.0), clampTo<float>(colorChannels[1], 0.0, 1.0), clampTo<float>(colorChannels[2], 0.0, 1.0), *alpha };898 return ColorType { clampTo<float>(channels[0], 0.0, 1.0), clampTo<float>(channels[1], 0.0, 1.0), clampTo<float>(channels[2], 0.0, 1.0), *alpha }; 897 899 } 898 900 … … 902 904 consumeIdentRaw(args); 903 905 904 auto lightness = consumePercentRaw(args, ValueRangeAll); 905 if (!lightness) 906 return { }; 907 908 double aValue; 909 if (!consumeNumberRaw(args, aValue, ValueRangeAll)) 910 return { }; 911 912 double bValue; 913 if (!consumeNumberRaw(args, bValue, ValueRangeAll)) 914 return { }; 906 double channels[3] = { 0, 0, 0 }; 907 [&] { 908 auto lightness = consumePercentRaw(args, ValueRangeAll); 909 if (!lightness) 910 return; 911 channels[0] = *lightness; 912 913 double aValue; 914 if (!consumeNumberRaw(args, aValue, ValueRangeAll)) 915 return; 916 channels[1] = aValue; 917 918 double bValue; 919 if (!consumeNumberRaw(args, bValue, ValueRangeAll)) 920 return; 921 channels[2] = bValue; 922 }(); 915 923 916 924 auto alpha = parseOptionalAlpha(args); … … 918 926 return { }; 919 927 920 return Lab<float> { static_cast<float>( *lightness), static_cast<float>(aValue), static_cast<float>(bValue), *alpha };928 return Lab<float> { static_cast<float>(channels[0]), static_cast<float>(channels[1]), static_cast<float>(channels[2]), *alpha }; 921 929 } 922 930
Note: See TracChangeset
for help on using the changeset viewer.