⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243336 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 3:21:58 PM (7 years ago)
Author:
Said Abou-Hallawa
Message:

Remove the SVG tear off objects for SVGPoint, SVGPointList and SVGAnimatedPointList
https://bugs.webkit.org/show_bug.cgi?id=195905

Source/WebCore:

Patch by Said Abou-Hallawa <Said Abou-Hallawa> on 2019-03-21
Reviewed by Simon Fraser.

To remove the SVG tear off objects for SVGPoint, SVGPointList and
SVGAnimatedPointList, these changes are needed:

-- Define SVGPoint to be a superclass of SVGValueProperty<FloatPoint>.

-- Define SVGAnimatedPointList to be a superclass of SVGAnimatedPropertyList<SVGPointList>

-- Add SVGPropertyList which is a superclass of SVGList. Its items are

defined to RefCounted. It is the base class of SVGValuePropertyList
and it will be the base class of SVGPathSegList in a later patch.

-- Add SVGValuePropertyList which is the base class of all the lists whose

items are backed by a value objects like SVGPoint. The difference between
SVGPropertyList and SVGValuePropertyList is the former class can store
a Ref pointer of the base class like SVGPathSeg while the later type
has to store the same type for all the items.

-- Add SVGAnimatedPropertyList which is the base class for all the animated

lists. Note that:
1) SVGElement owns SVGAnimatedPropertyList
2) SVGAnimatedPropertyList owns m_baseVal whose type is SVGList
3) m_baseVal owns the items whose type is a superclass of SVGProperty.
When changing an item, it calls its owner which is an SVGList.
SVGList calls its owner which is SVGAnimatedPropertyList.
SVGAnimatedPropertyList calls its owner which SVGElement to commit
the change. Later SVGAnimatedPropertyList::synchronize() is called
which returns the property valueAsString() to update the reflecting
attribute.

-- New accessor, animator and animation function are added to access

and animate a member of type SVGAnimatedPropertyList.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • rendering/svg/SVGPathData.cpp:

(WebCore::pathFromCircleElement):
(WebCore::pathFromEllipseElement):
(WebCore::pathFromLineElement):
(WebCore::pathFromPathElement):
(WebCore::pathFromPolygonElement):
(WebCore::pathFromPolylineElement):
(WebCore::pathFromRectElement):
(WebCore::pathFromGraphicsElement):

  • rendering/svg/SVGPathData.h:

The IDL of SVGPolyElement interface requires the following attribute:

readonly attribute SVGPointList points;

For which we return:

SVGPointList& points() { return m_points->baseVal(); }

But for all the other properties we return the currentValue(). So to have
the two functions with the same name, the following function is added:

const SVGPointList& points() const { return m_points->currentValue(); }

This definition requires changing all callers to be const.

  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::operator<<):

  • svg/SVGAnimatedPointList.cpp: Removed.
  • svg/SVGAnimatedPointList.h: Removed.
  • svg/SVGAnimatedType.h:

(WebCore::SVGAnimatedType::type const):
This function had a bad design. It was designed to use the index of the
variant as the AnimatedPropertyType. But when some of the types are removed
from SVGValueVariant, this broke things. This fix is temporary till the
class SVGValueVariant is removed.

  • svg/SVGAnimatorFactory.h:

(WebCore::SVGAnimatorFactory::create):

  • svg/SVGExternalResourcesRequired.cpp:
  • svg/SVGParserUtilities.cpp:

(WebCore::pointsListFromSVGData): Deleted.

  • svg/SVGParserUtilities.h:
  • svg/SVGPoint.h:

(WebCore::SVGPoint::create):
(WebCore::SVGPoint::clone const):
(WebCore::SVGPoint::x):
(WebCore::SVGPoint::setX):
(WebCore::SVGPoint::y):
(WebCore::SVGPoint::setY):
(WebCore::SVGPoint::matrixTransform const):
(WebCore::SVGPoint::matrixTransform): Deleted.
(WebCore::SVGPoint::SVGPoint): Deleted.

  • svg/SVGPoint.idl:

matrixTransform() should not throw an exception.

  • svg/SVGPointList.h:

(WebCore::SVGPointList::create):
(WebCore::SVGPointList::parse):
(WebCore::SVGPointList::SVGPointList): Deleted.
Move the parse() and valueAsString() methods to SVGPointList. It is now
a superclass of SVGValuePropertyList. Its items are of type Ref<SVGPoint>.

  • svg/SVGPointListValues.cpp: Removed.
  • svg/SVGPointListValues.h: Removed.
  • svg/SVGPolyElement.cpp:

(WebCore::SVGPolyElement::SVGPolyElement):
(WebCore::SVGPolyElement::parseAttribute):
(WebCore::SVGPolyElement::approximateMemoryCost const):
(WebCore::SVGPolyElement::registerAttributes): Deleted.
(WebCore::SVGPolyElement::points): Deleted.
(WebCore::SVGPolyElement::animatedPoints): Deleted.

  • svg/SVGPolyElement.h:

(WebCore::SVGPolyElement::points const):
(WebCore::SVGPolyElement::points):
(WebCore::SVGPolyElement::animatedPoints):
(WebCore::SVGPolyElement::pointList const): Deleted.
(WebCore::SVGPolyElement::attributeRegistry): Deleted.

  • svg/SVGSVGElement.cpp:

(WebCore::SVGSVGElement::setCurrentTranslate):
(WebCore::SVGSVGElement::currentTranslate): Deleted.

  • svg/SVGSVGElement.h:
  • svg/SVGSVGElement.idl:

Define currentTranslate property to be of type Ref<SVGPoint>. When requesting
it just return a reference to it.

  • svg/SVGValue.h:
  • svg/properties/SVGAnimatedPropertyAccessorImpl.h:
  • svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
  • svg/properties/SVGAnimatedPropertyImpl.h:
  • svg/properties/SVGAnimatedPropertyList.h: Added.

Define the accessor, the animator and the animated type of SVGPointList.

(WebCore::SVGAnimatedPropertyList::create):
(WebCore::SVGAnimatedPropertyList::~SVGAnimatedPropertyList):
(WebCore::SVGAnimatedPropertyList::baseVal const):
(WebCore::SVGAnimatedPropertyList::baseVal):
(WebCore::SVGAnimatedPropertyList::animVal const):
(WebCore::SVGAnimatedPropertyList::animVal):
(WebCore::SVGAnimatedPropertyList::currentValue const):
(WebCore::SVGAnimatedPropertyList::SVGAnimatedPropertyList):
(WebCore::SVGAnimatedPropertyList::ensureAnimVal):

  • svg/properties/SVGAnimationAdditiveListFunction.h: Added.

(WebCore::SVGAnimationAdditiveListFunction::SVGAnimationAdditiveListFunction):
(WebCore::SVGAnimationAdditiveListFunction::toAtEndOfDuration const):
(WebCore::SVGAnimationAdditiveListFunction::adjustAnimatedList):

  • svg/properties/SVGAnimationAdditiveListFunctionImpl.h: Added.

(WebCore::SVGAnimationPointListFunction::progress):
Define the animation function for animating SVGPointList.

  • svg/properties/SVGAttributeRegistry.h:
  • svg/properties/SVGPropertyList.h: Added.

(WebCore::SVGPropertyList::SVGPropertyList):
(WebCore::SVGPropertyList::~SVGPropertyList):

  • svg/properties/SVGPropertyOwnerRegistry.h:

(WebCore::SVGPropertyOwnerRegistry::registerProperty):

  • svg/properties/SVGValuePropertyList.h: Added.

(WebCore::SVGValuePropertyList::operator=):
(WebCore::SVGValuePropertyList::operator Vector<typename PropertyType::ValueType> const):
(WebCore::SVGValuePropertyList::resize):
(WebCore::SVGValuePropertyList::SVGValuePropertyList):

LayoutTests:

Reviewed by Simon Fraser.

  • svg/dom/SVGPointList-basics-expected.txt:
  • svg/dom/SVGPointList-basics.xhtml:

This change is required because SVGPointList will be following the SVG2
specs regarding adding new items to the list.

See https://www.w3.org/TR/SVG/types.html#TermListInterface.

Location:
trunk
Files:
5 added
4 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243331 r243336  
     12019-03-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Remove the SVG tear off objects for SVGPoint, SVGPointList and SVGAnimatedPointList
     4        https://bugs.webkit.org/show_bug.cgi?id=195905
     5
     6        Reviewed by Simon Fraser.
     7
     8        * svg/dom/SVGPointList-basics-expected.txt:
     9        * svg/dom/SVGPointList-basics.xhtml:
     10        This change is required because SVGPointList will be following the SVG2
     11        specs regarding adding new items to the list.
     12
     13        See https://www.w3.org/TR/SVG/types.html#TermListInterface.
     14
    1152019-03-21  Zalan Bujtas  <zalan@apple.com>
    216
  • trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt

    r219663 r243336  
    4646PASS poly1.points.insertItemBefore(null) threw exception TypeError: Not enough arguments.
    4747PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 'aString')) is "x=100 y=0"
     48PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=100 y=0"
    4849PASS poly1.points.numberOfItems is 4
    4950PASS dumpPoint(poly1.points.getItem(0)) is "x=100 y=0"
     
    5354PASS poly1.getAttribute('points').formatPointsAttribute() is "100 0 0 0 100 100 0 100"
    5455PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), poly1)) is "x=0 y=0"
     56PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=0 y=0"
    5557PASS poly1.points.numberOfItems is 4
    5658PASS dumpPoint(poly1.points.getItem(0)) is "x=0 y=0"
     
    6062PASS poly1.getAttribute('points').formatPointsAttribute() is "0 0 100 0 100 100 0 100"
    6163PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), null)) is "x=100 y=0"
     64PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=100 y=0"
    6265PASS poly1.points.numberOfItems is 4
    6366PASS dumpPoint(poly1.points.getItem(0)) is "x=100 y=0"
     
    6669PASS poly1.getAttribute('points').formatPointsAttribute() is "100 0 0 0 100 100 0 100"
    6770PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 0)) is "x=0 y=0"
     71PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=0 y=0"
    6872PASS poly1.points.numberOfItems is 4
    6973PASS dumpPoint(poly1.points.getItem(0)) is "x=0 y=0"
  • trunk/LayoutTests/svg/dom/SVGPointList-basics.xhtml

    r155284 r243336  
    7878
    7979    shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 'aString'))", "x=100 y=0");
     80    shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=100 y=0");
    8081    shouldBe("poly1.points.numberOfItems", "4");
    8182    shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0");
     
    8485    shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100");
    8586    shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()", "100 0 0 0 100 100 0 100");
    86    
     87
    8788    shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), poly1))", "x=0 y=0");
     89    shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=0 y=0");
    8890    shouldBe("poly1.points.numberOfItems", "4");
    8991    shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
     
    9496
    9597    shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), null))", "x=100 y=0");
     98    shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=100 y=0");
    9699    shouldBe("poly1.points.numberOfItems", "4");
    97100    shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0");
     
    99102    shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100");
    100103    shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()", "100 0 0 0 100 100 0 100");
    101    
     104
    102105    shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 0))", "x=0 y=0");
     106    shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=0 y=0");
    103107    shouldBe("poly1.points.numberOfItems", "4");
    104108    shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
  • trunk/Source/WebCore/ChangeLog

    r243333 r243336  
     12019-03-21  Said Abou-Hallawa  <said@apple.com>
     2
     3        Remove the SVG tear off objects for SVGPoint, SVGPointList and SVGAnimatedPointList
     4        https://bugs.webkit.org/show_bug.cgi?id=195905
     5
     6        Reviewed by Simon Fraser.
     7
     8        To remove the SVG tear off objects for SVGPoint, SVGPointList and
     9        SVGAnimatedPointList, these changes are needed:
     10
     11        -- Define SVGPoint to be a superclass of SVGValueProperty<FloatPoint>.
     12
     13        -- Define SVGAnimatedPointList to be a superclass of SVGAnimatedPropertyList<SVGPointList>
     14
     15        -- Add SVGPropertyList which is a superclass of SVGList. Its items are
     16           defined to RefCounted. It is the base class of SVGValuePropertyList
     17           and it will be  the base class of SVGPathSegList in a later patch.
     18
     19        -- Add SVGValuePropertyList which is the base class of all the lists whose
     20           items are backed by a value objects like SVGPoint. The difference between
     21           SVGPropertyList and SVGValuePropertyList is the former class can store
     22           a Ref pointer of the base class like SVGPathSeg while the later type
     23           has to store the same type for all the items.
     24
     25        -- Add SVGAnimatedPropertyList which is the base class for all the animated
     26           lists. Note that:
     27           1) SVGElement owns SVGAnimatedPropertyList
     28           2) SVGAnimatedPropertyList owns m_baseVal whose type is SVGList
     29           3) m_baseVal owns the items whose type is a superclass of SVGProperty.
     30           When changing an item, it calls its owner which is an SVGList.
     31           SVGList calls its owner which is SVGAnimatedPropertyList.
     32           SVGAnimatedPropertyList calls its owner which SVGElement to commit
     33           the change. Later SVGAnimatedPropertyList::synchronize() is called
     34           which returns the property valueAsString() to update the reflecting
     35           attribute.
     36
     37        -- New accessor, animator and animation function are added to access
     38           and animate a member of type SVGAnimatedPropertyList.
     39
     40        * Sources.txt:
     41        * WebCore.xcodeproj/project.pbxproj:
     42        * rendering/svg/SVGPathData.cpp:
     43        (WebCore::pathFromCircleElement):
     44        (WebCore::pathFromEllipseElement):
     45        (WebCore::pathFromLineElement):
     46        (WebCore::pathFromPathElement):
     47        (WebCore::pathFromPolygonElement):
     48        (WebCore::pathFromPolylineElement):
     49        (WebCore::pathFromRectElement):
     50        (WebCore::pathFromGraphicsElement):
     51        * rendering/svg/SVGPathData.h:
     52        The IDL of SVGPolyElement interface requires the following attribute:
     53            readonly attribute SVGPointList points;
     54        For which we return:
     55            SVGPointList& points() { return m_points->baseVal(); }
     56        But for all the other properties we return the currentValue(). So to have
     57        the two functions with the same name, the following function is added:
     58            const SVGPointList& points() const { return m_points->currentValue(); }
     59        This definition requires changing all callers to be const.
     60
     61        * rendering/svg/SVGRenderTreeAsText.cpp:
     62        (WebCore::operator<<):
     63        * svg/SVGAnimatedPointList.cpp: Removed.
     64        * svg/SVGAnimatedPointList.h: Removed.
     65        * svg/SVGAnimatedType.h:
     66        (WebCore::SVGAnimatedType::type const):
     67        This function had a bad design. It was designed to use the index of the
     68        variant as the AnimatedPropertyType. But when some of the types are removed
     69        from SVGValueVariant, this broke things. This fix is temporary till the
     70        class SVGValueVariant is removed.
     71
     72        * svg/SVGAnimatorFactory.h:
     73        (WebCore::SVGAnimatorFactory::create):
     74        * svg/SVGExternalResourcesRequired.cpp:
     75        * svg/SVGParserUtilities.cpp:
     76        (WebCore::pointsListFromSVGData): Deleted.
     77        * svg/SVGParserUtilities.h:
     78        * svg/SVGPoint.h:
     79        (WebCore::SVGPoint::create):
     80        (WebCore::SVGPoint::clone const):
     81        (WebCore::SVGPoint::x):
     82        (WebCore::SVGPoint::setX):
     83        (WebCore::SVGPoint::y):
     84        (WebCore::SVGPoint::setY):
     85        (WebCore::SVGPoint::matrixTransform const):
     86        (WebCore::SVGPoint::matrixTransform): Deleted.
     87        (WebCore::SVGPoint::SVGPoint): Deleted.
     88        * svg/SVGPoint.idl:
     89        matrixTransform() should not throw an exception.
     90
     91        * svg/SVGPointList.h:
     92        (WebCore::SVGPointList::create):
     93        (WebCore::SVGPointList::parse):
     94        (WebCore::SVGPointList::SVGPointList): Deleted.
     95        Move the parse() and valueAsString() methods to SVGPointList. It is now
     96        a superclass of SVGValuePropertyList. Its items are of type Ref<SVGPoint>.
     97
     98        * svg/SVGPointListValues.cpp: Removed.
     99        * svg/SVGPointListValues.h: Removed.
     100        * svg/SVGPolyElement.cpp:
     101        (WebCore::SVGPolyElement::SVGPolyElement):
     102        (WebCore::SVGPolyElement::parseAttribute):
     103        (WebCore::SVGPolyElement::approximateMemoryCost const):
     104        (WebCore::SVGPolyElement::registerAttributes): Deleted.
     105        (WebCore::SVGPolyElement::points): Deleted.
     106        (WebCore::SVGPolyElement::animatedPoints): Deleted.
     107        * svg/SVGPolyElement.h:
     108        (WebCore::SVGPolyElement::points const):
     109        (WebCore::SVGPolyElement::points):
     110        (WebCore::SVGPolyElement::animatedPoints):
     111        (WebCore::SVGPolyElement::pointList const): Deleted.
     112        (WebCore::SVGPolyElement::attributeRegistry): Deleted.
     113        * svg/SVGSVGElement.cpp:
     114        (WebCore::SVGSVGElement::setCurrentTranslate):
     115        (WebCore::SVGSVGElement::currentTranslate): Deleted.
     116        * svg/SVGSVGElement.h:
     117        * svg/SVGSVGElement.idl:
     118        Define currentTranslate property to be of type Ref<SVGPoint>. When requesting
     119        it just return a reference to it.
     120
     121        * svg/SVGValue.h:
     122        * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
     123        * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
     124        * svg/properties/SVGAnimatedPropertyImpl.h:
     125        * svg/properties/SVGAnimatedPropertyList.h: Added.
     126        Define the accessor, the animator and the animated type of SVGPointList.
     127
     128        (WebCore::SVGAnimatedPropertyList::create):
     129        (WebCore::SVGAnimatedPropertyList::~SVGAnimatedPropertyList):
     130        (WebCore::SVGAnimatedPropertyList::baseVal const):
     131        (WebCore::SVGAnimatedPropertyList::baseVal):
     132        (WebCore::SVGAnimatedPropertyList::animVal const):
     133        (WebCore::SVGAnimatedPropertyList::animVal):
     134        (WebCore::SVGAnimatedPropertyList::currentValue const):
     135        (WebCore::SVGAnimatedPropertyList::SVGAnimatedPropertyList):
     136        (WebCore::SVGAnimatedPropertyList::ensureAnimVal):
     137        * svg/properties/SVGAnimationAdditiveListFunction.h: Added.
     138        (WebCore::SVGAnimationAdditiveListFunction::SVGAnimationAdditiveListFunction):
     139        (WebCore::SVGAnimationAdditiveListFunction::toAtEndOfDuration const):
     140        (WebCore::SVGAnimationAdditiveListFunction::adjustAnimatedList):
     141        * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: Added.
     142        (WebCore::SVGAnimationPointListFunction::progress):
     143        Define the animation function for animating SVGPointList.
     144
     145        * svg/properties/SVGAttributeRegistry.h:
     146        * svg/properties/SVGPropertyList.h: Added.
     147        (WebCore::SVGPropertyList::SVGPropertyList):
     148        (WebCore::SVGPropertyList::~SVGPropertyList):
     149        * svg/properties/SVGPropertyOwnerRegistry.h:
     150        (WebCore::SVGPropertyOwnerRegistry::registerProperty):
     151        * svg/properties/SVGValuePropertyList.h: Added.
     152        (WebCore::SVGValuePropertyList::operator=):
     153        (WebCore::SVGValuePropertyList::operator Vector<typename PropertyType::ValueType> const):
     154        (WebCore::SVGValuePropertyList::resize):
     155        (WebCore::SVGValuePropertyList::SVGValuePropertyList):
     156
    11572019-03-21  Said Abou-Hallawa  <said@apple.com>
    2158
  • trunk/Source/WebCore/Sources.txt

    r243333 r243336  
    22762276svg/SVGAnimatedNumberList.cpp
    22772277svg/SVGAnimatedPath.cpp
    2278 svg/SVGAnimatedPointList.cpp
    22792278svg/SVGAnimatedTransformList.cpp
    22802279svg/SVGAnimatedTypeAnimator.cpp
     
    23682367svg/SVGPathUtilities.cpp
    23692368svg/SVGPatternElement.cpp
    2370 svg/SVGPointListValues.cpp
    23712369svg/SVGPolyElement.cpp
    23722370svg/SVGPolygonElement.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r243333 r243336  
    12221222                439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */; };
    12231223                43B85ED418CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */; };
    1224                 43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */; };
    12251224                43C092BC12D9E4EE00A989C3 /* RenderSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */; };
    12261225                43EDD67F1B485DBF00640E75 /* CombinedFiltersAlphabet.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EDD67D1B485DBF00640E75 /* CombinedFiltersAlphabet.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    76687667                43B85ED318CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.gperf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SelectorPseudoClassAndCompatibilityElementMap.gperf; path = DerivedSources/WebCore/SelectorPseudoClassAndCompatibilityElementMap.gperf; sourceTree = BUILT_PRODUCTS_DIR; };
    76697668                43B85ED618CBEC9700E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SelectorPseudoClassAndCompatibilityElementMap.in; sourceTree = "<group>"; };
    7670                 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPointList.h; sourceTree = "<group>"; };
    7671                 43B9336813B261B1004584BF /* SVGAnimatedPointList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPointList.cpp; sourceTree = "<group>"; };
    76727669                43C092B912D9E4EE00A989C3 /* RenderSVGForeignObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGForeignObject.cpp; sourceTree = "<group>"; };
    76737670                43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGForeignObject.h; sourceTree = "<group>"; };
     
    95239520                7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAnimator.h; sourceTree = "<group>"; };
    95249521                7266F01822429CFD00833975 /* SVGAnimationAdditiveValueFunctionImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimationAdditiveValueFunctionImpl.cpp; sourceTree = "<group>"; };
     9522                7266F02522430F8C00833975 /* SVGValuePropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyList.h; sourceTree = "<group>"; };
     9523                7266F0272243109200833975 /* SVGPropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyList.h; sourceTree = "<group>"; };
     9524                7266F0282243120300833975 /* SVGAnimationAdditiveListFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveListFunctionImpl.h; sourceTree = "<group>"; };
     9525                7266F029224312B100833975 /* SVGAnimationAdditiveListFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveListFunction.h; sourceTree = "<group>"; };
     9526                7266F02A2243149B00833975 /* SVGAnimatedPropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyList.h; sourceTree = "<group>"; };
    95259527                727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTsRGB.cpp; sourceTree = "<group>"; };
    95269528                727AFED21A2EA6A0000442E8 /* EXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTsRGB.h; sourceTree = "<group>"; };
     
    97379739                7C39C3681DDB86D300FEFB29 /* SVGNumberListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGNumberListValues.cpp; sourceTree = "<group>"; };
    97389740                7C39C3691DDB86D300FEFB29 /* SVGNumberListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumberListValues.h; sourceTree = "<group>"; };
    9739                 7C39C36A1DDB871C00FEFB29 /* SVGPointListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPointListValues.cpp; sourceTree = "<group>"; };
    9740                 7C39C36B1DDB871C00FEFB29 /* SVGPointListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPointListValues.h; sourceTree = "<group>"; };
    97419741                7C39C36C1DDB8BB000FEFB29 /* SVGTransformListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformListValues.cpp; sourceTree = "<group>"; };
    97429742                7C39C36D1DDB8BB000FEFB29 /* SVGTransformListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformListValues.h; sourceTree = "<group>"; };
     
    1622016220                                088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */,
    1622116221                                55EE535C223B2A0D00FBA944 /* SVGAnimatedPropertyImpl.h */,
     16222                                7266F02A2243149B00833975 /* SVGAnimatedPropertyList.h */,
    1622216223                                55BE025E223B29C40032F08A /* SVGAnimatedPropertyPairAccessor.h */,
    1622316224                                55EE535D223B2A0D00FBA944 /* SVGAnimatedPropertyPairAccessorImpl.h */,
     
    1623016231                                721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */,
    1623116232                                55BE025F223B29C50032F08A /* SVGAnimationAdditiveFunction.h */,
     16233                                7266F029224312B100833975 /* SVGAnimationAdditiveListFunction.h */,
     16234                                7266F0282243120300833975 /* SVGAnimationAdditiveListFunctionImpl.h */,
    1623216235                                55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */,
    1623316236                                7266F01822429CFD00833975 /* SVGAnimationAdditiveValueFunctionImpl.cpp */,
     
    1626116264                                7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */,
    1626216265                                7266F0132241BCE200833975 /* SVGPropertyAnimatorFactory.h */,
     16266                                7266F0272243109200833975 /* SVGPropertyList.h */,
    1626316267                                55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */,
    1626416268                                55BE025C223B29C30032F08A /* SVGPropertyOwnerRegistry.h */,
     
    1626816272                                0813A4E91284132600992511 /* SVGStaticPropertyTearOff.h */,
    1626916273                                721443462240CAD200F12FF7 /* SVGValueProperty.h */,
     16274                                7266F02522430F8C00833975 /* SVGValuePropertyList.h */,
    1627016275                        );
    1627116276                        path = properties;
     
    2414724152                                0863951313B5FE5700BB344D /* SVGAnimatedPath.cpp */,
    2414824153                                0863951413B5FE5700BB344D /* SVGAnimatedPath.h */,
    24149                                 43B9336813B261B1004584BF /* SVGAnimatedPointList.cpp */,
    24150                                 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */,
    2415124154                                B22277F40D00BF1F0071B782 /* SVGAnimatedPreserveAspectRatio.idl */,
    2415224155                                B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */,
     
    2448124484                                B22278F60D00BF210071B782 /* SVGPointList.h */,
    2448224485                                B22278F70D00BF210071B782 /* SVGPointList.idl */,
    24483                                 7C39C36A1DDB871C00FEFB29 /* SVGPointListValues.cpp */,
    24484                                 7C39C36B1DDB871C00FEFB29 /* SVGPointListValues.h */,
    2448524486                                B22278F80D00BF210071B782 /* SVGPolyElement.cpp */,
    2448624487                                B22278F90D00BF210071B782 /* SVGPolyElement.h */,
     
    3192431925                                0863951613B5FE5700BB344D /* SVGAnimatedPath.h in Headers */,
    3192531926                                089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */,
    31926                                 43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */,
    3192731927                                088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */,
    3192831928                                088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */,
  • trunk/Source/WebCore/rendering/svg/SVGPathData.cpp

    r224213 r243336  
    4040namespace WebCore {
    4141
    42 static Path pathFromCircleElement(SVGElement& element)
     42static Path pathFromCircleElement(const SVGElement& element)
    4343{
    4444    ASSERT(is<SVGCircleElement>(element));
     
    6060}
    6161
    62 static Path pathFromEllipseElement(SVGElement& element)
     62static Path pathFromEllipseElement(const SVGElement& element)
    6363{
    6464    RenderElement* renderer = element.renderer();
     
    8383}
    8484
    85 static Path pathFromLineElement(SVGElement& element)
     85static Path pathFromLineElement(const SVGElement& element)
    8686{
    8787    Path path;
     
    9494}
    9595
    96 static Path pathFromPathElement(SVGElement& element)
     96static Path pathFromPathElement(const SVGElement& element)
    9797{
    9898    return downcast<SVGPathElement>(element).pathForByteStream();
    9999}
    100100
    101 static Path pathFromPolygonElement(SVGElement& element)
     101static Path pathFromPolygonElement(const SVGElement& element)
    102102{
    103     auto& points = downcast<SVGPolygonElement>(element).animatedPoints()->values();
     103    auto& points = downcast<SVGPolygonElement>(element).points().items();
    104104    if (points.isEmpty())
    105105        return { };
    106106
    107107    Path path;
    108     path.moveTo(points.first());
     108    path.moveTo(points.first()->value());
    109109
    110110    unsigned size = points.size();
    111111    for (unsigned i = 1; i < size; ++i)
    112         path.addLineTo(points.at(i));
     112        path.addLineTo(points.at(i)->value());
    113113
    114114    path.closeSubpath();
     
    116116}
    117117
    118 static Path pathFromPolylineElement(SVGElement& element)
     118static Path pathFromPolylineElement(const SVGElement& element)
    119119{
    120     auto& points = downcast<SVGPolylineElement>(element).animatedPoints()->values();
     120    auto& points = downcast<SVGPolylineElement>(element).points().items();
    121121    if (points.isEmpty())
    122122        return { };
    123123
    124124    Path path;
    125     path.moveTo(points.first());
     125    path.moveTo(points.first()->value());
    126126
    127127    unsigned size = points.size();
    128128    for (unsigned i = 1; i < size; ++i)
    129         path.addLineTo(points.at(i));
     129        path.addLineTo(points.at(i)->value());
    130130    return path;
    131131}
    132132
    133 static Path pathFromRectElement(SVGElement& element)
     133static Path pathFromRectElement(const SVGElement& element)
    134134{
    135135    RenderElement* renderer = element.renderer();
     
    170170}
    171171
    172 Path pathFromGraphicsElement(SVGElement* element)
     172Path pathFromGraphicsElement(const SVGElement* element)
    173173{
    174174    ASSERT(element);
    175175
    176     typedef Path (*PathFromFunction)(SVGElement&);
     176    typedef Path (*PathFromFunction)(const SVGElement&);
    177177    static HashMap<AtomicStringImpl*, PathFromFunction>* map = 0;
    178178    if (!map) {
  • trunk/Source/WebCore/rendering/svg/SVGPathData.h

    r223804 r243336  
    2525class Path;
    2626
    27 Path pathFromGraphicsElement(SVGElement*);
     27Path pathFromGraphicsElement(const SVGElement*);
    2828
    2929} // namespace WebCore
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

    r239535 r243336  
    272272    } else if (is<SVGPolyElement>(svgElement)) {
    273273        const SVGPolyElement& element = downcast<SVGPolyElement>(svgElement);
    274         writeNameAndQuotedValue(ts, "points", element.pointList().valueAsString());
     274        writeNameAndQuotedValue(ts, "points", element.points().valueAsString());
    275275    } else if (is<SVGPathElement>(svgElement)) {
    276276        const SVGPathElement& element = downcast<SVGPathElement>(svgElement);
  • trunk/Source/WebCore/svg/SVGAnimatedType.h

    r229417 r243336  
    111111    AnimatedPropertyType type() const
    112112    {
    113         ASSERT(m_value.index() >= AnimatedPropertyTypeMin && m_value.index() < AnimatedPropertyTypeMax);
    114         return static_cast<AnimatedPropertyType>(m_value.index());
     113        static AnimatedPropertyType animatedTypes[] = {
     114            AnimatedAngle,
     115            AnimatedEnumeration,
     116            AnimatedLength,
     117            AnimatedLengthList,
     118            AnimatedNumberList,
     119            AnimatedPath,
     120            AnimatedTransformList
     121        };
     122
     123        ASSERT(static_cast<size_t>(m_value.index()) < sizeof(animatedTypes) / sizeof(animatedTypes[0]));
     124        return animatedTypes[m_value.index()];
    115125    }
    116126
  • trunk/Source/WebCore/svg/SVGAnimatorFactory.h

    r243333 r243336  
    2626#include "SVGAnimatedNumberList.h"
    2727#include "SVGAnimatedPath.h"
    28 #include "SVGAnimatedPointList.h"
    2928#include "SVGAnimatedTransformList.h"
    3029
     
    4746        case AnimatedNumber:
    4847        case AnimatedNumberOptionalNumber:
     48        case AnimatedPoints:
    4949        case AnimatedPreserveAspectRatio:
    5050        case AnimatedRect:
     
    6464        case AnimatedPath:
    6565            return std::make_unique<SVGAnimatedPathAnimator>(animationElement, contextElement);
    66         case AnimatedPoints:
    67             return std::make_unique<SVGAnimatedPointListAnimator>(animationElement, contextElement);
    6866        case AnimatedTransformList:
    6967            return std::make_unique<SVGAnimatedTransformListAnimator>(animationElement, contextElement);
  • trunk/Source/WebCore/svg/SVGParserUtilities.cpp

    r228721 r243336  
    2626#include "Document.h"
    2727#include "FloatRect.h"
    28 #include "SVGPointListValues.h"
    2928#include <limits>
    3029#include <wtf/ASCIICType.h>
     
    259258    rect = FloatRect(x, y, width, height);
    260259    return valid;
    261 }
    262 
    263 bool pointsListFromSVGData(SVGPointListValues& pointsList, const String& points)
    264 {
    265     if (points.isEmpty())
    266         return true;
    267     auto upconvertedCharacters = StringView(points).upconvertedCharacters();
    268     const UChar* cur = upconvertedCharacters;
    269     const UChar* end = cur + points.length();
    270 
    271     skipOptionalSVGSpaces(cur, end);
    272 
    273     bool delimParsed = false;
    274     while (cur < end) {
    275         delimParsed = false;
    276         float xPos = 0.0f;
    277         if (!parseNumber(cur, end, xPos))
    278            return false;
    279 
    280         float yPos = 0.0f;
    281         if (!parseNumber(cur, end, yPos, false))
    282             return false;
    283 
    284         skipOptionalSVGSpaces(cur, end);
    285 
    286         if (cur < end && *cur == ',') {
    287             delimParsed = true;
    288             cur++;
    289         }
    290         skipOptionalSVGSpaces(cur, end);
    291 
    292         pointsList.append(FloatPoint(xPos, yPos));
    293     }
    294     return cur == end && !delimParsed;
    295260}
    296261
  • trunk/Source/WebCore/svg/SVGParserUtilities.h

    r228721 r243336  
    3333class FloatPoint;
    3434class FloatRect;
    35 class SVGPointListValues;
    3635
    3736template <typename CharacterType>
     
    8382}
    8483
    85 bool pointsListFromSVGData(SVGPointListValues&, const String& points);
    8684Vector<String> parseDelimitedString(const String& input, const char seperator);
    8785bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList);
  • trunk/Source/WebCore/svg/SVGPoint.h

    r242978 r243336  
    11/*
    22 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
    3  * Copyright (C) 2018 Apple Inc. All rights reserved.
     3 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    2929#include "FloatPoint.h"
    3030#include "SVGMatrix.h"
    31 #include "SVGPropertyTearOff.h"
     31#include "SVGValueProperty.h"
    3232
    3333namespace WebCore {
    3434
    35 class SVGPoint : public SVGPropertyTearOff<FloatPoint> {
     35class SVGPoint : public SVGValueProperty<FloatPoint> {
     36    using Base = SVGValueProperty<FloatPoint>;
     37    using Base::Base;
     38    using Base::m_value;
     39
    3640public:
    37     static Ref<SVGPoint> create(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
     41    static Ref<SVGPoint> create(const FloatPoint& value = { })
    3842    {
    39         return adoptRef(*new SVGPoint(animatedProperty, role, value));
     43        return adoptRef(*new SVGPoint(value));
    4044    }
    4145
    42     static Ref<SVGPoint> create(const FloatPoint& initialValue = { })
     46    template<typename T>
     47    static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& value)
    4348    {
    44         return adoptRef(*new SVGPoint(initialValue));
     49        if (value.hasException())
     50            return value.releaseException();
     51        return adoptRef(*new SVGPoint(value.releaseReturnValue()));
    4552    }
    4653
    47     template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
     54    Ref<SVGPoint> clone() const
    4855    {
    49         if (initialValue.hasException())
    50             return initialValue.releaseException();
    51         return create(initialValue.releaseReturnValue());
     56        return SVGPoint::create(m_value);
    5257    }
     58   
     59    float x() { return m_value.x(); }
    5360
    54     float x()
    55     {
    56         return propertyReference().x();
    57     }
    58 
    59     ExceptionOr<void> setX(float xValue)
     61    ExceptionOr<void> setX(float x)
    6062    {
    6163        if (isReadOnly())
    6264            return Exception { NoModificationAllowedError };
    6365
    64         propertyReference().setX(xValue);
     66        m_value.setX(x);
    6567        commitChange();
    6668
     
    6870    }
    6971
    70     float y()
    71     {
    72         return propertyReference().y();
    73     }
     72    float y() { return m_value.y(); }
    7473
    75     ExceptionOr<void> setY(float xValue)
     74    ExceptionOr<void> setY(float y)
    7675    {
    7776        if (isReadOnly())
    7877            return Exception { NoModificationAllowedError };
    7978
    80         propertyReference().setY(xValue);
     79        m_value.setY(y);
    8180        commitChange();
    82 
    8381        return { };
    8482    }
    8583
    86     ExceptionOr<Ref<SVGPoint>> matrixTransform(SVGMatrix& matrix)
     84    Ref<SVGPoint> matrixTransform(SVGMatrix& matrix) const
    8785    {
    88         if (isReadOnly())
    89             return Exception { NoModificationAllowedError };
    90 
    91         auto newPoint = propertyReference().matrixTransform(matrix.propertyReference());
    92         commitChange();
    93 
    94         return SVGPoint::create(newPoint);
     86        auto newPoint = m_value.matrixTransform(matrix.propertyReference());
     87        return adoptRef(*new SVGPoint(newPoint));
    9588    }
    9689
    97 protected:
    98     SVGPoint(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
    99         : SVGPropertyTearOff<FloatPoint>(&animatedProperty, role, value)
     90private:
     91    String valueAsString() const override
    10092    {
    101     }
    102 
    103     SVGPoint(SVGPropertyRole role, FloatPoint& value)
    104         : SVGPropertyTearOff<FloatPoint>(nullptr, role, value)
    105     {
    106     }
    107 
    108     explicit SVGPoint(const FloatPoint& initialValue)
    109         : SVGPropertyTearOff<FloatPoint>(initialValue)
    110     {
     93        return SVGPropertyTraits<FloatPoint>::toString(m_value);
    11194    }
    11295};
  • trunk/Source/WebCore/svg/SVGPoint.idl

    r222429 r243336  
    2727    attribute unrestricted float y;
    2828
    29     [MayThrowException, NewObject] SVGPoint matrixTransform(SVGMatrix matrix);
     29    [NewObject] SVGPoint matrixTransform(SVGMatrix matrix);
    3030};
    3131
  • trunk/Source/WebCore/svg/SVGPointList.h

    r208863 r243336  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include "SVGAnimatedListPropertyTearOff.h"
    29 #include "SVGListPropertyTearOff.h"
    3028#include "SVGPoint.h"
    31 #include "SVGPointListValues.h"
     29#include "SVGValuePropertyList.h"
    3230
    3331namespace WebCore {
    3432
    35 class SVGPointList : public SVGListPropertyTearOff<SVGPointListValues> {
     33class SVGPointList : public SVGValuePropertyList<SVGPoint> {
     34    using Base = SVGValuePropertyList<SVGPoint>;
     35    using Base::Base;
     36
    3637public:
    37     using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
    38     using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
    39 
    40     static Ref<SVGPointList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
     38    static Ref<SVGPointList> create()
    4139    {
    42         return adoptRef(*new SVGPointList(animatedProperty, role, values, wrappers));
     40        return adoptRef(*new SVGPointList());
    4341    }
    4442
    45 private:
    46     SVGPointList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
    47         : SVGListPropertyTearOff<SVGPointListValues>(animatedProperty, role, values, wrappers)
     43    static Ref<SVGPointList> create(SVGPropertyOwner* owner, SVGPropertyAccess access)
    4844    {
     45        return adoptRef(*new SVGPointList(owner, access));
     46    }
     47
     48    static Ref<SVGPointList> create(const SVGPointList& other, SVGPropertyAccess access)
     49    {
     50        return adoptRef(*new SVGPointList(other, access));
     51    }
     52
     53    bool parse(const String& value)
     54    {
     55        clearItems();
     56
     57        auto upconvertedCharacters = StringView(value).upconvertedCharacters();
     58        const UChar* cur = upconvertedCharacters;
     59        const UChar* end = cur + value.length();
     60
     61        skipOptionalSVGSpaces(cur, end);
     62
     63        bool delimParsed = false;
     64        while (cur < end) {
     65            delimParsed = false;
     66            float xPos = 0.0f;
     67            if (!parseNumber(cur, end, xPos))
     68                return false;
     69
     70            float yPos = 0.0f;
     71            if (!parseNumber(cur, end, yPos, false))
     72                return false;
     73
     74            skipOptionalSVGSpaces(cur, end);
     75
     76            if (cur < end && *cur == ',') {
     77                delimParsed = true;
     78                cur++;
     79            }
     80            skipOptionalSVGSpaces(cur, end);
     81
     82            append(SVGPoint::create({ xPos, yPos }));
     83        }
     84
     85        return !delimParsed;
     86    }
     87
     88    String valueAsString() const override
     89    {
     90        StringBuilder builder;
     91
     92        for (const auto& point : m_items) {
     93            if (builder.length())
     94                builder.append(' ');
     95
     96            builder.appendNumber(point->x());
     97            builder.append(' ');
     98            builder.appendNumber(point->y());
     99        }
     100
     101        return builder.toString();
    49102    }
    50103};
    51104
    52 } // namespace WebCore
     105}
  • trunk/Source/WebCore/svg/SVGPolyElement.cpp

    r234620 r243336  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2018 Apple Inc. All rights reserved.
     4 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    3838    , SVGExternalResourcesRequired(this)
    3939{
    40     registerAttributes();
    41 }
    42 
    43 void SVGPolyElement::registerAttributes()
    44 {
    45     auto& registry = attributeRegistry();
    46     if (!registry.isEmpty())
    47         return;
    48     registry.registerAttribute<SVGNames::pointsAttr, &SVGPolyElement::m_points>();
     40    static std::once_flag onceFlag;
     41    std::call_once(onceFlag, [] {
     42        PropertyRegistry::registerProperty<SVGNames::pointsAttr, &SVGPolyElement::m_points>();
     43    });
    4944}
    5045
     
    5247{
    5348    if (name == SVGNames::pointsAttr) {
    54         SVGPointListValues newList;
    55         if (!pointsListFromSVGData(newList, value))
     49        if (!m_points->baseVal()->parse(value))
    5650            document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\"");
    57 
    58         if (auto wrapper = static_pointer_cast<SVGAnimatedPointList>(lookupAnimatedProperty(m_points)))
    59             wrapper->detachListWrappers(newList.size());
    60 
    61         m_points.setValue(WTFMove(newList));
    6251        return;
    6352    }
     
    8271}
    8372
    84 Ref<SVGPointList> SVGPolyElement::points()
    85 {
    86     m_points.setShouldSynchronize(true);
    87     return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->baseVal();
    88 }
    89 
    90 Ref<SVGPointList> SVGPolyElement::animatedPoints()
    91 {
    92     m_points.setShouldSynchronize(true);
    93     return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->animVal();
    94 }
    95 
    9673size_t SVGPolyElement::approximateMemoryCost() const
    9774{
    98     size_t pointsCost = pointList().size() * sizeof(FloatPoint);
     75    size_t pointsCost = m_points->baseVal()->items().size() * sizeof(FloatPoint);
    9976    // We need to account for the memory which is allocated by the RenderSVGPath::m_path.
    10077    return sizeof(*this) + (renderer() ? pointsCost * 2 + sizeof(RenderSVGPath) : pointsCost);
  • trunk/Source/WebCore/svg/SVGPolyElement.h

    r243114 r243336  
    2222#pragma once
    2323
    24 #include "SVGAnimatedPointList.h"
    2524#include "SVGExternalResourcesRequired.h"
    2625#include "SVGGeometryElement.h"
     
    3231    WTF_MAKE_ISO_ALLOCATED(SVGPolyElement);
    3332public:
    34     Ref<SVGPointList> points();
    35     Ref<SVGPointList> animatedPoints();
     33    const SVGPointList& points() const { return m_points->currentValue(); }
    3634
    37     const SVGPointListValues& pointList() const { return m_points.value(); }
     35    SVGPointList& points() { return m_points->baseVal(); }
     36    SVGPointList& animatedPoints() { return *m_points->animVal(); }
    3837
    3938    size_t approximateMemoryCost() const override;
     
    4443private:
    4544    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>;
    46     static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
    47     static void registerAttributes();
    4845    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4946
     
    6461    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    6562    PropertyRegistry m_propertyRegistry { *this };
    66     SVGAnimatedPointListAttribute m_points;
     63    Ref<SVGAnimatedPointList> m_points { SVGAnimatedPointList::create(this) };
    6764};
    6865
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r243183 r243336  
    172172}
    173173
    174 Ref<SVGPoint> SVGSVGElement::currentTranslate()
    175 {
    176     return SVGStaticPropertyTearOff<SVGSVGElement, SVGPoint>::create(*this, m_currentTranslate, &SVGSVGElement::updateCurrentTranslate);
    177 }
    178 
    179174void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
    180175{
    181     if (m_currentTranslate == translation)
     176    if (m_currentTranslate->value() == translation)
    182177        return;
    183     m_currentTranslate = translation;
     178    m_currentTranslate->setValue(translation);
    184179    updateCurrentTranslate();
    185180}
  • trunk/Source/WebCore/svg/SVGSVGElement.h

    r243185 r243336  
    22 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     4 * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    6262    void setCurrentScale(float);
    6363
    64     Ref<SVGPoint> currentTranslate();
    65     FloatPoint currentTranslateValue() { return m_currentTranslate; }
     64    SVGPoint& currentTranslate() { return m_currentTranslate; }
     65    FloatPoint currentTranslateValue() const { return m_currentTranslate->value(); }
    6666
    6767    unsigned suspendRedraw(unsigned maxWaitMilliseconds);
     
    107107
    108108    void setCurrentTranslate(const FloatPoint&); // Used to pan.
    109     void updateCurrentTranslate(); // Used from DOM bindings to create an SVGStaticPropertyTearOff for currentTranslate.
     109    void updateCurrentTranslate();
    110110
    111111    bool hasIntrinsicWidth() const;
     
    170170    bool m_useCurrentView { false };
    171171    Ref<SMILTimeContainer> m_timeContainer;
    172     FloatPoint m_currentTranslate;
    173172    RefPtr<SVGViewSpec> m_viewSpec;
    174173    String m_currentViewFragmentIdentifier;
     174
     175    Ref<SVGPoint> m_currentTranslate { SVGPoint::create() };
    175176
    176177    AttributeOwnerProxy m_attributeOwnerProxy { *this };
  • trunk/Source/WebCore/svg/SVGSVGElement.idl

    r213393 r243336  
    4343    readonly attribute SVGViewSpec currentView;
    4444    attribute unrestricted float currentScale;
    45     [NewObject] readonly attribute SVGPoint currentTranslate;
     45    readonly attribute SVGPoint currentTranslate;
    4646
    4747    unsigned long suspendRedraw(optional unsigned long maxWaitMilliseconds = 0);
  • trunk/Source/WebCore/svg/SVGValue.h

    r234620 r243336  
    3434#include "SVGNumberListValues.h"
    3535#include "SVGPathByteStream.h"
    36 #include "SVGPointListValues.h"
    3736#include "SVGPreserveAspectRatioValue.h"
    3837#include "SVGPropertyTraits.h"
     
    4544using SVGValueVariant = Variant<
    4645    std::pair<SVGAngleValue, unsigned>*,
    47     bool*,
    48     Color*,
    4946    unsigned*,
    50     int*,
    51     std::pair<int, int>*,
    5247    SVGLengthValue*,
    5348    SVGLengthListValues*,
    54     float*,
    5549    SVGNumberListValues*,
    56     std::pair<float, float>*,
    5750    SVGPathByteStream*,
    58     SVGPointListValues*,
    59     SVGPreserveAspectRatioValue*,
    60     FloatRect*,
    61     String*,
    6251    SVGTransformListValues*
    6352>;
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h

    r243333 r243336  
    100100
    101101template<typename OwnerType>
     102class SVGAnimatedPointListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPointList> {
     103    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPointList>;
     104    using Base::property;
     105
     106public:
     107    using Base::Base;
     108    template<Ref<SVGAnimatedPointList> OwnerType::*property>
     109    constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPointListAccessor, property>(); }
     110
     111private:
     112    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     113    {
     114        return SVGAnimatedPointListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     115    }
     116
     117    void appendAnimatedInstance(OwnerType& owner, SVGAttributeAnimator& animator) const final
     118    {
     119        static_cast<SVGAnimatedPointListAnimator&>(animator).appendAnimatedInstance(property(owner));
     120    }
     121};
     122   
     123template<typename OwnerType>
    102124class SVGAnimatedPreserveAspectRatioAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPreserveAspectRatio> {
    103125    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPreserveAspectRatio>;
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h

    r243333 r243336  
    2828#include "SVGAnimatedPropertyAnimator.h"
    2929#include "SVGAnimatedPropertyImpl.h"
     30#include "SVGAnimationAdditiveListFunctionImpl.h"
    3031#include "SVGAnimationAdditiveValueFunctionImpl.h"
    3132#include "SVGAnimationDiscreteFunctionImpl.h"
     
    9697};
    9798
     99class SVGAnimatedPointListAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedPointList, SVGAnimationPointListFunction> {
     100    using Base = SVGAnimatedPropertyAnimator<SVGAnimatedPointList, SVGAnimationPointListFunction>;
     101    using Base::Base;
     102   
     103public:
     104    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPointList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     105    {
     106        return std::unique_ptr<SVGAnimatedPointListAnimator>(new SVGAnimatedPointListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     107    }
     108   
     109private:
     110    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
     111    {
     112        m_function.progress(targetElement, percentage, repeatCount, m_animated->animVal());
     113    }
     114};
     115
    98116class SVGAnimatedPreserveAspectRatioAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedPreserveAspectRatio, SVGAnimationPreserveAspectRatioFunction> {
    99117    using Base = SVGAnimatedPropertyAnimator<SVGAnimatedPreserveAspectRatio, SVGAnimationPreserveAspectRatioFunction>;
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h

    r243333 r243336  
    3131#include "SVGAnimatedLengthList.h"
    3232#include "SVGAnimatedNumberList.h"
    33 #include "SVGAnimatedPointList.h"
    3433#include "SVGAnimatedPrimitiveProperty.h"
     34#include "SVGAnimatedPropertyList.h"
    3535#include "SVGAnimatedTransformList.h"
    3636#include "SVGAnimatedValueProperty.h"
     37#include "SVGPointList.h"
    3738#include "SVGPreserveAspectRatio.h"
    3839#include "SVGRect.h"
     
    4849using SVGAnimatedPreserveAspectRatio = SVGAnimatedValueProperty<SVGPreserveAspectRatio>;
    4950
     51using SVGAnimatedPointList = SVGAnimatedPropertyList<SVGPointList>;
     52
    5053}
  • trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h

    r243333 r243336  
    3030#include "SVGAnimatedLengthList.h"
    3131#include "SVGAnimatedNumberList.h"
    32 #include "SVGAnimatedPointList.h"
    3332#include "SVGAnimatedTransformList.h"
    3433#include "SVGAttributeAccessor.h"
     
    7776    {
    7877        registerAttribute(SVGAnimatedNumberListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
    79     }
    80 
    81     template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedPointListAttribute OwnerType::*attribute>
    82     void registerAttribute()
    83     {
    84         registerAttribute(SVGAnimatedPointListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
    8578    }
    8679
  • trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h

    r243333 r243336  
    6868    }
    6969
     70    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedPointList> OwnerType::*property>
     71    static void registerProperty()
     72    {
     73        registerProperty(attributeName, SVGAnimatedPointListAccessor<OwnerType>::template singleton<property>());
     74    }
     75
    7076    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedPreserveAspectRatio> OwnerType::*property>
    7177    static void registerProperty()
Note: See TracChangeset for help on using the changeset viewer.