Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9c6d47b82456c12d8c6a7bc9473f0f6e2de29b42
      
https://github.com/WebKit/WebKit/commit/9c6d47b82456c12d8c6a7bc9473f0f6e2de29b42
  Author: Antoine Quint <grao...@webkit.org>
  Date:   2024-07-03 (Wed, 03 Jul 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/SVGElement.h
    M Source/WebCore/svg/SVGFontFaceElement.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
rdar://126393877

Reviewed by Said Abou-Hallawa.

(This is the same patch as 277451@main which was reverted due to a Speedometer 
3 performance regression.
A flag has since been introduced to conditionally enable the `d` CSS property 
and this patch re-introduces
277451@main but gates the functionality behind that flag, which is still 
disabled by default. Fixing
the performance regression and enabling the flag is tracked by bug 276172.)

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):
(WebCore::SVGElement::hasPresentationalHintsForAttribute const):
(WebCore::SVGElement::collectPresentationalHintsForAttribute):
(WebCore::SVGElement::svgAttributeChanged):
* Source/WebCore/svg/SVGElement.h:
* Source/WebCore/svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::attributeChanged):
* 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/280621@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