[webkit-changes] [WebKit/WebKit] 3b0dff: Update the shape function syntax

Simon Fraser noreply at github.com
Fri Oct 18 16:29:09 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3b0dff1a6be8105e2ceb0c5757d3f0e806af5798
      https://github.com/WebKit/WebKit/commit/3b0dff1a6be8105e2ceb0c5757d3f0e806af5798
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-10-18 (Fri, 18 Oct 2024)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-control-points.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-control-points.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-path-001-expected.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-path-001.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-001-expected.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-001.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-003.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-005-expected.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-005.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-006-expected.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-006.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-007.tentative-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-007.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-008.tentative-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-008.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-009.tentative-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-009.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-010.tentative-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-010.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/reference/clip-path-path-001-ref.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/reference/clip-path-shape-control-points-ref.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-shape-parsing-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-shape-parsing.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-008-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-008.html
    M Source/WebCore/css/BasicShapeConversion.cpp
    M Source/WebCore/css/BasicShapeConversion.h
    M Source/WebCore/css/BasicShapesShapeSegmentConversion.cpp
    M Source/WebCore/css/CSSBasicShapes.cpp
    M Source/WebCore/css/CSSBasicShapes.h
    M Source/WebCore/css/CSSShapeSegmentValue.cpp
    M Source/WebCore/css/CSSShapeSegmentValue.h
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/rendering/style/BasicShapes.cpp
    M Source/WebCore/rendering/style/BasicShapes.h
    M Source/WebCore/rendering/style/BasicShapesShape.cpp
    M Source/WebCore/rendering/style/BasicShapesShape.h

  Log Message:
  -----------
  Update the shape function syntax
https://bugs.webkit.org/show_bug.cgi?id=281674
rdar://138126105

Reviewed by Antti Koivisto.

This PR implements the following changes to the `shape()` syntax, proposed at [1]:
- Absolute coordinate values can now take `<position>` values.
- `from start`/`from end`/`from origin` are now supported on control points
- `using` is changed to `with`
- Multiple control points are separated with `/`

To support the start/end/origin-relative controls points, add `ControlPointAnchoring` and classes
for the CSSValue (`ControlPointValue`) and style (`ControlPoint`) data structures. BasicShapesShape
gains some logic to compute the control point positions based on the relevant point.

BasicShapeConversion.cpp now exports some `toLength` etc helpers to avoid code duplication.

The impact of start/end/origin-relative controls points on interpolation matches my proposal at [2].

[1] https://github.com/w3c/csswg-drafts/issues/10649#issuecomment-2412816773
[2] https://github.com/w3c/csswg-drafts/issues/10649#issuecomment-2418266716

* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-control-points.tentative-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-control-points.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-path-001-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-path-001.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-001-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-001.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-003.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-005-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-005.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-006-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-006.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-007.tentative-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-007.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-008.tentative-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-008.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-009.tentative-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-009.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-010.tentative-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-010.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/reference/clip-path-path-001-ref.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/reference/clip-path-shape-control-points-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-shape-parsing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-shape-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative.html:
* LayoutTests/imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-008-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-008.html:
* Source/WebCore/css/BasicShapeConversion.cpp:
(WebCore::convertToLengthOrAuto):
(WebCore::convertToLength):
(WebCore::convertToLengthSize):
(WebCore::coordinatePairToLengthPoint):
(WebCore::positionOrCoordinatePairToLengthPoint):
(WebCore::basicShapeShapeForValue):
(WebCore::convertToLengthPoint): Deleted.
* Source/WebCore/css/BasicShapeConversion.h:
* Source/WebCore/css/BasicShapesShapeSegmentConversion.cpp:
(WebCore::controlPointValue):
(WebCore::toCSSShapeSegmentValue):
* Source/WebCore/css/CSSBasicShapes.cpp:
(WebCore::CSSShapeValue::create):
(WebCore::CSSShapeValue::CSSShapeValue):
* Source/WebCore/css/CSSBasicShapes.h:
* Source/WebCore/css/CSSShapeSegmentValue.cpp:
(WebCore::controlPoint):
(WebCore::ControlPointValue::cssText const):
(WebCore::CSSShapeSegmentValue::createCubicCurve):
(WebCore::CSSShapeSegmentValue::createQuadraticCurve):
(WebCore::CSSShapeSegmentValue::createSmoothCubicCurve):
(WebCore::CSSShapeSegmentValue::customCSSText const):
(WebCore::CSSShapeSegmentValue::toShapeSegment const):
* Source/WebCore/css/CSSShapeSegmentValue.h:
(WebCore::ControlPointValue::operator== const):
(WebCore::CSSShapeSegmentValue::OnePointData::OnePointData):
(WebCore::CSSShapeSegmentValue::TwoPointData::TwoPointData):
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeShapeToCoordinates):
(WebCore::CSSPropertyParserHelpers::consumeShapeRelativeControlPoint):
(WebCore::CSSPropertyParserHelpers::consumeShapeCommand):
(WebCore::CSSPropertyParserHelpers::consumeBasicShapeShape):
(WebCore::CSSPropertyParserHelpers::consumeCoordinatePair): Deleted.
* Source/WebCore/rendering/style/BasicShapes.cpp:
(WebCore::operator<<):
* Source/WebCore/rendering/style/BasicShapes.h:
* Source/WebCore/rendering/style/BasicShapesShape.cpp:
(WebCore::BasicShapeShape::canBlend):
(WebCore::BasicShapeShape::blend):
(WebCore::operator<<):
* Source/WebCore/rendering/style/BasicShapesShape.h:

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



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


More information about the webkit-changes mailing list