Files
sousa-gecko/testing/web-platform/tests/css/css-shapes/parsing/shape-outside-path-valid.html
T
Jason Leo f69f9a00dc Bug 2032337 [wpt PR 59240] - Support path() and shape() for shape-outside, a=testonly
Automatic update from web-platform-tests
Support path() and shape() for shape-outside

Extend the shape-outside property to accept path() and shape() basic
shape functions, and introduce a new CSSShapeOutsidePathAndShapeSupport
feature flag gates path() and shape().

Two key changes were made:

1. Handle the additional <basic-shape> values in
   StyleBuilderConverter::ConvertShapeValue(). Without this, the
   code fell into the else branch and crashed on
   To<CSSIdentifierValue>().

2. Shape::CreateShape() had no case for kStylePathType or
   kStyleShapeType. Both types provide a GetPath() virtual method,
   so they are rasterized into a RasterShape using the same approach
   as rounded polygons.

WPT tests are added for parsing (valid and invalid values) and layout
(float text wrapping) for all four shape functions.

ChromeStatus: https://chromestatus.com/feature/5080980370096128
Bug: 490343454, 490316313, 502328208
Change-Id: I4a838f6389e771d2e695e1b97ab238487cd809a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7762682
Commit-Queue: Jason Leo <cgqaq@chromium.org>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/main@{#1615362}

--

wpt-commits: 8b902687a14a83ad5a40c041d5786cd7bd215408
wpt-pr: 59240
2026-04-23 10:14:26 +00:00

21 lines
1.6 KiB
HTML

<!DOCTYPE html>
<title>CSS Shapes Module Level 1: parsing shape-outside with valid path() values</title>
<link rel="author" title="Jason Leo" href="mailto:cgqaq@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-shapes-1/#funcdef-basic-shape-path">
<link rel="help" href="https://www.w3.org/TR/css-shapes-1/#shape-outside-property">
<meta name="assert" content="shape-outside supports the path() basic shape.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script>
test_valid_value("shape-outside", "path('M 10 10 h 80 v 80 h -80 Z')", 'path("M 10 10 h 80 v 80 h -80 Z")');
test_valid_value("shape-outside", "path('M10,10h80v80h-80z')", 'path("M 10 10 h 80 v 80 h -80 Z")');
test_valid_value("shape-outside", "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50z')", 'path(evenodd, "M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50 Z")');
test_valid_value("shape-outside", "path(nonzero, 'M10,10h80v80h-80z')", 'path("M 10 10 h 80 v 80 h -80 Z")');
test_valid_value("shape-outside", "path('M0,0L100,0L100,100Z')", 'path("M 0 0 L 100 0 L 100 100 Z")');
test_valid_value("shape-outside", "path('M0,0C30,60,70,60,100,0')", 'path("M 0 0 C 30 60 70 60 100 0")');
test_valid_value("shape-outside", "path('M0,0Q50,100,100,0')", 'path("M 0 0 Q 50 100 100 0")');
test_valid_value("shape-outside", "path('M0,0A25,25,0,0,1,50,0')", 'path("M 0 0 A 25 25 0 0 1 50 0")');
test_valid_value("shape-outside", "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50')", 'path(evenodd, "M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50")');
</script>