Bug 1861739 - Add getter for the color interpolation method of a gradient r=layout-reviewers,emilio

Add a simple getter for the color interpolation method with is stored on
each of the structs in the union. This just makes it easier to get.

Differential Revision: https://phabricator.services.mozilla.com/D192105
This commit is contained in:
Tiaan Louw 2023-10-28 06:59:41 +00:00
parent 44fa80ec1a
commit 1b8d896689
2 changed files with 15 additions and 0 deletions

View File

@ -461,6 +461,18 @@ inline bool StyleGradient::Repeating() const {
template <>
bool StyleGradient::IsOpaque() const;
template <>
inline const StyleColorInterpolationMethod&
StyleGradient::ColorInterpolationMethod() const {
if (IsLinear()) {
return AsLinear().color_interpolation_method;
}
if (IsRadial()) {
return AsRadial().color_interpolation_method;
}
return AsConic().color_interpolation_method;
}
template <typename Integer>
inline StyleGenericGridLine<Integer>::StyleGenericGridLine()
: ident(do_AddRef(static_cast<nsAtom*>(nsGkAtoms::_empty))),

View File

@ -823,6 +823,9 @@ renaming_overrides_prefixing = true
"GenericGradient" = """
inline bool Repeating() const;
bool IsOpaque() const;
// Return the color interpolation method of the gradient.
inline const StyleColorInterpolationMethod& ColorInterpolationMethod() const;
"""
"GenericGridLine" = """