Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bef74b7519fb97bcf4bc14a23641412ec593b926
      
https://github.com/WebKit/WebKit/commit/bef74b7519fb97bcf4bc14a23641412ec593b926
  Author: Simon Fraser <[email protected]>
  Date:   2025-03-22 (Sat, 22 Mar 2025)

  Changed paths:
    M Source/WebCore/svg/SVGTransformList.cpp
    M Source/WebCore/svg/SVGTransformList.h
    M Source/WebCore/svg/SVGTransformable.cpp
    M Source/WebCore/svg/SVGTransformable.h

  Log Message:
  -----------
  Make parsing SVG transform lists more efficient
https://bugs.webkit.org/show_bug.cgi?id=290192
rdar://147591008

Reviewed by Said Abou-Hallawa.

Content that animates SVG transforms will often keep the same list of transform 
operations, but just
change the values. Currently, `SVGTransformList::parse()` implements this by 
clearing the list and
re-build it, but this involves a lot of object churn: each SVGTransform is 
heap-allocated, and itself
has a heap-allocated SVGMatrix. In addition, `detach()` and `attach()` have 
overhead.

Make this more efficient by re-using the existing SVGTransforms when possible. 
Do this by moving the
list management into `SVGTransformList::parseGeneric()`. Callers of `parse()` 
expect the list to be preserved
between calls, so the `ListReplacement` argument controls that behavior. Pass 
the existing object to
`SVGTransformable::parseTransform` if the type matches; we compare that with 
the return value to know
if the item was re-used. If not, we go back to appending.

Well tested by existing SVG tests.

* Source/WebCore/svg/SVGTransformList.cpp:
(WebCore::SVGTransformList::parseGeneric):
(WebCore::SVGTransformList::parse):
* Source/WebCore/svg/SVGTransformList.h:
* Source/WebCore/svg/SVGTransformable.cpp:
(WebCore::parseTransformGeneric):
(WebCore::SVGTransformable::parseTransform):
(WebCore::parseTransformValueGeneric): Deleted.
(WebCore::SVGTransformable::parseTransformValue): Deleted.
* Source/WebCore/svg/SVGTransformable.h:

Canonical link: https://commits.webkit.org/292545@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