Files
sousa-gecko/testing/web-platform/tests/css/css-shapes/parsing/shape-outside-shape-invalid.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.4 KiB
HTML

<!DOCTYPE html>
<title>CSS Shapes Module Level 2: parsing shape-outside with invalid shape() values</title>
<link rel="author" title="Jason Leo" href="mailto:cgqaq@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-shapes-2/#shape-function">
<link rel="help" href="https://www.w3.org/TR/css-shapes-1/#shape-outside-property">
<meta name="assert" content="Invalid shape() values should not be accepted for shape-outside.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script>
test_invalid_value("shape-outside", "shape(from 20px 40px line to 20px 30px)");
test_invalid_value("shape-outside", "shape(from 20px 40px line to 20px 30px,)");
test_invalid_value("shape-outside", "shape(from 20px, 40px, line to 20px, 30px)");
test_invalid_value("shape-outside", "shape(from 20px 40px, move to 20px 30px, hline to top)");
test_invalid_value("shape-outside", "shape(from 20px 40px, move to 20px 30px, vline to left)");
test_invalid_value("shape-outside", "shape(from 20px 40px, curve to 20px 20px, using 10px 30px)");
test_invalid_value("shape-outside", "shape(from 20px 40px, curve to 20px 20px with 10px 30px 12px 32px)");
test_invalid_value("shape-outside", "shape(from 20px 40px, arc by 20px 20px of 10% 20% small large)");
test_invalid_value("shape-outside", "shape(from 20px 40px, arc by 20px 20px of 10% 20% cw ccw)");
</script>