Skip to content

Commit 2c35297

Browse files
committed
update gradient lowering transform
At the time it was written, esbuild's gradient lowering transform matched how WebKit-based browsers rendered CSS gradients. However, they have since decided to change how a specific edge case renders. This updates esbuild to match the new behavior. References: - https://bugs.webkit.org/show_bug.cgi?id=285382 - https://bugzilla.mozilla.org/show_bug.cgi?id=1939948 - https://issues.chromium.org/issues/387475844 - WebKit/WebKit#46303
1 parent 9209e44 commit 2c35297

1 file changed

Lines changed: 0 additions & 19 deletions

File tree

internal/css_parser/css_decls_gradient.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -707,25 +707,6 @@ func tryToExpandGradient(
707707
stop.v0, stop.v1, stop.v2 = premultiply(v0, v1, v2, stop.alpha, colorSpace)
708708
}
709709

710-
// Duplicate the endpoints if they should wrap around to themselves
711-
if hueMethod == longerHue && colorSpace.isPolar() && len(colorStops) > 0 {
712-
if first := colorStops[0]; len(first.positionTerms) == 1 {
713-
if first.positionTerms[0].value.Value() < 0 {
714-
colorStops[0].positionTerms[0].value = helpers.NewF64(0)
715-
} else if first.positionTerms[0].value.Value() > 0 {
716-
first.midpoint = nil
717-
first.positionTerms = []valueWithUnit{{value: helpers.NewF64(0), unit: first.positionTerms[0].unit}}
718-
colorStops = append([]parsedColorStop{first}, colorStops...)
719-
}
720-
}
721-
if last := colorStops[len(colorStops)-1]; len(last.positionTerms) == 1 {
722-
if last.positionTerms[0].unit != "%" || last.positionTerms[0].value.Value() < 100 {
723-
last.positionTerms = []valueWithUnit{{value: helpers.NewF64(100), unit: "%"}}
724-
colorStops = append(colorStops, last)
725-
}
726-
}
727-
}
728-
729710
var newColorStops []colorStop
730711
var generateColorStops func(
731712
int, parsedColorStop, parsedColorStop,

0 commit comments

Comments
 (0)