Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2911575fae37f3a740a934d2c2f874b94dd61c3
      
https://github.com/WebKit/WebKit/commit/d2911575fae37f3a740a934d2c2f874b94dd61c3
  Author: Simon Fraser <simon.fra...@apple.com>
  Date:   2024-08-03 (Sat, 03 Aug 2024)

  Changed paths:
    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/parsing/clip-path-shape-parsing-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative-expected.txt
    A 
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 Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/BasicShapeConversion.cpp
    M Source/WebCore/css/BasicShapeConversion.h
    A Source/WebCore/css/BasicShapesShapeSegmentConversion.cpp
    A Source/WebCore/css/BasicShapesShapeSegmentConversion.h
    M Source/WebCore/css/CSSBasicShapes.cpp
    M Source/WebCore/css/CSSShapeSegmentValue.cpp
    M Source/WebCore/css/CSSShapeSegmentValue.h
    M Source/WebCore/css/CSSToStyleMap.cpp
    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
    A Source/WebCore/rendering/style/BasicShapesShape.cpp
    A Source/WebCore/rendering/style/BasicShapesShape.h
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/style/StyleBuilderState.h

  Log Message:
  -----------
  [CSS Shape function] Add parsing support and storage for shape()
https://bugs.webkit.org/show_bug.cgi?id=277347
rdar://132814728

Reviewed by Tim Nguyen.

Implement parsing, property value and computed style support for the `shape()` 
function[1]. We support the syntax
as of the most recent edit[2] but without the flexible order of points and 
control points due to [3].

Added BasicShapesShapeSegmentConversion.h/cpp with helpers to convert between 
CSS values and the internal shapes.
CSSShapeValue::customCSSText() is implemented.

BasicShapeShape stores its segments as a vector of std::variant<>, much as we 
do for Paths, which avoids heap allocations
per segment.

Plumb Style::BuilderState deeper into BasicShapeConversion functions. This 
required passing an optional zoom override,
used in some SVG cases (exercised by layout tests).

Tentative WPT are included.

Based on code by Noam Rosenthal.

[1] https://drafts.csswg.org/css-shapes-2/#shape-function
[2] https://github.com/w3c/csswg-drafts/commit/9770805c4e53
[3] https://github.com/w3c/csswg-drafts/issues/10666

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/animations/clip-path-interpolation-shape-expected.txt:
 Interpolation is not yet supported.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-shape-parsing-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-computed.tentative.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-invalid.tentative.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/shape-functions/shape-function-valid.tentative.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-008-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/BasicShapeConversion.cpp:
(WebCore::valueForBasicShape):
(WebCore::convertToLengthPoint):
(WebCore::basicShapeForValue):
(WebCore::basicShapePathForValue):
(WebCore::basicShapeShapeForValue):
* Source/WebCore/css/BasicShapeConversion.h:
* Source/WebCore/css/BasicShapesShapeSegmentConversion.cpp: Added.
(WebCore::lengthToCSSValue):
(WebCore::lengthPointToCSSValue):
(WebCore::lengthSizeToCSSValue):
(WebCore::toCSSShapeSegmentValue):
(WebCore::fromCSSShapeSegmentValue):
* Source/WebCore/css/BasicShapesShapeSegmentConversion.h: Copied from 
Source/WebCore/css/BasicShapeConversion.h.
* Source/WebCore/css/CSSBasicShapes.cpp:
(WebCore::CSSShapeValue::CSSShapeValue):
(WebCore::CSSShapeValue::customCSSText const):
(WebCore::CSSShapeValue::equals const):
* Source/WebCore/css/CSSShapeSegmentValue.cpp:
(WebCore::CSSShapeSegmentValue::customCSSText const):
(WebCore::CSSShapeSegmentValue::toShapeSegment const):
* Source/WebCore/css/CSSShapeSegmentValue.h:
* Source/WebCore/css/CSSToStyleMap.cpp:
(WebCore::convertToLengthSize):
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeBasicShapePolygon):
(WebCore::CSSPropertyParserHelpers::consumeBasicShapePath):
(WebCore::CSSPropertyParserHelpers::consumeCoordinatePair):
(WebCore::CSSPropertyParserHelpers::consumeShapeCommand):
(WebCore::CSSPropertyParserHelpers::consumeBasicShapeShape):
(WebCore::CSSPropertyParserHelpers::consumeBasicShape):
* Source/WebCore/rendering/style/BasicShapes.cpp:
(WebCore::operator<<):
* Source/WebCore/rendering/style/BasicShapes.h:
* Source/WebCore/rendering/style/BasicShapesShape.cpp: Added.
(WebCore::BasicShapeShape::create):
(WebCore::BasicShapeShape::BasicShapeShape):
(WebCore::BasicShapeShape::clone const):
(WebCore::BasicShapeShape::path const):
(WebCore::BasicShapeShape::canBlend const):
(WebCore::BasicShapeShape::blend const):
(WebCore::BasicShapeShape::operator== const):
(WebCore::BasicShapeShape::dump const):
(WebCore::operator<<):
* Source/WebCore/rendering/style/BasicShapesShape.h: Added.
(WebCore::ShapeSegmentBase::ShapeSegmentBase):
(WebCore::ShapeSegmentBase::affinity const):
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertSVGPath):
(WebCore::Style::BuilderConverter::convertPathOperation):
(WebCore::Style::BuilderConverter::convertShapeValue):
* Source/WebCore/style/StyleBuilderState.h:
(WebCore::Style::BuilderState::style const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to