[webkit-changes] [WebKit/WebKit] c5606c: Adopt CompactVariant in Style::LengthPercentage/St...
Sam Weinig
noreply at github.com
Tue Dec 31 14:06:33 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c5606cb19ea924582d75939ec6343cec295f1d7e
https://github.com/WebKit/WebKit/commit/c5606cb19ea924582d75939ec6343cec295f1d7e
Author: Sam Weinig <sam at webkit.org>
Date: 2024-12-31 (Tue, 31 Dec 2024)
Changed paths:
M Source/WTF/wtf/CompactVariant.h
M Source/WTF/wtf/CompactVariantOperations.h
M Source/WTF/wtf/StdLibExtras.h
M Source/WTF/wtf/VariantExtras.h
M Source/WebCore/Headers.cmake
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/values/color/CSSColorConversion+ToTypedColor.h
M Source/WebCore/css/values/primitives/CSSUnevaluatedCalc.h
M Source/WebCore/style/values/images/StyleGradient.cpp
M Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Blending.h
M Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Calculation.h
M Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.cpp
M Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.h
M Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h
M Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes.h
A Source/WebCore/style/values/primitives/StyleUnevaluatedCalculation.h
M Tools/TestWebKitAPI/Tests/WTF/CompactVariant.cpp
Log Message:
-----------
Adopt CompactVariant in Style::LengthPercentage/Style::AnglePercentage
https://bugs.webkit.org/show_bug.cgi?id=285250
Reviewed by Darin Adler.
Replaces hand rolled compact variant, `PrimitiveDimensionPercentage`,
used by `Style::LengthPercentage` and `Style::AnglePercentage` with
the new `WTF::CompactVariant` type.
To aid this, the direct use of `Ref<CalculationValue>` was replaced
with a new generic `Style::UnevaluatedCalculation<>` which serves as
the Style layer analog to the CSS layers `CSS::UnevaluatedCalc<>`.
Mark both types as being smart pointers by specializing `IsSmartPtr`
so that they both can be used in `CompactVariants`.
`Style::LengthPercentage` and `Style::AnglePercentage` were almost
identical, so rather than updating both of them to use the new type,
the generic `DimensionPercentage<>` was added, allowing subclassing
to define `Style::LengthPercentage` and `Style::AnglePercentage`.
A few issues arose with `WTF::CompactVariant` that ended up being
due to the implementations of move and copy not encoding types with
alternative representations correctly. This has been corrected and
tests have been added.
Additionally, it was useful to be able to swap in `std::variant<>`
in place of `WTF::CompactVariant` to debug issues. To make this
feasible without changing code, a new WTF::holdsAlternative<> was
added that works with any "variant-like".
* Source/WTF/wtf/CompactVariant.h:
* Source/WTF/wtf/CompactVariantOperations.h:
* Source/WTF/wtf/StdLibExtras.h:
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/values/color/CSSColorConversion+ToTypedColor.h:
* Source/WebCore/css/values/primitives/CSSUnevaluatedCalc.h:
* Source/WebCore/style/values/images/StyleGradient.cpp:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Blending.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Calculation.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.cpp:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes.h:
* Source/WebCore/style/values/primitives/StyleUnevaluatedCalculation.h: Added.
* Tools/TestWebKitAPI/Tests/WTF/CompactVariant.cpp:
Canonical link: https://commits.webkit.org/288346@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list