Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 464c1e3bad1c026c8afab9ddb63a4774f0655f43
https://github.com/WebKit/WebKit/commit/464c1e3bad1c026c8afab9ddb63a4774f0655f43
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M LayoutTests/inspector/model/gradient-expected.txt
M LayoutTests/inspector/model/gradient.html
M Source/WebInspectorUI/UserInterface/Models/Gradient.js
Log Message:
-----------
Web Inspector: gradient editor drops explicit 0% color stops and mis-parses
leading radial color stops
https://bugs.webkit.org/show_bug.cgi?id=319368
rdar://182172439
Reviewed by Devin Rousso.
WI.Gradient parsing had two related defects that caused gradient strings
to round-trip incorrectly through the gradient editor:
1. stopsWithComponents() used `if (!stop.offset)` to detect a missing
offset, which also matched a legitimate parsed offset of 0. Any
explicit `0%` stop that was not first was silently discarded and
recomputed as an evenly-spaced offset.
2. RadialGradient.fromComponents() detected the optional sizing prefix by
testing `WI.Color.fromString(components[0].join(" "))`. When the first
color stop carried an offset (e.g. `red 50%`), the joined string was
not a valid color, so the first stop was wrongly consumed as sizing.
Only default the offset when it is missing (using `??=`), and detect
radial sizing from only the first token (sizing keywords such as
`circle`, `ellipse`, and `at` are never colors).
* LayoutTests/inspector/model/gradient-expected.txt:
* LayoutTests/inspector/model/gradient.html: Added linear, radial, and
conic round-trip cases covering an explicit 0% stop.
* Source/WebInspectorUI/UserInterface/Models/Gradient.js:
(WI.Gradient.stopsWithComponents):
(WI.RadialGradient.fromComponents):
Canonical link: https://commits.webkit.org/317192@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications