[webkit-changes] [WebKit/WebKit] f62447: Use more constrained types to represent CSS gradie...
Sam Weinig
noreply at github.com
Tue Nov 1 21:53:23 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f62447bff59b85890116e58a9740fc50113bba06
https://github.com/WebKit/WebKit/commit/f62447bff59b85890116e58a9740fc50113bba06
Author: Sam Weinig <weinig at apple.com>
Date: 2022-11-01 (Tue, 01 Nov 2022)
Changed paths:
M Source/WebCore/css/CSSGradientValue.cpp
M Source/WebCore/css/CSSGradientValue.h
M Source/WebCore/css/CSSValue.cpp
M Source/WebCore/css/CSSValue.h
M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
M Source/WebCore/html/HTMLInputElement.cpp
M Source/WebCore/rendering/style/StyleGradientImage.cpp
M Source/WebCore/rendering/style/StyleGradientImage.h
M Source/WebCore/style/StyleBuilderState.cpp
M Source/WebCore/style/StylePendingResources.cpp
Log Message:
-----------
Use more constrained types to represent CSS gradient values
https://bugs.webkit.org/show_bug.cgi?id=247235
rdar://101720047
Reviewed by Darin Adler.
To make further progress on moving the CSS gradient code toward
correct semantics, I took a moment to refactor the current CSS
value subclasses to better represent the parsed output. To do
this, I broke apart the deprecated, prefixed and standard variants
into their own types and now only store exactly what is needed
to represent the gradient, utilizing std::variant and additional
structs to provide the structure.
Now, if a gradient has a member that is a RefPtr<>, you can be
assured that it is required to check for nullptr, otherwise, a
Ref<> would have been used.
I also took the opertunity to remove the base CSSGradientValue
class as there was no need polymorphism being used and removing
it gets us closer to CSSValue value semantics.
* Source/WebCore/css/CSSGradientValue.cpp:
(WebCore::computeStops):
(WebCore::CSSLinearGradientValue::createStyleImage const):
(WebCore::CSSPrefixedLinearGradientValue::createStyleImage const):
(WebCore::CSSDeprecatedLinearGradientValue::createStyleImage const):
(WebCore::CSSRadialGradientValue::createStyleImage const):
(WebCore::CSSPrefixedRadialGradientValue::createStyleImage const):
(WebCore::CSSDeprecatedRadialGradientValue::createStyleImage const):
(WebCore::CSSConicGradientValue::createStyleImage const):
(WebCore::operator==):
(WebCore::cssText):
(WebCore::CSSLinearGradientValue::customCSSText const):
(WebCore::CSSLinearGradientValue::equals const):
(WebCore::CSSPrefixedLinearGradientValue::customCSSText const):
(WebCore::CSSPrefixedLinearGradientValue::equals const):
(WebCore::CSSDeprecatedLinearGradientValue::customCSSText const):
(WebCore::CSSDeprecatedLinearGradientValue::equals const):
(WebCore::CSSRadialGradientValue::customCSSText const):
(WebCore::CSSRadialGradientValue::equals const):
(WebCore::CSSPrefixedRadialGradientValue::customCSSText const):
(WebCore::CSSPrefixedRadialGradientValue::equals const):
(WebCore::CSSDeprecatedRadialGradientValue::customCSSText const):
(WebCore::CSSDeprecatedRadialGradientValue::equals const):
(WebCore::CSSConicGradientValue::customCSSText const):
(WebCore::CSSConicGradientValue::equals const):
(WebCore::CSSGradientValue::computeStops const): Deleted.
(WebCore::CSSGradientValue::createStyleImage const): Deleted.
(WebCore::CSSGradientValue::equals const): Deleted.
* Source/WebCore/css/CSSGradientValue.h:
(WebCore::CSSGradientValue::setFirstX): Deleted.
(WebCore::CSSGradientValue::setFirstY): Deleted.
(WebCore::CSSGradientValue::setSecondX): Deleted.
(WebCore::CSSGradientValue::setSecondY): Deleted.
(WebCore::CSSGradientValue::gradientType const): Deleted.
(WebCore::CSSGradientValue::CSSGradientValue): Deleted.
(WebCore::CSSGradientValue::firstX const): Deleted.
(WebCore::CSSGradientValue::firstY const): Deleted.
(WebCore::CSSGradientValue::secondX const): Deleted.
(WebCore::CSSGradientValue::secondY const): Deleted.
(WebCore::CSSGradientValue::stops const): Deleted.
(WebCore::CSSGradientValue::isRepeating const): Deleted.
(WebCore::CSSGradientValue::colorInterpolationMethod const): Deleted.
* Source/WebCore/css/CSSValue.cpp:
(WebCore::CSSValue::visitDerived):
* Source/WebCore/css/CSSValue.h:
(WebCore::CSSValue::isImageGeneratorValue const):
(WebCore::CSSValue::isGradientValue const):
(WebCore::CSSValue::isDeprecatedLinearGradientValue const):
(WebCore::CSSValue::isDeprecatedRadialGradientValue const):
(WebCore::CSSValue::isPrefixedLinearGradientValue const):
(WebCore::CSSValue::isPrefixedRadialGradientValue const):
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPointValue):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStops):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedLinearGradient):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
(WebCore::CSSPropertyParserHelpers::consumeColorStopList):
(WebCore::CSSPropertyParserHelpers::consumeLengthColorStopList):
(WebCore::CSSPropertyParserHelpers::consumeAngularColorStopList):
(WebCore::CSSPropertyParserHelpers::consumePrefixedRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumePrefixedLinearGradient):
(WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
(WebCore::CSSPropertyParserHelpers::consumeConicGradient):
(WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
(WebCore::CSSPropertyParserHelpers::consumeGradientColorStops): Deleted.
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::autoFillStrongPasswordMaskImage):
* Source/WebCore/rendering/style/StyleGradientImage.cpp:
(WebCore::operator==):
(WebCore::StyleGradientImage::StyleGradientImage):
(WebCore::StyleGradientImage::equals const):
(WebCore::StyleGradientImage::computedStyleValue const):
(WebCore::StyleGradientImage::computeStopsForDeprecatedVariants const):
(WebCore::StyleGradientImage::computeStops const):
(WebCore::positionFromValue):
(WebCore::computeEndPoint):
(WebCore::endPointsFromAngle):
(WebCore::endPointsFromAngleForPrefixedVariants):
(WebCore::resolveRadius):
(WebCore::distanceToClosestCorner):
(WebCore::distanceToFarthestCorner):
(WebCore::StyleGradientImage::createGradient const):
* Source/WebCore/rendering/style/StyleGradientImage.h:
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::createStyleImage):
* Source/WebCore/style/StylePendingResources.cpp:
Canonical link: https://commits.webkit.org/256211@main
More information about the webkit-changes
mailing list