Support css-color-4 rgb functions
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jan 2019 20:53:37 +0000 (20:53 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jan 2019 20:53:37 +0000 (20:53 +0000)
commit89fe39fe671b7f5685899572beccfa10f5a5898c
tree3c80126da2b7d5c3e7e566441519efc0ce46bdce
parent24bb0b3557ee4260bc45b589cfdd82322d93cebf
Support css-color-4 rgb functions
https://bugs.webkit.org/show_bug.cgi?id=192321

Reviewed by Zalan Bujtas.
LayoutTests/imported/w3c:

New expected results.

* web-platform-tests/css/css-color/color-resolving-expected.txt:
* web-platform-tests/css/css-color/rgb-rounding-001-expected.txt:

Source/WebCore:

Support the new rgb()/rgba() syntax described in https://drafts.csswg.org/css-color/#rgb-functions.
The differences are:
1. There is a new comma-free syntax, where the optional alpha is separated by a slash:
    rgb(128 34 56)
    rgb(128 34 56 / 50%)
2. Floating point values are allowed, and rounded:
    rgb(128.5 34.2 56.5) becomes rgb(129 34 57)
3. rgba() is a pure alias for rgb(), so these are equivalent:
    rgb(128 34 56 / 50%)
    rgba(128 34 56 / 50%)

hsl()/hsla() parsing was already updated to this new syntax in r230861.

Tested by tests in imported/w3c/web-platform-tests/css/css-color/

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::clampRGBComponent):
(WebCore::CSSPropertyParserHelpers::parseRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseColorFunction):

LayoutTests:

* TestExpectations: Unskip most of the WPT css-color rgb tests. Skip old imported WPT canvas tests.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-1-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-1.html: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-2-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-2.html: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-5-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-5.html: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-7-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-7.html: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-1-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-1.html: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-2-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-2.html: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-4-expected.txt: Removed.
* canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-4.html: Removed.
* css3/calc/color-rgb-expected.txt:
* fast/canvas/gradient-addColorStop-with-invalid-color-expected.txt:
* fast/canvas/gradient-addColorStop-with-invalid-color.html: Remove a test that is no longer invalid.
* fast/css/rgb-float.html: Removed. This test is no longer value, since rgb() accepts floating point values.
* platform/gtk/css2.1/t040306-syntax-01-f-expected.txt:
* platform/gtk/fast/css/rgb-float-expected.png: Removed.
* platform/gtk/fast/css/rgb-float-expected.txt: Removed.
* platform/gtk/svg/hixie/perf/007-expected.txt:
* platform/ios/css2.1/t040306-syntax-01-f-expected.txt:
* platform/ios/fast/css/rgb-float-expected.txt: Removed.
* platform/mac/css2.1/t040306-syntax-01-f-expected.txt:
* platform/mac/fast/css/rgb-float-expected.png: Removed.
* platform/mac/fast/css/rgb-float-expected.txt: Removed.
* platform/mac/svg/hixie/perf/007-expected.txt:
* platform/win-future/svg/hixie/perf/007-expected.txt:
* platform/win/css2.1/t040306-syntax-01-f-expected.txt:
* platform/win/svg/hixie/perf/007-expected.txt:
* platform/wincairo/css2.1/t040306-syntax-01-f-expected.txt:
* platform/wincairo/fast/css/rgb-float-expected.txt: Removed.
* platform/wpe/css2.1/t040306-syntax-01-f-expected.txt:
* platform/wpe/fast/css/rgb-float-expected.txt: Removed.
* platform/wpe/svg/hixie/perf/007-expected.txt:
* svg/hixie/perf/007-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-1-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-1.html [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-2-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-2.html [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-5-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-5.html [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-7-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgb-7.html [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-1-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-1.html [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-2-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-2.html [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-4-expected.txt [deleted file]
LayoutTests/canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-4.html [deleted file]
LayoutTests/css3/calc/color-rgb-expected.txt
LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color-expected.txt
LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color.html
LayoutTests/fast/css/rgb-float.html [deleted file]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-color/color-resolving-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-color/rgb-rounding-001-expected.txt
LayoutTests/platform/gtk/css2.1/t040306-syntax-01-f-expected.txt
LayoutTests/platform/gtk/fast/css/rgb-float-expected.png [deleted file]
LayoutTests/platform/gtk/fast/css/rgb-float-expected.txt [deleted file]
LayoutTests/platform/gtk/svg/hixie/perf/007-expected.txt
LayoutTests/platform/ios/css2.1/t040306-syntax-01-f-expected.txt
LayoutTests/platform/ios/fast/css/rgb-float-expected.txt [deleted file]
LayoutTests/platform/mac/css2.1/t040306-syntax-01-f-expected.txt
LayoutTests/platform/mac/fast/css/rgb-float-expected.png [deleted file]
LayoutTests/platform/mac/fast/css/rgb-float-expected.txt [deleted file]
LayoutTests/platform/mac/svg/hixie/perf/007-expected.txt
LayoutTests/platform/win-future/svg/hixie/perf/007-expected.txt
LayoutTests/platform/win/css2.1/t040306-syntax-01-f-expected.txt
LayoutTests/platform/win/svg/hixie/perf/007-expected.txt
LayoutTests/platform/wincairo/css2.1/t040306-syntax-01-f-expected.txt
LayoutTests/platform/wincairo/fast/css/rgb-float-expected.txt [deleted file]
LayoutTests/platform/wpe/css2.1/t040306-syntax-01-f-expected.txt
LayoutTests/platform/wpe/fast/css/rgb-float-expected.txt [deleted file]
LayoutTests/platform/wpe/svg/hixie/perf/007-expected.txt
LayoutTests/svg/hixie/perf/007-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp