Title: [228721] trunk/Source/WebCore
Revision
228721
Author
commit-qu...@webkit.org
Date
2018-02-19 18:02:57 -0800 (Mon, 19 Feb 2018)

Log Message

Add SVGPropertyTraits::fromString() to all the SVG animated types
https://bugs.webkit.org/show_bug.cgi?id=182901

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2018-02-19
Reviewed by Dean Jackson.

This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
methods inside the template functions.

* WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
from SVGMarkerElement.h to SVGMarkerTypes.h.
* svg/SVGAngle.h:
(WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
* svg/SVGAngleValue.h:
* svg/SVGAnimateMotionElement.cpp:
(WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
* svg/SVGAnimatedBoolean.cpp:
(WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
* svg/SVGAnimatedColor.cpp:
(WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
(WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
(WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
* svg/SVGAnimatedEnumeration.cpp:
(WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
* svg/SVGAnimatedInteger.cpp:
(WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
* svg/SVGAnimatedIntegerOptionalInteger.cpp:
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
* svg/SVGAnimatedLength.cpp:
* svg/SVGAnimatedLengthList.cpp:
(WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
* svg/SVGAnimatedNumber.cpp:
(WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
(WebCore::parseNumberFromString):
* svg/SVGAnimatedNumberList.cpp:
(WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
* svg/SVGAnimatedNumberOptionalNumber.cpp:
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
* svg/SVGAnimatedPointList.cpp:
(WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
* svg/SVGAnimatedRect.cpp:
(WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
* svg/SVGAnimatedString.cpp:
(WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
* svg/SVGAnimatedTransformList.cpp:
(WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
* svg/SVGLength.h:
(WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
* svg/SVGLengthListValues.h:
(WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
(WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
* svg/SVGMarkerElement.h:
(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
(WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
* svg/SVGMarkerTypes.h: Added.
(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
(WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
* svg/SVGMatrix.h: Delete unused constructor and create method.
* svg/SVGNumber.h:
(WebCore::SVGNumber::SVGNumber): Ditto.
* svg/SVGNumberListValues.h:
(WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
* svg/SVGParserUtilities.cpp:
(WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
* svg/SVGParserUtilities.h:
* svg/SVGPathByteStream.h:
(WebCore::SVGPathByteStream::SVGPathByteStream):
(WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
(WebCore::SVGPathByteStream::copy const): Use the copy assignment.
(WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
(WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
(WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
* svg/SVGPathUtilities.cpp:
(WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
* svg/SVGPoint.h:
(WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
* svg/SVGPointListValues.h:
(WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
* svg/SVGPreserveAspectRatio.h:
(WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
* svg/SVGPreserveAspectRatioValue.cpp:
(WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
* svg/SVGPreserveAspectRatioValue.h:
(WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
(WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
* svg/SVGRect.h:
(WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
* svg/SVGRectTraits.h: Removed.
* svg/SVGTransform.h:
(WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
* svg/SVGTransformListValues.h:
(WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
* svg/properties/SVGPropertyTearOff.h: Delete unused create method.
* svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
(WebCore::SVGPropertyTraits<bool>::fromString):
(WebCore::SVGPropertyTraits<Color>::initialValue):
(WebCore::SVGPropertyTraits<Color>::fromString):
(WebCore::SVGPropertyTraits<Color>::parse):
(WebCore::SVGPropertyTraits<Color>::toString):
(WebCore::SVGPropertyTraits<int>::fromString):
(WebCore::SVGPropertyTraits<float>::fromString):
(WebCore::SVGPropertyTraits<float>::parse):
(WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
(WebCore::SVGPropertyTraits<FloatPoint>::fromString):
(WebCore::SVGPropertyTraits<FloatPoint>::parse):
(WebCore::SVGPropertyTraits<FloatPoint>::toString):
(WebCore::SVGPropertyTraits<FloatRect>::initialValue):
(WebCore::SVGPropertyTraits<FloatRect>::fromString):
(WebCore::SVGPropertyTraits<FloatRect>::parse):
(WebCore::SVGPropertyTraits<FloatRect>::toString):
(WebCore::SVGPropertyTraits<String>::fromString):
(WebCore::SVGPropertyTraits<String>::parse):
(WebCore::SVGPropertyTraits<String>::toString):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228720 => 228721)


--- trunk/Source/WebCore/ChangeLog	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/ChangeLog	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,3 +1,135 @@
+2018-02-19  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Add SVGPropertyTraits::fromString() to all the SVG animated types
+        https://bugs.webkit.org/show_bug.cgi?id=182901
+
+        Reviewed by Dean Jackson.
+
+        This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
+        goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
+        methods inside the template functions.
+
+        * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
+        from SVGMarkerElement.h to SVGMarkerTypes.h.
+        * svg/SVGAngle.h:
+        (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
+        * svg/SVGAngleValue.h:
+        * svg/SVGAnimateMotionElement.cpp:
+        (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
+        * svg/SVGAnimatedAngle.cpp:
+        (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
+        * svg/SVGAnimatedBoolean.cpp:
+        (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedColor.cpp:
+        (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
+        (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
+        (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
+        * svg/SVGAnimatedEnumeration.cpp:
+        (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedInteger.cpp:
+        (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedIntegerOptionalInteger.cpp:
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedLength.cpp:
+        * svg/SVGAnimatedLengthList.cpp:
+        (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedNumber.cpp:
+        (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
+        (WebCore::parseNumberFromString):
+        * svg/SVGAnimatedNumberList.cpp:
+        (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedNumberOptionalNumber.cpp:
+        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedPath.cpp:
+        (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedPointList.cpp:
+        (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedPreserveAspectRatio.cpp:
+        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedRect.cpp:
+        (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedString.cpp:
+        (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedTransformList.cpp:
+        (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
+        * svg/SVGLength.h:
+        (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
+        * svg/SVGLengthListValues.h:
+        (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
+        (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
+        * svg/SVGMarkerElement.h:
+        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
+        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
+        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
+        (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
+        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
+        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
+        * svg/SVGMarkerTypes.h: Added.
+        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
+        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
+        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
+        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
+        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
+        (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
+        * svg/SVGMatrix.h: Delete unused constructor and create method.
+        * svg/SVGNumber.h:
+        (WebCore::SVGNumber::SVGNumber): Ditto.
+        * svg/SVGNumberListValues.h:
+        (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
+        * svg/SVGParserUtilities.cpp:
+        (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
+        * svg/SVGParserUtilities.h:
+        * svg/SVGPathByteStream.h:
+        (WebCore::SVGPathByteStream::SVGPathByteStream):
+        (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
+        (WebCore::SVGPathByteStream::copy const): Use the copy assignment.
+        (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
+        (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
+        (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
+        * svg/SVGPathUtilities.cpp:
+        (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
+        * svg/SVGPoint.h:
+        (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
+        * svg/SVGPointListValues.h:
+        (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
+        * svg/SVGPolyElement.cpp:
+        (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
+        * svg/SVGPreserveAspectRatio.h:
+        (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
+        * svg/SVGPreserveAspectRatioValue.cpp:
+        (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
+        * svg/SVGPreserveAspectRatioValue.h:
+        (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
+        (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
+        * svg/SVGRect.h:
+        (WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
+        * svg/SVGRectTraits.h: Removed.
+        * svg/SVGTransform.h:
+        (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
+        * svg/SVGTransformListValues.h:
+        (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
+        * svg/properties/SVGPropertyTearOff.h: Delete unused create method.
+        * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
+        (WebCore::SVGPropertyTraits<bool>::fromString): 
+        (WebCore::SVGPropertyTraits<Color>::initialValue):
+        (WebCore::SVGPropertyTraits<Color>::fromString):
+        (WebCore::SVGPropertyTraits<Color>::parse):
+        (WebCore::SVGPropertyTraits<Color>::toString):
+        (WebCore::SVGPropertyTraits<int>::fromString):
+        (WebCore::SVGPropertyTraits<float>::fromString):
+        (WebCore::SVGPropertyTraits<float>::parse):
+        (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
+        (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
+        (WebCore::SVGPropertyTraits<FloatPoint>::parse):
+        (WebCore::SVGPropertyTraits<FloatPoint>::toString):
+        (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
+        (WebCore::SVGPropertyTraits<FloatRect>::fromString):
+        (WebCore::SVGPropertyTraits<FloatRect>::parse):
+        (WebCore::SVGPropertyTraits<FloatRect>::toString):
+        (WebCore::SVGPropertyTraits<String>::fromString):
+        (WebCore::SVGPropertyTraits<String>::parse):
+        (WebCore::SVGPropertyTraits<String>::toString):
+
 2018-02-19  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Implement a compact set of media controls

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (228720 => 228721)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-02-20 02:02:57 UTC (rev 228721)
@@ -2168,7 +2168,6 @@
 		7CE191791F2ABE7100272F78 /* JSFetchRequestMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916C1F2AB70A00272F78 /* JSFetchRequestMode.h */; };
 		7CE1917B1F2ABE7100272F78 /* JSFetchRequestRedirect.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916A1F2AB70600272F78 /* JSFetchRequestRedirect.h */; };
 		7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
-		7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
 		7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
 		7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D561DD7D96D00128552 /* SVGTransformValue.h */; };
 		7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */; };
@@ -3290,7 +3289,7 @@
 		B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B50D00BF200071B782 /* SVGMetadataElement.h */; };
 		B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
 		B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278BB0D00BF200071B782 /* SVGNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; };
+		B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C30D00BF200071B782 /* SVGPathElement.h */; };
 		B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C50D00BF200071B782 /* SVGPathSeg.h */; };
 		B2227A5E0D00BF220071B782 /* SVGPathSegArc.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C80D00BF200071B782 /* SVGPathSegArc.h */; };
@@ -8181,6 +8180,7 @@
 		53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInternalSettingsGenerated.h; sourceTree = "<group>"; };
 		550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+		55137B2C20379E550001004B /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; };
 		554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; };
 		554675781FD1FC1A003B10B0 /* ImageSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSource.h; sourceTree = "<group>"; };
 		5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; };
@@ -9482,7 +9482,6 @@
 		7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCacheQueryOptions.cpp; sourceTree = "<group>"; };
 		7CE1916F1F2AB70F00272F78 /* JSFetchRequestRedirect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestRedirect.cpp; sourceTree = "<group>"; };
 		7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
-		7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = "<group>"; };
 		7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
 		7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
 		7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };
@@ -22662,6 +22661,7 @@
 				B22278AD0D00BF200071B782 /* SVGMarkerElement.cpp */,
 				B22278AE0D00BF200071B782 /* SVGMarkerElement.h */,
 				B22278AF0D00BF200071B782 /* SVGMarkerElement.idl */,
+				55137B2C20379E550001004B /* SVGMarkerTypes.h */,
 				B22278B00D00BF200071B782 /* SVGMaskElement.cpp */,
 				B22278B10D00BF200071B782 /* SVGMaskElement.h */,
 				B22278B20D00BF200071B782 /* SVGMaskElement.idl */,
@@ -22795,7 +22795,6 @@
 				B22279070D00BF210071B782 /* SVGRectElement.cpp */,
 				B22279080D00BF210071B782 /* SVGRectElement.h */,
 				B22279090D00BF210071B782 /* SVGRectElement.idl */,
-				7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */,
 				B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
 				B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
 				B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,
@@ -29927,7 +29926,6 @@
 				B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
 				08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
 				B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
-				7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */,
 				197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
 				B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
 				BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,

Modified: trunk/Source/WebCore/svg/SVGAngle.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAngle.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAngle.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -42,11 +42,6 @@
         return adoptRef(*new SVGAngle(initialValue));
     }
 
-    static Ref<SVGAngle> create(const SVGAngleValue* initialValue)
-    {
-        return adoptRef(*new SVGAngle(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGAngle>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -145,11 +140,6 @@
         : SVGPropertyTearOff<SVGAngleValue>(initialValue)
     {
     }
-
-    explicit SVGAngle(const SVGAngleValue* initialValue)
-        : SVGPropertyTearOff<SVGAngleValue>(initialValue)
-    {
-    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGAngleValue.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAngleValue.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAngleValue.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -56,7 +56,8 @@
     float m_valueInSpecifiedUnits { 0 };
 };
 
-template<> struct SVGPropertyTraits<SVGAngleValue> {
+template<>
+struct SVGPropertyTraits<SVGAngleValue> {
     static SVGAngleValue initialValue() { return SVGAngleValue(); }
     static String toString(const SVGAngleValue& type) { return type.valueAsString(); }
 };

Modified: trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -136,31 +136,6 @@
     updateAnimationMode();
 }
 
-static bool parsePoint(const String& s, FloatPoint& point)
-{
-    if (s.isEmpty())
-        return false;
-    auto upconvertedCharacters = StringView(s).upconvertedCharacters();
-    const UChar* cur = upconvertedCharacters;
-    const UChar* end = cur + s.length();
-    
-    if (!skipOptionalSVGSpaces(cur, end))
-        return false;
-    
-    float x = 0;
-    if (!parseNumber(cur, end, x))
-        return false;
-    
-    float y = 0;
-    if (!parseNumber(cur, end, y))
-        return false;
-    
-    point = FloatPoint(x, y);
-    
-    // disallow anything except spaces at the end
-    return !skipOptionalSVGSpaces(cur, end);
-}
-    
 void SVGAnimateMotionElement::resetAnimatedType()
 {
     if (!hasValidAttributeType())

Modified: trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -32,17 +32,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createAngleAndEnumeration(std::make_unique<std::pair<SVGAngleValue, unsigned>>());
-    auto& animatedPair = animatedType->angleAndEnumeration();
-
-    SVGAngleValue angle;
-    SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
-    if (orientType > 0)
-        animatedPair.second = orientType;
-    if (orientType == SVGMarkerOrientAngle)
-        animatedPair.first = angle;
-
-    return animatedType;
+    auto values = SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>>::fromString(string);
+    return SVGAnimatedType::createAngleAndEnumeration(std::make_unique<std::pair<SVGAngleValue, unsigned>>(values));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -31,9 +32,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createBoolean(std::make_unique<bool>());
-    animatedType->boolean() = (string == "true"); // wat?
-    return animatedType;
+    auto value = SVGPropertyTraits<bool>::fromString(string);
+    return SVGAnimatedType::createBoolean(std::make_unique<bool>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedColor.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedColor.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedColor.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -33,7 +34,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const String& string)
 {
-    return SVGAnimatedType::createColor(std::make_unique<Color>(CSSParser::parseColor(string.stripWhiteSpace())));
+    auto value = SVGPropertyTraits<Color>::fromString(string);
+    return SVGAnimatedType::createColor(std::make_unique<Color>(value));
 }
 
 void SVGAnimatedColorAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
@@ -44,7 +46,7 @@
     ASSERT(to->type() == AnimatedColor);
 
     // Ignores any alpha and sets alpha on result to 100% opaque.
-    auto& fromColor = from->color();
+    const auto& fromColor = from->color();
     auto& toColor = to->color();
     toColor = { roundAndClampColorChannel(toColor.red() + fromColor.red()),
         roundAndClampColorChannel(toColor.green() + fromColor.green()),
@@ -82,7 +84,7 @@
     if (m_animationElement->toPropertyValueType() == CurrentColorValue)
         toColor = currentColor(*m_contextElement);
 
-    auto& toAtEndOfDurationColor = toAtEndOfDuration->color();
+    const auto& toAtEndOfDurationColor = toAtEndOfDuration->color();
     auto& animatedColor = animated->color();
 
     // FIXME: ExtendedColor - this will need to handle blending between colors in different color spaces,

Modified: trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2012. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -109,9 +110,8 @@
 std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::constructFromString(const String& string)
 {
     ASSERT(m_animationElement);
-    auto animatedType = SVGAnimatedType::createEnumeration(std::make_unique<unsigned>());
-    animatedType->enumeration() = enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string);
-    return animatedType;
+    auto value = enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string);
+    return SVGAnimatedType::createEnumeration(std::make_unique<unsigned>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -33,9 +34,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createInteger(std::make_unique<int>());
-    animatedType->integer() = string.toIntStrict();
-    return animatedType;
+    auto value = SVGPropertyTraits<int>::fromString(string);
+    return SVGAnimatedType::createInteger(std::make_unique<int>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -33,18 +33,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createIntegerOptionalInteger(std::make_unique<std::pair<int, int>>());
-    std::pair<int, int>& animatedInteger = animatedType->integerOptionalInteger();
-    float firstNumber = 0;
-    float secondNumber = 0;
-    if (!parseNumberOptionalNumber(string, firstNumber, secondNumber)) {
-        animatedInteger.first = 0;
-        animatedInteger.second = 0;
-    } else {
-        animatedInteger.first = static_cast<int>(roundf(firstNumber));
-        animatedInteger.second = static_cast<int>(roundf(secondNumber));
-    }
-    return animatedType;
+    auto values = SVGPropertyTraits<std::pair<int, int>>::fromString(string);
+    return SVGAnimatedType::createIntegerOptionalInteger(std::make_unique<std::pair<int, int>>(values));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedLength.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedLength.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedLength.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public

Modified: trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -33,9 +33,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createLengthList(std::make_unique<SVGLengthListValues>());
-    animatedType->lengthList().parse(string, m_lengthMode);
-    return animatedType;
+    auto value = SVGPropertyTraits<SVGLengthListValues>::fromString(string, m_lengthMode);
+    return SVGAnimatedType::createLengthList(std::make_unique<SVGLengthListValues>(WTFMove(value)));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -32,11 +33,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createNumber(std::make_unique<float>());
-    float& animatedNumber = animatedType->number();
-    if (!parseNumberFromString(string, animatedNumber))
-        animatedNumber = 0;
-    return animatedType;
+    auto value = SVGPropertyTraits<float>::fromString(string);
+    return SVGAnimatedType::createNumber(std::make_unique<float>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
@@ -74,9 +72,7 @@
 
 static float parseNumberFromString(SVGAnimationElement*, const String& string)
 {
-    float number = 0;
-    parseNumberFromString(string, number);
-    return number;
+    return SVGPropertyTraits<float>::fromString(string);
 }
 
 void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)

Modified: trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -32,9 +33,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createNumberList(std::make_unique<SVGNumberListValues>());
-    animatedType->numberList().parse(string);
-    return animatedType;
+    auto values = SVGPropertyTraits<SVGNumberListValues>::fromString(string);
+    return SVGAnimatedType::createNumberList(std::make_unique<SVGNumberListValues>(WTFMove(values)));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -33,13 +33,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createNumberOptionalNumber(std::make_unique<std::pair<float, float>>());
-    std::pair<float, float>& animatedNumber = animatedType->numberOptionalNumber();
-    if (!parseNumberOptionalNumber(string, animatedNumber.first, animatedNumber.second)) {
-        animatedNumber.first = 0;
-        animatedNumber.second = 0;
-    }
-    return animatedType;
+    auto values = SVGPropertyTraits<std::pair<float, float>>::fromString(string);
+    return SVGAnimatedType::createNumberOptionalNumber(std::make_unique<std::pair<float, float>>(values));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedPath.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedPath.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedPath.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -22,7 +22,6 @@
 
 #include "SVGAnimateElementBase.h"
 #include "SVGAnimatedPathSegListPropertyTearOff.h"
-#include "SVGPathUtilities.h"
 
 namespace WebCore {
 
@@ -33,9 +32,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::constructFromString(const String& string)
 {
-    auto byteStream = std::make_unique<SVGPathByteStream>();
-    buildSVGPathByteStreamFromString(string, *byteStream, UnalteredParsing);
-    return SVGAnimatedType::createPath(WTFMove(byteStream));
+    auto value = SVGPropertyTraits<SVGPathByteStream>::fromString(string);
+    return SVGAnimatedType::createPath(std::make_unique<SVGPathByteStream>(WTFMove(value)));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -34,9 +34,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createPointList(std::make_unique<SVGPointListValues>());
-    pointsListFromSVGData(animatedType->pointList(), string);
-    return animatedType;
+    auto values = SVGPropertyTraits<SVGPointListValues>::fromString(string);
+    return SVGAnimatedType::createPointList(std::make_unique<SVGPointListValues>(WTFMove(values)));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -31,9 +31,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createPreserveAspectRatio(std::make_unique<SVGPreserveAspectRatioValue>());
-    animatedType->preserveAspectRatio().parse(string);
-    return animatedType;
+    auto value = SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString(string);
+    return SVGAnimatedType::createPreserveAspectRatio(std::make_unique<SVGPreserveAspectRatioValue>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedRect.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedRect.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -32,9 +32,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createRect(std::make_unique<FloatRect>());
-    parseRect(string, animatedType->rect());
-    return animatedType;
+    auto value = SVGPropertyTraits<FloatRect>::fromString(string);
+    return SVGAnimatedType::createRect(std::make_unique<FloatRect>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedString.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedString.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedString.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -31,9 +31,8 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createString(std::make_unique<String>());
-    animatedType->string() = string;
-    return animatedType;
+    auto value = SVGPropertyTraits<String>::fromString(string);
+    return SVGAnimatedType::createString(std::make_unique<String>(value));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -41,10 +41,9 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createTransformList(std::make_unique<SVGTransformListValues>());
-    animatedType->transformList().parse(m_transformTypeString + string + ')');
-    ASSERT(animatedType->transformList().size() <= 1);
-    return animatedType;
+    auto values = SVGPropertyTraits<SVGTransformListValues>::fromString(m_transformTypeString + string + ')');
+    ASSERT(values.size() <= 1);
+    return SVGAnimatedType::createTransformList(std::make_unique<SVGTransformListValues>(WTFMove(values)));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGLength.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGLength.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGLength.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -57,11 +57,6 @@
         return adoptRef(*new SVGLength(initialValue));
     }
 
-    static Ref<SVGLength> create(const SVGLengthValue* initialValue)
-    {
-        return adoptRef(*new SVGLength(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -162,11 +157,6 @@
         : SVGPropertyTearOff<SVGLengthValue>(initialValue)
     {
     }
-
-    explicit SVGLength(const SVGLengthValue* initialValue)
-        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
-    {
-    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGLengthListValues.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGLengthListValues.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGLengthListValues.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -34,13 +34,26 @@
     String valueAsString() const;
 };
 
-template<> struct SVGPropertyTraits<SVGLengthListValues> {
+template<>
+struct SVGPropertyTraits<SVGLengthListValues> {
+    static SVGLengthListValues initialValue() { return { }; }
+    static SVGLengthListValues fromString(const String& string, SVGLengthMode lengthMode)
+    {
+        SVGLengthListValues list;
+        list.parse(string, lengthMode);
+        return list;
+    }
+    static std::optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string)
+    {
+        SVGLengthListValues list;
+        list.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
+        return list;
+    }
+    static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
+
     using ListItemType = SVGLengthValue;
     using ListItemTearOff = SVGLength;
     using ListPropertyTearOff = SVGLengthList;
-
-    static SVGLengthListValues initialValue() { return  { }; }
-    static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGMarkerElement.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGMarkerElement.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -29,75 +29,10 @@
 #include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
+#include "SVGMarkerTypes.h"
 
 namespace WebCore {
 
-enum SVGMarkerUnitsType {
-    SVGMarkerUnitsUnknown = 0,
-    SVGMarkerUnitsUserSpaceOnUse,
-    SVGMarkerUnitsStrokeWidth
-};
-
-enum SVGMarkerOrientType {
-    SVGMarkerOrientUnknown = 0,
-    SVGMarkerOrientAuto,
-    SVGMarkerOrientAngle,
-    SVGMarkerOrientAutoStartReverse,
-
-    // Add new elements before here.
-    SVGMarkerOrientMax
-};
-
-template<>
-struct SVGPropertyTraits<SVGMarkerUnitsType> {
-    static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
-
-    static String toString(SVGMarkerUnitsType type)
-    {
-        switch (type) {
-        case SVGMarkerUnitsUnknown:
-            return emptyString();
-        case SVGMarkerUnitsUserSpaceOnUse:
-            return ASCIILiteral("userSpaceOnUse");
-        case SVGMarkerUnitsStrokeWidth:
-            return ASCIILiteral("strokeWidth");
-        }
-
-        ASSERT_NOT_REACHED();
-        return emptyString();
-    }
-
-    static SVGMarkerUnitsType fromString(const String& value)
-    {
-        if (value == "userSpaceOnUse")
-            return SVGMarkerUnitsUserSpaceOnUse;
-        if (value == "strokeWidth")
-            return SVGMarkerUnitsStrokeWidth;
-        return SVGMarkerUnitsUnknown;
-    }
-};
-
-template<>
-inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
-
-template<> struct SVGPropertyTraits<SVGMarkerOrientType> {
-    static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
-
-    // toString is not needed, synchronizeOrientType() handles this on its own.
-
-    static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
-    {
-        if (value == "auto")
-            return SVGMarkerOrientAuto;
-        if (value == "auto-start-reverse")
-            return SVGMarkerOrientAutoStartReverse;
-        auto setValueResult = angle.setValueAsString(value);
-        if (setValueResult.hasException())
-            return SVGMarkerOrientUnknown;
-        return SVGMarkerOrientAngle;
-    }
-};
-
 class SVGMarkerElement final : public SVGElement,
                                public SVGExternalResourcesRequired,
                                public SVGFitToViewBox {

Added: trunk/Source/WebCore/svg/SVGMarkerTypes.h (0 => 228721)


--- trunk/Source/WebCore/svg/SVGMarkerTypes.h	                        (rev 0)
+++ trunk/Source/WebCore/svg/SVGMarkerTypes.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2018 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "SVGAngleValue.h"
+#include "SVGPropertyTraits.h"
+
+namespace WebCore {
+
+enum SVGMarkerUnitsType {
+    SVGMarkerUnitsUnknown = 0,
+    SVGMarkerUnitsUserSpaceOnUse,
+    SVGMarkerUnitsStrokeWidth
+};
+
+enum SVGMarkerOrientType {
+    SVGMarkerOrientUnknown = 0,
+    SVGMarkerOrientAuto,
+    SVGMarkerOrientAngle,
+    SVGMarkerOrientAutoStartReverse,
+    
+    // Add new elements before here.
+    SVGMarkerOrientMax
+};
+    
+template<>
+struct SVGPropertyTraits<SVGMarkerUnitsType> {
+    static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
+    static String toString(SVGMarkerUnitsType type)
+    {
+        switch (type) {
+        case SVGMarkerUnitsUnknown:
+            return emptyString();
+        case SVGMarkerUnitsUserSpaceOnUse:
+            return ASCIILiteral("userSpaceOnUse");
+        case SVGMarkerUnitsStrokeWidth:
+            return ASCIILiteral("strokeWidth");
+        }
+        
+        ASSERT_NOT_REACHED();
+        return emptyString();
+    }
+    static SVGMarkerUnitsType fromString(const String& value)
+    {
+        if (value == "userSpaceOnUse")
+            return SVGMarkerUnitsUserSpaceOnUse;
+        if (value == "strokeWidth")
+            return SVGMarkerUnitsStrokeWidth;
+        return SVGMarkerUnitsUnknown;
+    }
+};
+
+template<>
+struct SVGPropertyTraits<SVGMarkerOrientType> {
+    static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
+    static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
+    {
+        if (value == "auto")
+            return SVGMarkerOrientAuto;
+        if (value == "auto-start-reverse")
+            return SVGMarkerOrientAutoStartReverse;
+        auto setValueResult = angle.setValueAsString(value);
+        if (setValueResult.hasException())
+            return SVGMarkerOrientUnknown;
+        return SVGMarkerOrientAngle;
+    }
+};
+
+template<>
+inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
+
+template<>
+struct SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>> {
+    static std::pair<SVGAngleValue, unsigned> fromString(const String& string)
+    {
+        SVGAngleValue angle;
+        SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
+        if (orientType != SVGMarkerOrientAngle)
+            angle = { };
+        return std::pair<SVGAngleValue, unsigned>(angle, orientType);
+    }
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGMatrix.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGMatrix.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGMatrix.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -43,11 +43,6 @@
         return adoptRef(*new SVGMatrix(initialValue));
     }
 
-    static Ref<SVGMatrix> create(const SVGMatrixValue* initialValue)
-    {
-        return adoptRef(*new SVGMatrix(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGMatrix>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())

Modified: trunk/Source/WebCore/svg/SVGNumber.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGNumber.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGNumber.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -41,11 +41,6 @@
         return adoptRef(*new SVGNumber(initialValue));
     }
 
-    static Ref<SVGNumber> create(const float* initialValue)
-    {
-        return adoptRef(*new SVGNumber(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGNumber>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -79,11 +74,6 @@
         : SVGPropertyTearOff<float>(initialValue)
     {
     }
-
-    explicit SVGNumber(const float* initialValue)
-        : SVGPropertyTearOff<float>(initialValue)
-    {
-    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGNumberListValues.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGNumberListValues.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGNumberListValues.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -36,6 +36,12 @@
 
 template<> struct SVGPropertyTraits<SVGNumberListValues> {
     static SVGNumberListValues initialValue() { return { }; }
+    static SVGNumberListValues fromString(const String& string)
+    {
+        SVGNumberListValues list;
+        list.parse(string);
+        return list;
+    }
     static String toString(const SVGNumberListValues& list) { return list.valueAsString(); }
 
     using ListItemType = float;

Modified: trunk/Source/WebCore/svg/SVGParserUtilities.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGParserUtilities.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGParserUtilities.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -2,7 +2,7 @@
  * Copyright (C) 2002, 2003 The Karbon Developers
  * Copyright (C) 2006 Alexander Kellett <lypa...@kde.org>
  * Copyright (C) 2006, 2007 Rob Buis <b...@kde.org>
- * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -219,6 +219,31 @@
     return cur == end;
 }
 
+bool parsePoint(const String& s, FloatPoint& point)
+{
+    if (s.isEmpty())
+        return false;
+    auto upconvertedCharacters = StringView(s).upconvertedCharacters();
+    const UChar* cur = upconvertedCharacters;
+    const UChar* end = cur + s.length();
+
+    if (!skipOptionalSVGSpaces(cur, end))
+        return false;
+
+    float x = 0;
+    if (!parseNumber(cur, end, x))
+        return false;
+
+    float y = 0;
+    if (!parseNumber(cur, end, y))
+        return false;
+
+    point = FloatPoint(x, y);
+
+    // Disallow anything except spaces at the end.
+    return !skipOptionalSVGSpaces(cur, end);
+}
+
 bool parseRect(const String& string, FloatRect& rect)
 {
     auto upconvertedCharacters = StringView(string).upconvertedCharacters();

Modified: trunk/Source/WebCore/svg/SVGParserUtilities.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGParserUtilities.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGParserUtilities.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -42,6 +42,7 @@
 bool parseNumberOptionalNumber(const String& s, float& h, float& v);
 bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag);
 bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag);
+bool parsePoint(const String&, FloatPoint&);
 bool parseRect(const String&, FloatRect&);
 
 template <typename CharacterType>

Modified: trunk/Source/WebCore/svg/SVGPathByteStream.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPathByteStream.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPathByteStream.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -19,6 +20,8 @@
 
 #pragma once
 
+#include "SVGPathUtilities.h"
+#include "SVGPropertyTraits.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -46,21 +49,38 @@
     typedef Data::const_iterator DataIterator;
 
     SVGPathByteStream() { }
-    SVGPathByteStream(const Data& data) : m_data(data) { }
-    
-    bool operator==(const SVGPathByteStream& other) const
+    SVGPathByteStream(const SVGPathByteStream& other)
     {
-        return m_data == other.m_data;
+        *this = other;
     }
 
-    bool operator!=(const SVGPathByteStream& other) const
+    SVGPathByteStream(SVGPathByteStream&& other)
     {
-        return !(*this == other);
+        *this = WTFMove(other);
     }
 
+    SVGPathByteStream& operator=(const SVGPathByteStream& other)
+    {
+        if (*this == other)
+            return *this;
+        m_data = other.m_data;
+        return *this;
+    }
+
+    SVGPathByteStream& operator=(SVGPathByteStream&& other)
+    {
+        if (*this == other)
+            return *this;
+        m_data = WTFMove(other.m_data);
+        return *this;
+    }
+
+    bool operator==(const SVGPathByteStream& other) const { return m_data == other.m_data; }
+    bool operator!=(const SVGPathByteStream& other) const { return !(*this == other); }
+
     std::unique_ptr<SVGPathByteStream> copy() const
     {
-        return std::make_unique<SVGPathByteStream>(m_data);
+        return std::make_unique<SVGPathByteStream>(*this);
     }
 
     DataIterator begin() const { return m_data.begin(); }
@@ -67,13 +87,9 @@
     DataIterator end() const { return m_data.end(); }
 
     void append(unsigned char byte) { m_data.append(byte); }
-    void append(const SVGPathByteStream& other)
-    {
-        for (auto stream : other)
-            append(stream);
-    }
+    void append(const SVGPathByteStream& other) { m_data.appendVector(other.m_data); }
     void clear() { m_data.clear(); }
-    bool isEmpty() const { return !m_data.size(); }
+    bool isEmpty() const { return m_data.isEmpty(); }
     unsigned size() const { return m_data.size(); }
 
     // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.
@@ -83,4 +99,15 @@
     Data m_data;
 };
 
+template<>
+struct SVGPropertyTraits<SVGPathByteStream> {
+    static SVGPathByteStream initialValue() { return SVGPathByteStream(); }
+    static SVGPathByteStream fromString(const String& string)
+    {
+        SVGPathByteStream byteStream;
+        buildSVGPathByteStreamFromString(string, byteStream, UnalteredParsing);
+        return byteStream;
+    }
+};
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGPathUtilities.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPathUtilities.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPathUtilities.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -206,15 +206,15 @@
 
 bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
 {
-    // Why return when streamToAppendTo is empty? Don't we still need to append?
+    // The byStream will be blended with streamToAppendTo. So streamToAppendTo has to have elements.
     if (streamToAppendTo.isEmpty() || byStream.isEmpty())
         return true;
 
-    // Is it OK to make the SVGPathByteStreamBuilder from a stream, and then clear that stream?
+    // builder is the destination of blending fromSource and bySource. The stream of builder
+    // (i.e. streamToAppendTo) has to be cleared before calling addAnimatedPath.
     SVGPathByteStreamBuilder builder(streamToAppendTo);
 
-    SVGPathByteStream fromStreamCopy = streamToAppendTo;
-    streamToAppendTo.clear();
+    SVGPathByteStream fromStreamCopy = WTFMove(streamToAppendTo);
 
     SVGPathByteStreamSource fromSource(fromStreamCopy);
     SVGPathByteStreamSource bySource(byStream);

Modified: trunk/Source/WebCore/svg/SVGPoint.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPoint.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPoint.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -43,11 +44,6 @@
         return adoptRef(*new SVGPoint(initialValue));
     }
 
-    static Ref<SVGPoint> create(const FloatPoint* initialValue)
-    {
-        return adoptRef(*new SVGPoint(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -113,11 +109,6 @@
         : SVGPropertyTearOff<FloatPoint>(initialValue)
     {
     }
-
-    explicit SVGPoint(const FloatPoint* initialValue)
-        : SVGPropertyTearOff<FloatPoint>(initialValue)
-    {
-    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGPointListValues.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPointListValues.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPointListValues.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -34,8 +34,15 @@
     String valueAsString() const;
 };
 
-template<> struct SVGPropertyTraits<SVGPointListValues> {
+template<>
+struct SVGPropertyTraits<SVGPointListValues> {
     static SVGPointListValues initialValue() { return { }; }
+    static SVGPointListValues fromString(const String& string)
+    {
+        SVGPointListValues list;
+        pointsListFromSVGData(list, string);
+        return list;
+    }
 
     using ListItemType = FloatPoint;
     using ListItemTearOff = SVGPoint;

Modified: trunk/Source/WebCore/svg/SVGPolyElement.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPolyElement.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPolyElement.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -73,7 +73,7 @@
         if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
             static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size());
 
-        m_points.value = newList;
+        m_points.value = WTFMove(newList);
         return;
     }
 

Modified: trunk/Source/WebCore/svg/SVGPreserveAspectRatio.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPreserveAspectRatio.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPreserveAspectRatio.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -42,11 +42,6 @@
         return adoptRef(*new SVGPreserveAspectRatio(initialValue));
     }
 
-    static Ref<SVGPreserveAspectRatio> create(const SVGPreserveAspectRatioValue* initialValue)
-    {
-        return adoptRef(*new SVGPreserveAspectRatio(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGPreserveAspectRatio>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -100,11 +95,6 @@
         : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
     {
     }
-
-    explicit SVGPreserveAspectRatio(const SVGPreserveAspectRatioValue* initialValue)
-        : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
-    {
-    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp	2018-02-20 02:02:57 UTC (rev 228721)
@@ -35,6 +35,11 @@
 {
 }
 
+SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue(const String& value)
+{
+    parse(value);
+}
+
 ExceptionOr<void> SVGPreserveAspectRatioValue::setAlign(unsigned short align)
 {
     if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX)

Modified: trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -52,6 +52,7 @@
     };
 
     SVGPreserveAspectRatioValue();
+    SVGPreserveAspectRatioValue(const String&);
 
     ExceptionOr<void> setAlign(unsigned short);
     unsigned short align() const { return m_align; }
@@ -77,7 +78,15 @@
 
 template<> struct SVGPropertyTraits<SVGPreserveAspectRatioValue> {
     static SVGPreserveAspectRatioValue initialValue() { return SVGPreserveAspectRatioValue(); }
-    static String toString(const SVGPreserveAspectRatioValue& type) { return type.valueAsString(); }
+    static SVGPreserveAspectRatioValue fromString(const String& string)
+    {
+        return SVGPreserveAspectRatioValue(string);
+
+    }
+    static String toString(const SVGPreserveAspectRatioValue& type)
+    {
+        return type.valueAsString();
+    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGRect.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGRect.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGRect.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,7 +21,7 @@
 #pragma once
 
 #include "SVGPropertyTearOff.h"
-#include "SVGRectTraits.h"
+#include "SVGPropertyTraits.h"
 
 namespace WebCore {
 
@@ -36,11 +37,6 @@
         return adoptRef(*new SVGRect(initialValue));
     }
 
-    static Ref<SVGRect> create(const FloatRect* initialValue)
-    {
-        return adoptRef(*new SVGRect(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -122,11 +118,6 @@
         : SVGPropertyTearOff<FloatRect>(initialValue)
     {
     }
-
-    explicit SVGRect(const FloatRect* initialValue)
-        : SVGPropertyTearOff<FloatRect>(initialValue)
-    {
-    }
 };
 
 

Deleted: trunk/Source/WebCore/svg/SVGRectTraits.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGRectTraits.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGRectTraits.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "FloatRect.h"
-#include "SVGPropertyTraits.h"
-#include <wtf/text/StringBuilder.h>
-
-namespace WebCore {
-
-template<>
-struct SVGPropertyTraits<FloatRect> {
-    static FloatRect initialValue() { return { }; }
-    static String toString(const FloatRect& type)
-    {
-        StringBuilder builder;
-        builder.appendNumber(type.x());
-        builder.append(' ');
-        builder.appendNumber(type.y());
-        builder.append(' ');
-        builder.appendNumber(type.width());
-        builder.append(' ');
-        builder.appendNumber(type.height());
-        return builder.toString();
-    }
-};
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGTransform.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGTransform.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGTransform.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -43,11 +43,6 @@
         return adoptRef(*new SVGTransform(initialValue));
     }
 
-    static Ref<SVGTransform> create(const SVGTransformValue* initialValue)
-    {
-        return adoptRef(*new SVGTransform(initialValue));
-    }
-
     template<typename T> static ExceptionOr<Ref<SVGTransform>> create(ExceptionOr<T>&& initialValue)
     {
         if (initialValue.hasException())
@@ -143,11 +138,6 @@
         : SVGPropertyTearOff<SVGTransformValue>(initialValue)
     {
     }
-
-    explicit SVGTransform(const SVGTransformValue* initialValue)
-        : SVGPropertyTearOff<SVGTransformValue>(initialValue)
-    {
-    }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGTransformListValues.h (228720 => 228721)


--- trunk/Source/WebCore/svg/SVGTransformListValues.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/SVGTransformListValues.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -44,6 +44,12 @@
 
 template<> struct SVGPropertyTraits<SVGTransformListValues> {
     static SVGTransformListValues initialValue() { return { }; }
+    static SVGTransformListValues fromString(const String& string)
+    {
+        SVGTransformListValues values;
+        values.parse(string);
+        return values;
+    }
     static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
 
     using ListItemType = SVGTransformValue;

Modified: trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h (228720 => 228721)


--- trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -53,11 +53,6 @@
         return adoptRef(*new Self(initialValue));
     }
 
-    static Ref<Self> create(const PropertyType* initialValue)
-    {
-        return adoptRef(*new Self(initialValue));
-    }
-
     template<typename U> static ExceptionOr<Ref<Self>> create(ExceptionOr<U>&& initialValue)
     {
         if (initialValue.hasException())

Modified: trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h (228720 => 228721)


--- trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h	2018-02-20 02:00:39 UTC (rev 228720)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h	2018-02-20 02:02:57 UTC (rev 228721)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmerm...@kde.org>
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,6 +21,13 @@
 
 #pragma once
 
+#include "CSSParser.h"
+#include "Color.h"
+#include "FloatPoint.h"
+#include "FloatRect.h"
+#include "QualifiedName.h"
+#include "SVGParserUtilities.h"
+#include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -30,10 +38,25 @@
 template<>
 struct SVGPropertyTraits<bool> {
     static bool initialValue() { return false; }
+    static bool fromString(const String& string) { return string == "true"; }
     static String toString(bool type) { return type ? "true" : "false"; }
 };
 
 template<>
+struct SVGPropertyTraits<Color> {
+    static Color initialValue() { return Color(); }
+    static Color fromString(const String& string) { return CSSParser::parseColor(string.stripWhiteSpace()); }
+    static std::optional<Color> parse(const QualifiedName&, const String& string)
+    {
+        Color color = CSSParser::parseColor(string.stripWhiteSpace());
+        if (!color.isValid())
+            return std::nullopt;
+        return color;
+    }
+    static String toString(const Color& type) { return type.serialized(); }
+};
+
+template<>
 struct SVGPropertyTraits<unsigned> {
     static unsigned initialValue() { return 0; }
     static String toString(unsigned type) { return String::number(type); }
@@ -42,19 +65,118 @@
 template<>
 struct SVGPropertyTraits<int> {
     static int initialValue() { return 0; }
+    static int fromString(const String&string) { return string.toIntStrict(); }
     static String toString(int type) { return String::number(type); }
 };
 
 template<>
+struct SVGPropertyTraits<std::pair<int, int>> {
+    static std::pair<int, int> initialValue() { return { }; }
+    static std::pair<int, int> fromString(const String& string)
+    {
+        float firstNumber = 0, secondNumber = 0;
+        if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
+            return { };
+        return std::make_pair(static_cast<int>(roundf(firstNumber)), static_cast<int>(roundf(secondNumber)));
+    }
+};
+
+template<>
 struct SVGPropertyTraits<float> {
     static float initialValue() { return 0; }
+    static float fromString(const String& string)
+    {
+        float number = 0;
+        if (!parseNumberFromString(string, number))
+            return 0;
+        return number;
+    }
+    static std::optional<float> parse(const QualifiedName&, const String& string)
+    {
+        float number;
+        if (!parseNumberFromString(string, number))
+            return std::nullopt;
+        return number;
+    }
     static String toString(float type) { return String::number(type); }
 };
 
 template<>
+struct SVGPropertyTraits<std::pair<float, float>> {
+    static std::pair<float, float> initialValue() { return { }; }
+    static std::pair<float, float> fromString(const String& string)
+    {
+        float firstNumber = 0, secondNumber = 0;
+        if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
+            return { };
+        return std::make_pair(firstNumber, secondNumber);
+    }
+};
+
+template<>
+struct SVGPropertyTraits<FloatPoint> {
+    static FloatPoint initialValue() { return FloatPoint(); }
+    static FloatPoint fromString(const String& string)
+    {
+        FloatPoint point;
+        if (!parsePoint(string, point))
+            return { };
+        return point;
+    }
+    static std::optional<FloatPoint> parse(const QualifiedName&, const String& string)
+    {
+        FloatPoint point;
+        if (!parsePoint(string, point))
+            return std::nullopt;
+        return point;
+    }
+    static String toString(const FloatPoint& type)
+    {
+        StringBuilder builder;
+        builder.appendNumber(type.x());
+        builder.append(' ');
+        builder.appendNumber(type.y());
+        return builder.toString();
+    }
+};
+
+template<>
+struct SVGPropertyTraits<FloatRect> {
+    static FloatRect initialValue() { return FloatRect(); }
+    static FloatRect fromString(const String& string)
+    {
+        FloatRect rect;
+        if (!parseRect(string, rect))
+            return { };
+        return rect;
+    }
+    static std::optional<FloatRect> parse(const QualifiedName&, const String& string)
+    {
+        FloatRect rect;
+        if (!parseRect(string, rect))
+            return std::nullopt;
+        return rect;
+    }
+    static String toString(const FloatRect& type)
+    {
+        StringBuilder builder;
+        builder.appendNumber(type.x());
+        builder.append(' ');
+        builder.appendNumber(type.y());
+        builder.append(' ');
+        builder.appendNumber(type.width());
+        builder.append(' ');
+        builder.appendNumber(type.height());
+        return builder.toString();
+    }
+};
+
+template<>
 struct SVGPropertyTraits<String> {
     static String initialValue() { return String(); }
-    static String toString(const String& type) { return type; }
+    static String fromString(const String& string) { return string; }
+    static std::optional<String> parse(const QualifiedName&, const String& string) { return string; }
+    static String toString(const String& string) { return string; }
 };
 
 template<typename EnumType>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to