Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2018 22:22:45 +0000 (22:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2018 22:22:45 +0000 (22:22 +0000)
commit0d34738bf659acc36fd450e56aaef2949e75b023
tree7536a8e559ea0461651a20f6eecf4206943376d1
parent7b517d013abcd08760fe99dc1cd6fd368fbd904e
Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list
https://bugs.webkit.org/show_bug.cgi?id=183723
<rdar://problem/38517871>

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-03-21
Reviewed by Daniel Bates.

Source/WebCore:

When setting the "d" attribute directly on a path, we rebuild the list
of path segments held for creating the property tear off. The old path
segments need to get disconnected from the path element. We already do
that when a path segment is replaced or removed.

Test: svg/dom/reuse-pathseg-after-changing-d.html

* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::svgAttributeChanged):
* svg/SVGPathSegList.cpp:
(WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles()
will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues().
(WebCore::SVGPathSegList::replaceItem):
(WebCore::SVGPathSegList::removeItem):
(WebCore::SVGPathSegList::clearContextAndRoles): Deleted.
* svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will
now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues().
* svg/SVGPathSegListValues.cpp:
(WebCore::SVGPathSegListValues::clearItemContextAndRole):
(WebCore::SVGPathSegListValues::clearContextAndRoles):
* svg/SVGPathSegListValues.h:
(WebCore::SVGPathSegListValues::operator=):
(WebCore::SVGPathSegListValues::clear):

LayoutTests:

* svg/dom/reuse-pathseg-after-changing-d-expected.txt: Added.
* svg/dom/reuse-pathseg-after-changing-d.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/svg/dom/reuse-pathseg-after-changing-d-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/reuse-pathseg-after-changing-d.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathSegList.cpp
Source/WebCore/svg/SVGPathSegList.h
Source/WebCore/svg/SVGPathSegListValues.cpp
Source/WebCore/svg/SVGPathSegListValues.h