Handle calc() expressions in gradient color stops
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jan 2019 19:24:48 +0000 (19:24 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jan 2019 19:24:48 +0000 (19:24 +0000)
commit28715924fcb674f6b736ac8288c99e710f23752d
tree908afd4925c223192eda5498b5fb98a45d205966
parentc841beb136ebf54c62c4e5359922a385577cf6e2
Handle calc() expressions in gradient color stops
https://bugs.webkit.org/show_bug.cgi?id=193066
rdar://problem/46961985

Reviewed by Sam Weinig.
Source/WebCore:

Fix two issues that prevented calc() expressions from working in conic-gradient color stops,
for the angle or percent value. First, consumeAngleOrPercent() needs to look for CalculationCategory::Percent
calc values as well as angle ones.

Second, CSSPrimitiveValue::isAngle() needs to use primitiveType() (which takes calc into account),
just as isPx() etc do.

Test: fast/gradients/conic-calc-stop-position.html

* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::isAngle const):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
(WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):

LayoutTests:

* fast/gradients/conic-calc-stop-position-expected.html: Added.
* fast/gradients/conic-calc-stop-position.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239571 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/gradients/conic-calc-stop-position-expected.html [new file with mode: 0644]
LayoutTests/fast/gradients/conic-calc-stop-position.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp