Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5f74dfcf4bf0c297dc900a99bb901ba6b8439228
      
https://github.com/WebKit/WebKit/commit/5f74dfcf4bf0c297dc900a99bb901ba6b8439228
  Author: Alan Baradlay <[email protected]>
  Date:   2026-05-04 (Mon, 04 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-outside/supported-shapes/ellipse/shape-outside-ellipse-053-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-outside/supported-shapes/ellipse/shape-outside-ellipse-053-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-outside/supported-shapes/ellipse/shape-outside-ellipse-053.html
 
    M Source/WebCore/rendering/shapes/LayoutShape.cpp
    M Source/WebCore/rendering/shapes/LayoutShape.h
    M Source/WebCore/rendering/shapes/PolygonLayoutShape.cpp
    M Source/WebCore/rendering/shapes/PolygonLayoutShape.h
    M Source/WebCore/rendering/shapes/RectangleLayoutShape.cpp
    M Source/WebCore/rendering/shapes/RectangleLayoutShape.h
    M Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

  Log Message:
  -----------
  shape-outside with margin-box is broken in RTL when margins are asymmetric
https://bugs.webkit.org/show_bug.cgi?id=313929

Reviewed by Antti Koivisto.

The shape-outside property computes a shape in the reference box's coordinate
space (e.g. margin-box), then converts to border-box coordinates using an 
offset,
and finally flips the x-axis for RTL using a stored width value.

The problem is that these two steps were inconsistent in RTL:

1. The offset (logicalLeftOffset) used the inline-start margin to convert from
   reference-box to border-box. In RTL, inline-start is the physical right side,
   so -marginStart gave -marginRight. But shape coordinates are physical
   (left-to-right) at this point, so the offset should use the physical left
   margin. For example, with margin-left: 0 and margin-right: -50px in RTL, the
   offset was 50 instead of 0, pushing shape coordinates 50px to the right.

2. The RTL flip (m_boxLogicalWidth - x) used the reference-box width (e.g.
   margin-box = 50px) to mirror coordinates. But after the offset, coordinates
   are in border-box space (100px wide). The flip produced values like
   50 - 75 = -25, which got clamped to 0, making the shape vanish entirely.

The fix:
- logicalLeftOffset now uses physical-left values (horizontal) or physical-top
  values (vertical) instead of inline-start values.
- The RTL flip width (renamed m_borderBoxLogicalWidth) now receives the
  border-box width instead of the reference-box width.

Both consumers (FloatingContext and computeDeltasForContainingBlockLine) expect
border-box-relative coordinates from getExcludedInterval, which these changes
now correctly produce.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-outside/supported-shapes/ellipse/shape-outside-ellipse-053-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-outside/supported-shapes/ellipse/shape-outside-ellipse-053-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-outside/supported-shapes/ellipse/shape-outside-ellipse-053.html
 : Added.
* Source/WebCore/rendering/shapes/LayoutShape.cpp:
(WebCore::createCircleShape):
(WebCore::createEllipseShape):
(WebCore::createPolygonShape):
(WebCore::LayoutShape::createShape):
* Source/WebCore/rendering/shapes/LayoutShape.h:
* Source/WebCore/rendering/shapes/PolygonLayoutShape.cpp:
(WebCore::PolygonLayoutShape::getExcludedInterval const):
* Source/WebCore/rendering/shapes/PolygonLayoutShape.h:
(WebCore::PolygonLayoutShape::PolygonLayoutShape):
* Source/WebCore/rendering/shapes/RectangleLayoutShape.cpp:
(WebCore::RectangleLayoutShape::getExcludedInterval const):
* Source/WebCore/rendering/shapes/RectangleLayoutShape.h:
* Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::logicalLeftOffset):
(WebCore::makeShapeForShapeOutside):

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



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

Reply via email to