Hi Team, While going through Blink's commit, I came across following potential assertion fix: Blink Commit - https://chromium.googlesource.com/chromium/blink/+/651895c0233495405847471d42dab20deab2a0f3 WebKit Source - https://github.com/WebKit/WebKit/blob/28de25b653f64ca3fc8e87fbf1d1a963329a5342/Source/WebCore/html/canvas/CanvasPath.cpp#L143 Unfortunately, it does not have any test case to confirm whether it is an issue in Safari / WebKit or not but just wanted to get an input. Thanks!
<rdar://problem/104332195>
This compiles: tatic void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise) { float newStartAngle = fmodf(startAngle, (2 * piFloat)); if (newStartAngle < 0) newStartAngle += (2 * piFloat);
If we add this: constexpr auto twoPiFloat = 2 * piFloat; we can simplify whole function: static void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise) { constexpr auto twoPiFloat = 2 * piFloat; float newStartAngle = fmodf(startAngle, twoPiFloat); if (newStartAngle < 0) newStartAngle += twoPiFloat; float delta = newStartAngle - startAngle; startAngle = newStartAngle; endAngle = endAngle + delta; ASSERT(newStartAngle >= 0 && (newStartAngle < twoPiFloat || WTF::areEssentiallyEqual<float>(newStartAngle, twoPiFloat))); if (anticlockwise && startAngle - endAngle >= twoPiFloat) endAngle = startAngle - twoPiFloat; else if (!anticlockwise && endAngle - startAngle >= twoPiFloat) endAngle = startAngle + twoPiFloat; }
PR attempt - https://github.com/WebKit/WebKit/pull/19657
Committed 269925@main (34e0f2e73041): <https://commits.webkit.org/269925@main> Reviewed commits have been landed. Closing PR #19657 and removing active labels.