Bug 235071 - CSS Gradients: interpolation mode should default to OKLab if any non-legacy color syntax colors are used in the stops
Summary: CSS Gradients: interpolation mode should default to OKLab if any non-legacy c...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-11 08:53 PST by Sam Weinig
Modified: 2022-01-15 22:24 PST (History)
13 users (show)

See Also:


Attachments
Patch (25.12 KB, patch)
2022-01-11 11:18 PST, Sam Weinig
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (25.13 KB, patch)
2022-01-11 14:06 PST, Sam Weinig
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (547.86 KB, patch)
2022-01-15 10:43 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (550.81 KB, patch)
2022-01-15 11:34 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (551.26 KB, patch)
2022-01-15 12:11 PST, Sam Weinig
darin: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (555.31 KB, patch)
2022-01-15 19:28 PST, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2022-01-11 08:53:27 PST
CSS Gradients: interpolation mode should default to OKLab if any non-legacy color syntax colors are used in the stops
Comment 1 Sam Weinig 2022-01-11 11:18:26 PST Comment hidden (obsolete)
Comment 2 Sam Weinig 2022-01-11 14:06:30 PST Comment hidden (obsolete)
Comment 3 Sam Weinig 2022-01-15 10:43:29 PST Comment hidden (obsolete)
Comment 4 EWS Watchlist 2022-01-15 10:44:30 PST Comment hidden (obsolete)
Comment 5 Sam Weinig 2022-01-15 11:34:27 PST Comment hidden (obsolete)
Comment 6 Sam Weinig 2022-01-15 12:11:25 PST Comment hidden (obsolete)
Comment 7 Darin Adler 2022-01-15 14:24:27 PST
Comment on attachment 449262 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=449262&action=review

> Source/WebCore/css/CSSGradientValue.cpp:651
> +        && m_defaultColorInterpolationMethod == other.m_defaultColorInterpolationMethod

Gosh can’t wait until we get enough C++20 support that we can stop writing these functions.

> Source/WebCore/css/CSSGradientValue.h:72
> -
> +    

Please don’t add the spaces here.

> Source/WebCore/css/CSSGradientValue.h:143
> +    static Ref<CSSLinearGradientValue> create(CSSGradientRepeat repeat, CSSGradientType gradientType, ColorInterpolationMethod colorInterpolationMethod, CSSGradientDefaultColorInterpolationMethod defaultColorInterpolationMethod, CSSGradientColorStopList stops)

Frustrating how long these argument names and types are.

> Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:3132
> +        downcast<CSSRadialGradientValue>(result.get())->setFirstRadius(WTFMove(firstRadius));
> +        downcast<CSSRadialGradientValue>(result.get())->setSecondRadius(WTFMove(secondRadius));

Can use (*result). here instead of (result.get())->

> Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:3567
> +    auto [computedColorInterpolationMethod, computedDefaultColorInterpolationMethod] = computeGradientColorInterpolationMethod(context, colorInterpolationMethod, *stops);

Reading this over and over again makes me wonder why we don’t pass these two around together as a struct.
Comment 8 Sam Weinig 2022-01-15 19:28:14 PST
Created attachment 449280 [details]
Patch
Comment 9 Sam Weinig 2022-01-15 19:50:34 PST
(In reply to Darin Adler from comment #7)
> Comment on attachment 449262 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=449262&action=review
> 
> 
> > Source/WebCore/css/CSSGradientValue.h:72
> > -
> > +    
> 
> Please don’t add the spaces here.

Fixed.

> > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:3132
> > +        downcast<CSSRadialGradientValue>(result.get())->setFirstRadius(WTFMove(firstRadius));
> > +        downcast<CSSRadialGradientValue>(result.get())->setSecondRadius(WTFMove(secondRadius));
> 
> Can use (*result). here instead of (result.get())->

Fixed.

> > Source/WebCore/css/CSSGradientValue.h:143
> > +    static Ref<CSSLinearGradientValue> create(CSSGradientRepeat repeat, CSSGradientType gradientType, ColorInterpolationMethod colorInterpolationMethod, CSSGradientDefaultColorInterpolationMethod defaultColorInterpolationMethod, CSSGradientColorStopList stops)
> 
> Frustrating how long these argument names and types are.
> 
> 
> > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:3567
> > +    auto [computedColorInterpolationMethod, computedDefaultColorInterpolationMethod] = computeGradientColorInterpolationMethod(context, colorInterpolationMethod, *stops);
> 
> Reading this over and over again makes me wonder why we don’t pass these two
> around together as a struct.

Yeah, I agree. Fixed.
Comment 10 EWS 2022-01-15 22:23:49 PST
Committed r288071 (246091@main): <https://commits.webkit.org/246091@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 449280 [details].
Comment 11 Radar WebKit Bug Importer 2022-01-15 22:24:17 PST
<rdar://problem/87645870>