[Conic Gradients] Add support for parsing conic gradients
https://bugs.webkit.org/show_bug.cgi?id=178987
Reviewed by Dean Jackson.
Source/WebCore:
Adds initial support, disabled by default, for parsing conic gradients as per
CSS 4 Images - https://www.w3.org/TR/css-images-4/#conic-gradients.
Test: fast/gradients/conic-gradient-parsing.html
- css/CSSGradientValue.cpp:
(WebCore::clone):
(WebCore::CSSGradientValue::isCacheable const):
(WebCore::CSSConicGradientValue::customCSSText const):
(WebCore::CSSConicGradientValue::createGradient):
(WebCore::CSSConicGradientValue::equals const):
Add CSSConicGradientValue as a subclass of CSSGradientValue and implement
customCSSText() and equals(). Stub out createGradient() as painting is not
yet implemented.
- css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::image):
(WebCore::CSSImageGeneratorValue::isFixedSize const):
(WebCore::CSSImageGeneratorValue::fixedSize):
(WebCore::CSSImageGeneratorValue::isPending const):
(WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
(WebCore::CSSImageGeneratorValue::loadSubimages):
(WebCore::CSSValue::equals const):
(WebCore::CSSValue::cssText const):
(WebCore::CSSValue::destroy):
Dispatch to CSSConicGradientValue as needed.
(WebCore::CSSValue::isImageGeneratorValue const):
(WebCore::CSSValue::isGradientValue const):
(WebCore::CSSValue::isConicGradientValue const):
Add conic gradient predicate support and update isImageGeneratorValue and
isGradientValue to include conic gradient.
Add conic-gradient and repeating-conic-gradient.
- css/parser/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
- css/parser/CSSParserMode.h:
(WebCore::CSSParserContextHash::hash):
Add runtime flags to enable conic gradients.
- css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
Helper, similar to consumeLengthOrPercent, for consumeGradientColorStops.
Corresponds to https://drafts.csswg.org/css-values-4/#typedef-angle-percentage
(WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
Convert to take CSSGradientValue by reference.
(WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops):
Helper, similar to consumeGradientColorStops, but for angular color stops
used in conic gradients. Corresponds to https://www.w3.org/TR/css-images-4/#typedef-angular-color-stop-list
but does not yet support double position syntax.
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
Pass CSSGradientValue by reference.
(WebCore::CSSPropertyParserHelpers::consumeConicGradient):
Parse conic gradient.
(WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
Dispatch to consumeConicGradient for repeating and non-repeating
conic gradients.
(WebCore::CSSPropertyParserHelpers::isGeneratedImage):
Put each value on its own line to make it more readable and add CSSValueConicGradient
and CSSValueRepeatingConicGradient.
Add a setting to enable conic gradients. Disabled by default.
Move conic gradients to "In Development".
LayoutTests:
- http/wpt/css: Added.
- http/wpt/css/css-images-4: Added.
- http/wpt/css/css-images-4/conic-gradient-parsing-expected.txt: Added.
- http/wpt/css/css-images-4/conic-gradient-parsing.html: Added.
Add tests for basic parsing of conic gradients.