Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3c1f378072db455b9d588cd5bc8cac5106d08e80
      
https://github.com/WebKit/WebKit/commit/3c1f378072db455b9d588cd5bc8cac5106d08e80
  Author: Chris Dumez <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant.html
    M Source/WebCore/platform/graphics/GeometryUtilities.cpp

  Log Message:
  -----------
  toRelatedAcuteAngle in GeometryUtilities.cpp doesn't handle an angle greater 
than 270 degrees
https://bugs.webkit.org/show_bug.cgi?id=298890
rdar://161114695

Reviewed by Darin Adler.

toRelatedAcuteAngle() is meant to return the acute angle from the vertical
axis, but it only handled angles up to 270 degrees:
```
      angle = toPositiveAngle(angle);
      if (angle < 90)
          return angle;
      return std::abs(180 - angle);
```
For an angle in the fourth quadrant it returned the obtuse supplement instead
of an acute angle (e.g. 300 -> 120, 315 -> 135, 350 -> 170). This fed wrong
values into intersectionSide() and lengthOfRayIntersectionWithBoundingBox(),
so an offset-path ray() with a 'sides' size and a fourth-quadrant angle picked
the wrong box side and produced an incorrect (sometimes negative) ray length,
placing the element in the wrong position.

Fold the angle into [0, 90] for every quadrant by reducing it modulo 180 and
taking the smaller of the angle and its supplement. This matches the previous
behavior for angles in [0, 270] and fixes the (270, 360) range.

Test: 
imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-ray-sides-fourth-quadrant.html:
 Added.
* Source/WebCore/platform/graphics/GeometryUtilities.cpp:
(WebCore::toRelatedAcuteAngle):
(WebCore::toPositiveAngle):

Canonical link: https://commits.webkit.org/318279@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to