Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5187e475ef752de5bc38ae9570c26e03b2edbe14
      
https://github.com/WebKit/WebKit/commit/5187e475ef752de5bc38ae9570c26e03b2edbe14
  Author: Antoine Quint <[email protected]>
  Date:   2024-04-12 (Fri, 12 Apr 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/path/property/getComputedStyle-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/path/property/test_style_flush_on_dom_api_with_d_property-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/styling/presentation-attributes-relevant-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/styling/presentation-attributes-special-cases-expected.txt
    M Source/WebCore/dom/StyledElement.cpp
    M Source/WebCore/dom/StyledElement.h
    M Source/WebCore/rendering/style/BasicShapes.h
    M Source/WebCore/rendering/style/SVGRenderStyle.cpp
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/svg/SVGElement.cpp
    M Source/WebCore/svg/SVGPathElement.cpp
    M Source/WebCore/svg/SVGPathElement.h

  Log Message:
  -----------
  [svg] make `d` a presentation attribute
https://bugs.webkit.org/show_bug.cgi?id=272509

Reviewed by Said Abou-Hallawa.

We now make the `d` SVG attribute map to the `d` CSS property as part of the 
presentation
attribute system by adding the required mapping under 
`SVGElement::cssPropertyIdForSVGAttributeName()`
and accounting for the path data set on the `SVGRenderStyle` in 
`pathFromPathElement()`.

We must also call `setPresentationalHintStyleIsDirty()` under 
`SVGPathElement::svgAttributeChanged()`,
matching the behavior of other SVG elements with presentation attributes.

The SVG presentation attribute system forwards the string value set on the SVG 
attribute to the
`MutableStyleProperties` object collecting the various matching CSS properties. 
But in the case
of the `d` property, path data can be large and unwieldy, so we override 
`collectPresentationalHintsForAttribute()`
on `SVGPathElement` and create a `CSSPathValue` with a copy of the (potentially 
animated)
`SVGPathByteStream` and call into a new variant of 
`StyledElement::addPropertyToPresentationalHintStyle()`
that takes in a `RefPtr<CSSValue>&&`.

Finally, adding support for `d` as a presentation attribute revealed a mistake 
in 277297@main
where we accounted for the CSS `zoom` value when converting the `CSSPathValue`, 
but the `zoom`
property has no bearing in SVG. This broke the following tests:

    * svg/zoom/page/zoom-coords-viewattr-01-b.svg
    * svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html
    * svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm

So we modified `BuilderConverter::convertSVGPath()` accordingly.

* LayoutTests/TestExpectations:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/path/property/getComputedStyle-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/path/property/test_style_flush_on_dom_api_with_d_property-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/styling/presentation-attributes-relevant-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/styling/presentation-attributes-special-cases-expected.txt:
* Source/WebCore/dom/StyledElement.cpp:
(WebCore::StyledElement::addPropertyToPresentationalHintStyle):
* Source/WebCore/dom/StyledElement.h:
* Source/WebCore/rendering/style/BasicShapes.h:
* Source/WebCore/rendering/style/SVGRenderStyle.cpp:
(WebCore::SVGRenderStyle::conservativelyCollectChangedAnimatableProperties 
const):
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertSVGPath):
* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::cssPropertyIdForSVGAttributeName):
* Source/WebCore/svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::svgAttributeChanged):
(WebCore::SVGPathElement::path const):
(WebCore::SVGPathElement::collectPresentationalHintsForAttribute):
* Source/WebCore/svg/SVGPathElement.h:

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



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

Reply via email to