Diff
Modified: trunk/LayoutTests/ChangeLog (243335 => 243336)
--- trunk/LayoutTests/ChangeLog 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/LayoutTests/ChangeLog 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,3 +1,17 @@
+2019-03-21 Said Abou-Hallawa <[email protected]>
+
+ Remove the SVG tear off objects for SVGPoint, SVGPointList and SVGAnimatedPointList
+ https://bugs.webkit.org/show_bug.cgi?id=195905
+
+ 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.
+
2019-03-21 Zalan Bujtas <[email protected]>
Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer.
Modified: trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt (243335 => 243336)
--- trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt 2019-03-21 22:21:58 UTC (rev 243336)
@@ -45,6 +45,7 @@
PASS poly1.points.insertItemBefore(poly1) threw exception TypeError: Not enough arguments.
PASS poly1.points.insertItemBefore(null) threw exception TypeError: Not enough arguments.
PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 'aString')) is "x=100 y=0"
+PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=100 y=0"
PASS poly1.points.numberOfItems is 4
PASS dumpPoint(poly1.points.getItem(0)) is "x=100 y=0"
PASS dumpPoint(poly1.points.getItem(1)) is "x=0 y=0"
@@ -52,6 +53,7 @@
PASS dumpPoint(poly1.points.getItem(3)) is "x=0 y=100"
PASS poly1.getAttribute('points').formatPointsAttribute() is "100 0 0 0 100 100 0 100"
PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), poly1)) is "x=0 y=0"
+PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=0 y=0"
PASS poly1.points.numberOfItems is 4
PASS dumpPoint(poly1.points.getItem(0)) is "x=0 y=0"
PASS dumpPoint(poly1.points.getItem(1)) is "x=100 y=0"
@@ -59,6 +61,7 @@
PASS dumpPoint(poly1.points.getItem(3)) is "x=0 y=100"
PASS poly1.getAttribute('points').formatPointsAttribute() is "0 0 100 0 100 100 0 100"
PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), null)) is "x=100 y=0"
+PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=100 y=0"
PASS poly1.points.numberOfItems is 4
PASS dumpPoint(poly1.points.getItem(0)) is "x=100 y=0"
PASS dumpPoint(poly1.points.getItem(1)) is "x=0 y=0"
@@ -65,6 +68,7 @@
PASS dumpPoint(poly1.points.getItem(2)) is "x=100 y=100"
PASS poly1.getAttribute('points').formatPointsAttribute() is "100 0 0 0 100 100 0 100"
PASS dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 0)) is "x=0 y=0"
+PASS dumpPoint(poly1.points.removeItem(2, 'aString')) is "x=0 y=0"
PASS poly1.points.numberOfItems is 4
PASS dumpPoint(poly1.points.getItem(0)) is "x=0 y=0"
PASS dumpPoint(poly1.points.getItem(1)) is "x=100 y=0"
Modified: trunk/LayoutTests/svg/dom/SVGPointList-basics.xhtml (243335 => 243336)
--- trunk/LayoutTests/svg/dom/SVGPointList-basics.xhtml 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/LayoutTests/svg/dom/SVGPointList-basics.xhtml 2019-03-21 22:21:58 UTC (rev 243336)
@@ -77,6 +77,7 @@
shouldThrow("poly1.points.insertItemBefore(null)");
shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 'aString'))", "x=100 y=0");
+ shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=100 y=0");
shouldBe("poly1.points.numberOfItems", "4");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=0");
@@ -83,8 +84,9 @@
shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100");
shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()", "100 0 0 0 100 100 0 100");
-
+
shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), poly1))", "x=0 y=0");
+ shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=0 y=0");
shouldBe("poly1.points.numberOfItems", "4");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
@@ -93,13 +95,15 @@
shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()", "0 0 100 0 100 100 0 100");
shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), null))", "x=100 y=0");
+ shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=100 y=0");
shouldBe("poly1.points.numberOfItems", "4");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=0");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100");
shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()", "100 0 0 0 100 100 0 100");
-
+
shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points.getItem(1), 0))", "x=0 y=0");
+ shouldBeEqualToString("dumpPoint(poly1.points.removeItem(2, 'aString'))", "x=0 y=0");
shouldBe("poly1.points.numberOfItems", "4");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
Modified: trunk/Source/WebCore/ChangeLog (243335 => 243336)
--- trunk/Source/WebCore/ChangeLog 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/ChangeLog 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,5 +1,161 @@
2019-03-21 Said Abou-Hallawa <[email protected]>
+ Remove the SVG tear off objects for SVGPoint, SVGPointList and SVGAnimatedPointList
+ https://bugs.webkit.org/show_bug.cgi?id=195905
+
+ 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):
+
+2019-03-21 Said Abou-Hallawa <[email protected]>
+
Remove the SVG property tear off objects for SVGAnimatedString
https://bugs.webkit.org/show_bug.cgi?id=196065
Modified: trunk/Source/WebCore/Sources.txt (243335 => 243336)
--- trunk/Source/WebCore/Sources.txt 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/Sources.txt 2019-03-21 22:21:58 UTC (rev 243336)
@@ -2275,7 +2275,6 @@
svg/SVGAnimatedLengthList.cpp
svg/SVGAnimatedNumberList.cpp
svg/SVGAnimatedPath.cpp
-svg/SVGAnimatedPointList.cpp
svg/SVGAnimatedTransformList.cpp
svg/SVGAnimatedTypeAnimator.cpp
svg/SVGAnimationElement.cpp
@@ -2367,7 +2366,6 @@
svg/SVGPathTraversalStateBuilder.cpp
svg/SVGPathUtilities.cpp
svg/SVGPatternElement.cpp
-svg/SVGPointListValues.cpp
svg/SVGPolyElement.cpp
svg/SVGPolygonElement.cpp
svg/SVGPolylineElement.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243335 => 243336)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1221,7 +1221,6 @@
439D334413A6911C00C20F4F /* SVGAnimatedTypeAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */; };
439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */; };
43B85ED418CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */; };
- 43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */; };
43C092BC12D9E4EE00A989C3 /* RenderSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */; };
43EDD67F1B485DBF00640E75 /* CombinedFiltersAlphabet.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EDD67D1B485DBF00640E75 /* CombinedFiltersAlphabet.h */; settings = {ATTRIBUTES = (Private, ); }; };
4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7667,8 +7666,6 @@
43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SelectorPseudoClassAndCompatibilityElementMap.cpp; path = DerivedSources/WebCore/SelectorPseudoClassAndCompatibilityElementMap.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
43B85ED318CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.gperf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SelectorPseudoClassAndCompatibilityElementMap.gperf; path = DerivedSources/WebCore/SelectorPseudoClassAndCompatibilityElementMap.gperf; sourceTree = BUILT_PRODUCTS_DIR; };
43B85ED618CBEC9700E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SelectorPseudoClassAndCompatibilityElementMap.in; sourceTree = "<group>"; };
- 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPointList.h; sourceTree = "<group>"; };
- 43B9336813B261B1004584BF /* SVGAnimatedPointList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPointList.cpp; sourceTree = "<group>"; };
43C092B912D9E4EE00A989C3 /* RenderSVGForeignObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGForeignObject.cpp; sourceTree = "<group>"; };
43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGForeignObject.h; sourceTree = "<group>"; };
43D2597613C816F400608559 /* ImageBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBuffer.cpp; sourceTree = "<group>"; };
@@ -9522,6 +9519,11 @@
7266F0152241C09800833975 /* SVGPrimitivePropertyAnimator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPrimitivePropertyAnimator.h; sourceTree = "<group>"; };
7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAnimator.h; sourceTree = "<group>"; };
7266F01822429CFD00833975 /* SVGAnimationAdditiveValueFunctionImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimationAdditiveValueFunctionImpl.cpp; sourceTree = "<group>"; };
+ 7266F02522430F8C00833975 /* SVGValuePropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyList.h; sourceTree = "<group>"; };
+ 7266F0272243109200833975 /* SVGPropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyList.h; sourceTree = "<group>"; };
+ 7266F0282243120300833975 /* SVGAnimationAdditiveListFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveListFunctionImpl.h; sourceTree = "<group>"; };
+ 7266F029224312B100833975 /* SVGAnimationAdditiveListFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveListFunction.h; sourceTree = "<group>"; };
+ 7266F02A2243149B00833975 /* SVGAnimatedPropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyList.h; sourceTree = "<group>"; };
727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTsRGB.cpp; sourceTree = "<group>"; };
727AFED21A2EA6A0000442E8 /* EXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTsRGB.h; sourceTree = "<group>"; };
727AFED31A2EA6A0000442E8 /* EXTsRGB.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTsRGB.idl; sourceTree = "<group>"; };
@@ -9736,8 +9738,6 @@
7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthListValues.h; sourceTree = "<group>"; };
7C39C3681DDB86D300FEFB29 /* SVGNumberListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGNumberListValues.cpp; sourceTree = "<group>"; };
7C39C3691DDB86D300FEFB29 /* SVGNumberListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumberListValues.h; sourceTree = "<group>"; };
- 7C39C36A1DDB871C00FEFB29 /* SVGPointListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPointListValues.cpp; sourceTree = "<group>"; };
- 7C39C36B1DDB871C00FEFB29 /* SVGPointListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPointListValues.h; sourceTree = "<group>"; };
7C39C36C1DDB8BB000FEFB29 /* SVGTransformListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformListValues.cpp; sourceTree = "<group>"; };
7C39C36D1DDB8BB000FEFB29 /* SVGTransformListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformListValues.h; sourceTree = "<group>"; };
7C39C36E1DDBA3E000FEFB29 /* SVGPathSegListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListValues.cpp; sourceTree = "<group>"; };
@@ -16219,6 +16219,7 @@
55EE5356223B29F700FBA944 /* SVGAnimatedPropertyAnimatorImpl.h */,
088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */,
55EE535C223B2A0D00FBA944 /* SVGAnimatedPropertyImpl.h */,
+ 7266F02A2243149B00833975 /* SVGAnimatedPropertyList.h */,
55BE025E223B29C40032F08A /* SVGAnimatedPropertyPairAccessor.h */,
55EE535D223B2A0D00FBA944 /* SVGAnimatedPropertyPairAccessorImpl.h */,
55EE535F223B2A0F00FBA944 /* SVGAnimatedPropertyPairAnimator.h */,
@@ -16229,6 +16230,8 @@
085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */,
721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */,
55BE025F223B29C50032F08A /* SVGAnimationAdditiveFunction.h */,
+ 7266F029224312B100833975 /* SVGAnimationAdditiveListFunction.h */,
+ 7266F0282243120300833975 /* SVGAnimationAdditiveListFunctionImpl.h */,
55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */,
7266F01822429CFD00833975 /* SVGAnimationAdditiveValueFunctionImpl.cpp */,
55BE0259223B29C10032F08A /* SVGAnimationAdditiveValueFunctionImpl.h */,
@@ -16260,6 +16263,7 @@
55DCC5272240750B00C26E32 /* SVGPropertyAccessorImpl.h */,
7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */,
7266F0132241BCE200833975 /* SVGPropertyAnimatorFactory.h */,
+ 7266F0272243109200833975 /* SVGPropertyList.h */,
55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */,
55BE025C223B29C30032F08A /* SVGPropertyOwnerRegistry.h */,
55BE0257223B29C00032F08A /* SVGPropertyRegistry.h */,
@@ -16267,6 +16271,7 @@
088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,
0813A4E91284132600992511 /* SVGStaticPropertyTearOff.h */,
721443462240CAD200F12FF7 /* SVGValueProperty.h */,
+ 7266F02522430F8C00833975 /* SVGValuePropertyList.h */,
);
path = properties;
sourceTree = "<group>";
@@ -24146,8 +24151,6 @@
B22277ED0D00BF1F0071B782 /* SVGAnimatedNumberList.idl */,
0863951313B5FE5700BB344D /* SVGAnimatedPath.cpp */,
0863951413B5FE5700BB344D /* SVGAnimatedPath.h */,
- 43B9336813B261B1004584BF /* SVGAnimatedPointList.cpp */,
- 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */,
B22277F40D00BF1F0071B782 /* SVGAnimatedPreserveAspectRatio.idl */,
B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */,
B22277F60D00BF1F0071B782 /* SVGAnimatedString.idl */,
@@ -24480,8 +24483,6 @@
B22278F40D00BF210071B782 /* SVGPoint.idl */,
B22278F60D00BF210071B782 /* SVGPointList.h */,
B22278F70D00BF210071B782 /* SVGPointList.idl */,
- 7C39C36A1DDB871C00FEFB29 /* SVGPointListValues.cpp */,
- 7C39C36B1DDB871C00FEFB29 /* SVGPointListValues.h */,
B22278F80D00BF210071B782 /* SVGPolyElement.cpp */,
B22278F90D00BF210071B782 /* SVGPolyElement.h */,
B22278FA0D00BF210071B782 /* SVGPolygonElement.cpp */,
@@ -31923,7 +31924,6 @@
08B35B17127B6A88005314DD /* SVGAnimatedNumberList.h in Headers */,
0863951613B5FE5700BB344D /* SVGAnimatedPath.h in Headers */,
089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */,
- 43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */,
088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */,
088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */,
55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */,
Modified: trunk/Source/WebCore/rendering/svg/SVGPathData.cpp (243335 => 243336)
--- trunk/Source/WebCore/rendering/svg/SVGPathData.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/rendering/svg/SVGPathData.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -39,7 +39,7 @@
namespace WebCore {
-static Path pathFromCircleElement(SVGElement& element)
+static Path pathFromCircleElement(const SVGElement& element)
{
ASSERT(is<SVGCircleElement>(element));
@@ -59,7 +59,7 @@
return path;
}
-static Path pathFromEllipseElement(SVGElement& element)
+static Path pathFromEllipseElement(const SVGElement& element)
{
RenderElement* renderer = element.renderer();
if (!renderer)
@@ -82,7 +82,7 @@
return path;
}
-static Path pathFromLineElement(SVGElement& element)
+static Path pathFromLineElement(const SVGElement& element)
{
Path path;
const auto& line = downcast<SVGLineElement>(element);
@@ -93,44 +93,44 @@
return path;
}
-static Path pathFromPathElement(SVGElement& element)
+static Path pathFromPathElement(const SVGElement& element)
{
return downcast<SVGPathElement>(element).pathForByteStream();
}
-static Path pathFromPolygonElement(SVGElement& element)
+static Path pathFromPolygonElement(const SVGElement& element)
{
- auto& points = downcast<SVGPolygonElement>(element).animatedPoints()->values();
+ auto& points = downcast<SVGPolygonElement>(element).points().items();
if (points.isEmpty())
return { };
Path path;
- path.moveTo(points.first());
+ path.moveTo(points.first()->value());
unsigned size = points.size();
for (unsigned i = 1; i < size; ++i)
- path.addLineTo(points.at(i));
+ path.addLineTo(points.at(i)->value());
path.closeSubpath();
return path;
}
-static Path pathFromPolylineElement(SVGElement& element)
+static Path pathFromPolylineElement(const SVGElement& element)
{
- auto& points = downcast<SVGPolylineElement>(element).animatedPoints()->values();
+ auto& points = downcast<SVGPolylineElement>(element).points().items();
if (points.isEmpty())
return { };
Path path;
- path.moveTo(points.first());
+ path.moveTo(points.first()->value());
unsigned size = points.size();
for (unsigned i = 1; i < size; ++i)
- path.addLineTo(points.at(i));
+ path.addLineTo(points.at(i)->value());
return path;
}
-static Path pathFromRectElement(SVGElement& element)
+static Path pathFromRectElement(const SVGElement& element)
{
RenderElement* renderer = element.renderer();
if (!renderer)
@@ -169,11 +169,11 @@
return path;
}
-Path pathFromGraphicsElement(SVGElement* element)
+Path pathFromGraphicsElement(const SVGElement* element)
{
ASSERT(element);
- typedef Path (*PathFromFunction)(SVGElement&);
+ typedef Path (*PathFromFunction)(const SVGElement&);
static HashMap<AtomicStringImpl*, PathFromFunction>* map = 0;
if (!map) {
map = new HashMap<AtomicStringImpl*, PathFromFunction>;
Modified: trunk/Source/WebCore/rendering/svg/SVGPathData.h (243335 => 243336)
--- trunk/Source/WebCore/rendering/svg/SVGPathData.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/rendering/svg/SVGPathData.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -24,6 +24,6 @@
class SVGElement;
class Path;
-Path pathFromGraphicsElement(SVGElement*);
+Path pathFromGraphicsElement(const SVGElement*);
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (243335 => 243336)
--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -271,7 +271,7 @@
writeNameValuePair(ts, "r", element.r().value(lengthContext));
} else if (is<SVGPolyElement>(svgElement)) {
const SVGPolyElement& element = downcast<SVGPolyElement>(svgElement);
- writeNameAndQuotedValue(ts, "points", element.pointList().valueAsString());
+ writeNameAndQuotedValue(ts, "points", element.points().valueAsString());
} else if (is<SVGPathElement>(svgElement)) {
const SVGPathElement& element = downcast<SVGPathElement>(svgElement);
String pathString;
Deleted: trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2011, 2012. 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "SVGAnimatedPointList.h"
-
-#include "SVGAnimateElementBase.h"
-#include "SVGParserUtilities.h"
-#include "SVGPoint.h"
-#include "SVGPointListValues.h"
-
-namespace WebCore {
-
-SVGAnimatedPointListAnimator::SVGAnimatedPointListAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
- : SVGAnimatedTypeAnimator(AnimatedPoints, animationElement, contextElement)
-{
-}
-
-std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::constructFromString(const String& string)
-{
- return SVGAnimatedType::create(SVGPropertyTraits<SVGPointListValues>::fromString(string));
-}
-
-std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- return constructFromBaseValue<SVGAnimatedPointList>(animatedTypes);
-}
-
-void SVGAnimatedPointListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- stopAnimValAnimationForType<SVGAnimatedPointList>(animatedTypes);
-}
-
-void SVGAnimatedPointListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
-{
- resetFromBaseValue<SVGAnimatedPointList>(animatedTypes, type);
-}
-
-void SVGAnimatedPointListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- animValWillChangeForType<SVGAnimatedPointList>(animatedTypes);
-}
-
-void SVGAnimatedPointListAnimator::animValDidChange(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- animValDidChangeForType<SVGAnimatedPointList>(animatedTypes);
-}
-
-void SVGAnimatedPointListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
-{
- ASSERT(from->type() == AnimatedPoints);
- ASSERT(from->type() == to->type());
-
- const auto& fromPointList = from->as<SVGPointListValues>();
- auto& toPointList = to->as<SVGPointListValues>();
-
- unsigned fromPointListSize = fromPointList.size();
- if (!fromPointListSize || fromPointListSize != toPointList.size())
- return;
-
- for (unsigned i = 0; i < fromPointListSize; ++i)
- toPointList[i] += fromPointList[i];
-}
-
-void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
-{
- ASSERT(m_animationElement);
-
- const auto& fromPointList = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGPointListValues>();
- const auto& toPointList = to->as<SVGPointListValues>();
- const auto& toAtEndOfDurationPointList = toAtEndOfDuration->as<SVGPointListValues>();
- auto& animatedPointList = animated->as<SVGPointListValues>();
- if (!m_animationElement->adjustFromToListValues<SVGPointListValues>(fromPointList, toPointList, animatedPointList, percentage))
- return;
-
- unsigned fromPointListSize = fromPointList.size();
- unsigned toPointListSize = toPointList.size();
- unsigned toAtEndOfDurationSize = toAtEndOfDurationPointList.size();
-
- for (unsigned i = 0; i < toPointListSize; ++i) {
- FloatPoint effectiveFrom;
- if (fromPointListSize)
- effectiveFrom = fromPointList[i];
- FloatPoint effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationPointList[i] : FloatPoint();
-
- float animatedX = animatedPointList[i].x();
- float animatedY = animatedPointList[i].y();
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList[i].x(), effectiveToAtEnd.x(), animatedX);
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList[i].y(), effectiveToAtEnd.y(), animatedY);
- animatedPointList[i] = FloatPoint(animatedX, animatedY);
- }
-}
-
-float SVGAnimatedPointListAnimator::calculateDistance(const String&, const String&)
-{
- // FIXME: Distance calculation is not possible for SVGPointListValues right now. We need the distance of for every single value.
- return -1;
-}
-
-}
Deleted: trunk/Source/WebCore/svg/SVGAnimatedPointList.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGAnimatedPointList.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGAnimatedPointList.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,55 +0,0 @@
-/*
- * 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "SVGAnimatedListPropertyTearOff.h"
-#include "SVGAnimatedTypeAnimator.h"
-#include "SVGAttribute.h"
-#include "SVGAttributeAccessor.h"
-#include "SVGPointList.h"
-
-namespace WebCore {
-
-class SVGAnimationElement;
-
-using SVGAnimatedPointList = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
-using SVGAnimatedPointListAttribute = SVGAnimatedAttributeList<SVGAnimatedPointList>;
-
-template<typename OwnerType>
-using SVGAnimatedPointListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPointListAttribute, AnimatedPoints>;
-
-class SVGAnimatedPointListAnimator final : public SVGAnimatedTypeAnimator {
-public:
- SVGAnimatedPointListAnimator(SVGAnimationElement*, SVGElement*);
-
- std::unique_ptr<SVGAnimatedType> constructFromString(const String&) override;
- std::unique_ptr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
- void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
- void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SVGAnimatedType&) override;
- void animValWillChange(const SVGElementAnimatedPropertyList&) override;
- void animValDidChange(const SVGElementAnimatedPropertyList&) override;
-
- void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) override;
- void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) override;
- float calculateDistance(const String& fromString, const String& toString) override;
-};
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGAnimatedType.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGAnimatedType.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -110,8 +110,18 @@
AnimatedPropertyType type() const
{
- ASSERT(m_value.index() >= AnimatedPropertyTypeMin && m_value.index() < AnimatedPropertyTypeMax);
- return static_cast<AnimatedPropertyType>(m_value.index());
+ static AnimatedPropertyType animatedTypes[] = {
+ AnimatedAngle,
+ AnimatedEnumeration,
+ AnimatedLength,
+ AnimatedLengthList,
+ AnimatedNumberList,
+ AnimatedPath,
+ AnimatedTransformList
+ };
+
+ ASSERT(static_cast<size_t>(m_value.index()) < sizeof(animatedTypes) / sizeof(animatedTypes[0]));
+ return animatedTypes[m_value.index()];
}
String valueAsString() const
Modified: trunk/Source/WebCore/svg/SVGAnimatorFactory.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGAnimatorFactory.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGAnimatorFactory.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -25,7 +25,6 @@
#include "SVGAnimatedLengthList.h"
#include "SVGAnimatedNumberList.h"
#include "SVGAnimatedPath.h"
-#include "SVGAnimatedPointList.h"
#include "SVGAnimatedTransformList.h"
namespace WebCore {
@@ -46,6 +45,7 @@
case AnimatedIntegerOptionalInteger:
case AnimatedNumber:
case AnimatedNumberOptionalNumber:
+ case AnimatedPoints:
case AnimatedPreserveAspectRatio:
case AnimatedRect:
case AnimatedString:
@@ -63,8 +63,6 @@
return std::make_unique<SVGAnimatedNumberListAnimator>(animationElement, contextElement);
case AnimatedPath:
return std::make_unique<SVGAnimatedPathAnimator>(animationElement, contextElement);
- case AnimatedPoints:
- return std::make_unique<SVGAnimatedPointListAnimator>(animationElement, contextElement);
case AnimatedTransformList:
return std::make_unique<SVGAnimatedTransformListAnimator>(animationElement, contextElement);
case AnimatedUnknown:
Modified: trunk/Source/WebCore/svg/SVGParserUtilities.cpp (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGParserUtilities.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGParserUtilities.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -25,7 +25,6 @@
#include "Document.h"
#include "FloatRect.h"
-#include "SVGPointListValues.h"
#include <limits>
#include <wtf/ASCIICType.h>
#include <wtf/text/StringView.h>
@@ -260,40 +259,6 @@
return valid;
}
-bool pointsListFromSVGData(SVGPointListValues& pointsList, const String& points)
-{
- if (points.isEmpty())
- return true;
- auto upconvertedCharacters = StringView(points).upconvertedCharacters();
- const UChar* cur = upconvertedCharacters;
- const UChar* end = cur + points.length();
-
- skipOptionalSVGSpaces(cur, end);
-
- bool delimParsed = false;
- while (cur < end) {
- delimParsed = false;
- float xPos = 0.0f;
- if (!parseNumber(cur, end, xPos))
- return false;
-
- float yPos = 0.0f;
- if (!parseNumber(cur, end, yPos, false))
- return false;
-
- skipOptionalSVGSpaces(cur, end);
-
- if (cur < end && *cur == ',') {
- delimParsed = true;
- cur++;
- }
- skipOptionalSVGSpaces(cur, end);
-
- pointsList.append(FloatPoint(xPos, yPos));
- }
- return cur == end && !delimParsed;
-}
-
bool parseGlyphName(const String& input, HashSet<String>& values)
{
// FIXME: Parsing error detection is missing.
Modified: trunk/Source/WebCore/svg/SVGParserUtilities.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGParserUtilities.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGParserUtilities.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -32,7 +32,6 @@
class FloatPoint;
class FloatRect;
-class SVGPointListValues;
template <typename CharacterType>
bool parseSVGNumber(CharacterType* ptr, size_t length, double& number);
@@ -82,7 +81,6 @@
return ptr < end;
}
-bool pointsListFromSVGData(SVGPointListValues&, const String& points);
Vector<String> parseDelimitedString(const String& input, const char seperator);
bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList);
bool parseGlyphName(const String& input, HashSet<String>& values);
Modified: trunk/Source/WebCore/svg/SVGPoint.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPoint.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPoint.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Samsung Electronics. All rights reserved.
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,87 +28,70 @@
#include "FloatPoint.h"
#include "SVGMatrix.h"
-#include "SVGPropertyTearOff.h"
+#include "SVGValueProperty.h"
namespace WebCore {
-class SVGPoint : public SVGPropertyTearOff<FloatPoint> {
+class SVGPoint : public SVGValueProperty<FloatPoint> {
+ using Base = SVGValueProperty<FloatPoint>;
+ using Base::Base;
+ using Base::m_value;
+
public:
- static Ref<SVGPoint> create(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
+ static Ref<SVGPoint> create(const FloatPoint& value = { })
{
- return adoptRef(*new SVGPoint(animatedProperty, role, value));
+ return adoptRef(*new SVGPoint(value));
}
- static Ref<SVGPoint> create(const FloatPoint& initialValue = { })
+ template<typename T>
+ static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& value)
{
- return adoptRef(*new SVGPoint(initialValue));
+ if (value.hasException())
+ return value.releaseException();
+ return adoptRef(*new SVGPoint(value.releaseReturnValue()));
}
- template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
+ Ref<SVGPoint> clone() const
{
- if (initialValue.hasException())
- return initialValue.releaseException();
- return create(initialValue.releaseReturnValue());
+ return SVGPoint::create(m_value);
}
+
+ float x() { return m_value.x(); }
- float x()
+ ExceptionOr<void> setX(float x)
{
- return propertyReference().x();
- }
-
- ExceptionOr<void> setX(float xValue)
- {
if (isReadOnly())
return Exception { NoModificationAllowedError };
- propertyReference().setX(xValue);
+ m_value.setX(x);
commitChange();
return { };
}
- float y()
- {
- return propertyReference().y();
- }
+ float y() { return m_value.y(); }
- ExceptionOr<void> setY(float xValue)
+ ExceptionOr<void> setY(float y)
{
if (isReadOnly())
return Exception { NoModificationAllowedError };
- propertyReference().setY(xValue);
+ m_value.setY(y);
commitChange();
-
return { };
}
- ExceptionOr<Ref<SVGPoint>> matrixTransform(SVGMatrix& matrix)
+ Ref<SVGPoint> matrixTransform(SVGMatrix& matrix) const
{
- if (isReadOnly())
- return Exception { NoModificationAllowedError };
-
- auto newPoint = propertyReference().matrixTransform(matrix.propertyReference());
- commitChange();
-
- return SVGPoint::create(newPoint);
+ auto newPoint = m_value.matrixTransform(matrix.propertyReference());
+ return adoptRef(*new SVGPoint(newPoint));
}
-protected:
- SVGPoint(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
- : SVGPropertyTearOff<FloatPoint>(&animatedProperty, role, value)
+private:
+ String valueAsString() const override
{
+ return SVGPropertyTraits<FloatPoint>::toString(m_value);
}
-
- SVGPoint(SVGPropertyRole role, FloatPoint& value)
- : SVGPropertyTearOff<FloatPoint>(nullptr, role, value)
- {
- }
-
- explicit SVGPoint(const FloatPoint& initialValue)
- : SVGPropertyTearOff<FloatPoint>(initialValue)
- {
- }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGPoint.idl (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPoint.idl 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPoint.idl 2019-03-21 22:21:58 UTC (rev 243336)
@@ -26,6 +26,6 @@
attribute unrestricted float x;
attribute unrestricted float y;
- [MayThrowException, NewObject] SVGPoint matrixTransform(SVGMatrix matrix);
+ [NewObject] SVGPoint matrixTransform(SVGMatrix matrix);
};
Modified: trunk/Source/WebCore/svg/SVGPointList.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPointList.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPointList.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,28 +25,81 @@
#pragma once
-#include "SVGAnimatedListPropertyTearOff.h"
-#include "SVGListPropertyTearOff.h"
#include "SVGPoint.h"
-#include "SVGPointListValues.h"
+#include "SVGValuePropertyList.h"
namespace WebCore {
-class SVGPointList : public SVGListPropertyTearOff<SVGPointListValues> {
+class SVGPointList : public SVGValuePropertyList<SVGPoint> {
+ using Base = SVGValuePropertyList<SVGPoint>;
+ using Base::Base;
+
public:
- using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
- using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
+ static Ref<SVGPointList> create()
+ {
+ return adoptRef(*new SVGPointList());
+ }
- static Ref<SVGPointList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
+ static Ref<SVGPointList> create(SVGPropertyOwner* owner, SVGPropertyAccess access)
{
- return adoptRef(*new SVGPointList(animatedProperty, role, values, wrappers));
+ return adoptRef(*new SVGPointList(owner, access));
}
-private:
- SVGPointList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
- : SVGListPropertyTearOff<SVGPointListValues>(animatedProperty, role, values, wrappers)
+ static Ref<SVGPointList> create(const SVGPointList& other, SVGPropertyAccess access)
{
+ return adoptRef(*new SVGPointList(other, access));
}
+
+ bool parse(const String& value)
+ {
+ clearItems();
+
+ auto upconvertedCharacters = StringView(value).upconvertedCharacters();
+ const UChar* cur = upconvertedCharacters;
+ const UChar* end = cur + value.length();
+
+ skipOptionalSVGSpaces(cur, end);
+
+ bool delimParsed = false;
+ while (cur < end) {
+ delimParsed = false;
+ float xPos = 0.0f;
+ if (!parseNumber(cur, end, xPos))
+ return false;
+
+ float yPos = 0.0f;
+ if (!parseNumber(cur, end, yPos, false))
+ return false;
+
+ skipOptionalSVGSpaces(cur, end);
+
+ if (cur < end && *cur == ',') {
+ delimParsed = true;
+ cur++;
+ }
+ skipOptionalSVGSpaces(cur, end);
+
+ append(SVGPoint::create({ xPos, yPos }));
+ }
+
+ return !delimParsed;
+ }
+
+ String valueAsString() const override
+ {
+ StringBuilder builder;
+
+ for (const auto& point : m_items) {
+ if (builder.length())
+ builder.append(' ');
+
+ builder.appendNumber(point->x());
+ builder.append(' ');
+ builder.appendNumber(point->y());
+ }
+
+ return builder.toString();
+ }
};
-} // namespace WebCore
+}
Deleted: trunk/Source/WebCore/svg/SVGPointListValues.cpp (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPointListValues.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPointListValues.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <[email protected]>
- * Copyright (C) 2004, 2005 Rob Buis <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "SVGPointListValues.h"
-
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String SVGPointListValues::valueAsString() const
-{
- StringBuilder builder;
-
- unsigned size = this->size();
- for (unsigned i = 0; i < size; ++i) {
- if (i > 0)
- builder.append(' '); // FIXME: Shouldn't we use commas to seperate?
-
- const auto& point = at(i);
- builder.appendFixedPrecisionNumber(point.x());
- builder.append(' ');
- builder.appendFixedPrecisionNumber(point.y());
- }
-
- return builder.toString();
-}
-
-}
Deleted: trunk/Source/WebCore/svg/SVGPointListValues.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPointListValues.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPointListValues.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <[email protected]>
- * Copyright (C) 2004, 2005 Rob Buis <[email protected]>
- * 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "FloatPoint.h"
-#include "SVGPropertyTraits.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class SVGPoint;
-class SVGPointList;
-
-class SVGPointListValues final : public Vector<FloatPoint> {
-public:
- String valueAsString() const;
-};
-
-template<>
-struct SVGPropertyTraits<SVGPointListValues> {
- static SVGPointListValues initialValue() { return { }; }
- static SVGPointListValues fromString(const String& string)
- {
- SVGPointListValues list;
- pointsListFromSVGData(list, string);
- return list;
- }
- static Optional<SVGPointListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; }
- static String toString(const SVGPointListValues& list) { return list.valueAsString(); }
-
- using ListItemType = FloatPoint;
- using ListItemTearOff = SVGPoint;
- using ListPropertyTearOff = SVGPointList;
-};
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGPolyElement.cpp (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPolyElement.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPolyElement.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <[email protected]>
* Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <[email protected]>
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 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
@@ -37,28 +37,17 @@
: SVGGeometryElement(tagName, document)
, SVGExternalResourcesRequired(this)
{
- registerAttributes();
+ static std::once_flag onceFlag;
+ std::call_once(onceFlag, [] {
+ PropertyRegistry::registerProperty<SVGNames::pointsAttr, &SVGPolyElement::m_points>();
+ });
}
-void SVGPolyElement::registerAttributes()
-{
- auto& registry = attributeRegistry();
- if (!registry.isEmpty())
- return;
- registry.registerAttribute<SVGNames::pointsAttr, &SVGPolyElement::m_points>();
-}
-
void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == SVGNames::pointsAttr) {
- SVGPointListValues newList;
- if (!pointsListFromSVGData(newList, value))
+ if (!m_points->baseVal()->parse(value))
document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\"");
-
- if (auto wrapper = static_pointer_cast<SVGAnimatedPointList>(lookupAnimatedProperty(m_points)))
- wrapper->detachListWrappers(newList.size());
-
- m_points.setValue(WTFMove(newList));
return;
}
@@ -81,21 +70,9 @@
SVGExternalResourcesRequired::svgAttributeChanged(attrName);
}
-Ref<SVGPointList> SVGPolyElement::points()
-{
- m_points.setShouldSynchronize(true);
- return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->baseVal();
-}
-
-Ref<SVGPointList> SVGPolyElement::animatedPoints()
-{
- m_points.setShouldSynchronize(true);
- return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->animVal();
-}
-
size_t SVGPolyElement::approximateMemoryCost() const
{
- size_t pointsCost = pointList().size() * sizeof(FloatPoint);
+ size_t pointsCost = m_points->baseVal()->items().size() * sizeof(FloatPoint);
// We need to account for the memory which is allocated by the RenderSVGPath::m_path.
return sizeof(*this) + (renderer() ? pointsCost * 2 + sizeof(RenderSVGPath) : pointsCost);
}
Modified: trunk/Source/WebCore/svg/SVGPolyElement.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGPolyElement.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGPolyElement.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -21,7 +21,6 @@
#pragma once
-#include "SVGAnimatedPointList.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGGeometryElement.h"
#include "SVGNames.h"
@@ -31,10 +30,10 @@
class SVGPolyElement : public SVGGeometryElement, public SVGExternalResourcesRequired {
WTF_MAKE_ISO_ALLOCATED(SVGPolyElement);
public:
- Ref<SVGPointList> points();
- Ref<SVGPointList> animatedPoints();
+ const SVGPointList& points() const { return m_points->currentValue(); }
- const SVGPointListValues& pointList() const { return m_points.value(); }
+ SVGPointList& points() { return m_points->baseVal(); }
+ SVGPointList& animatedPoints() { return *m_points->animVal(); }
size_t approximateMemoryCost() const override;
@@ -43,8 +42,6 @@
private:
using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>;
- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
- static void registerAttributes();
const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
using PropertyRegistry = SVGPropertyOwnerRegistry<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>;
@@ -63,7 +60,7 @@
AttributeOwnerProxy m_attributeOwnerProxy { *this };
PropertyRegistry m_propertyRegistry { *this };
- SVGAnimatedPointListAttribute m_points;
+ Ref<SVGAnimatedPointList> m_points { SVGAnimatedPointList::create(this) };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2019-03-21 22:21:58 UTC (rev 243336)
@@ -171,16 +171,11 @@
frame->setPageZoomFactor(scale);
}
-Ref<SVGPoint> SVGSVGElement::currentTranslate()
-{
- return SVGStaticPropertyTearOff<SVGSVGElement, SVGPoint>::create(*this, m_currentTranslate, &SVGSVGElement::updateCurrentTranslate);
-}
-
void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
{
- if (m_currentTranslate == translation)
+ if (m_currentTranslate->value() == translation)
return;
- m_currentTranslate = translation;
+ m_currentTranslate->setValue(translation);
updateCurrentTranslate();
}
Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGSVGElement.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <[email protected]>
* Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <[email protected]>
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 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
@@ -61,8 +61,8 @@
float currentScale() const;
void setCurrentScale(float);
- Ref<SVGPoint> currentTranslate();
- FloatPoint currentTranslateValue() { return m_currentTranslate; }
+ SVGPoint& currentTranslate() { return m_currentTranslate; }
+ FloatPoint currentTranslateValue() const { return m_currentTranslate->value(); }
unsigned suspendRedraw(unsigned maxWaitMilliseconds);
void unsuspendRedraw(unsigned suspendHandleId);
@@ -106,7 +106,7 @@
SMILTimeContainer& timeContainer() { return m_timeContainer.get(); }
void setCurrentTranslate(const FloatPoint&); // Used to pan.
- void updateCurrentTranslate(); // Used from DOM bindings to create an SVGStaticPropertyTearOff for currentTranslate.
+ void updateCurrentTranslate();
bool hasIntrinsicWidth() const;
bool hasIntrinsicHeight() const;
@@ -169,10 +169,11 @@
bool m_useCurrentView { false };
Ref<SMILTimeContainer> m_timeContainer;
- FloatPoint m_currentTranslate;
RefPtr<SVGViewSpec> m_viewSpec;
String m_currentViewFragmentIdentifier;
+ Ref<SVGPoint> m_currentTranslate { SVGPoint::create() };
+
AttributeOwnerProxy m_attributeOwnerProxy { *this };
PropertyRegistry m_propertyRegistry { *this };
SVGAnimatedLengthAttribute m_x { LengthModeWidth };
Modified: trunk/Source/WebCore/svg/SVGSVGElement.idl (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGSVGElement.idl 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGSVGElement.idl 2019-03-21 22:21:58 UTC (rev 243336)
@@ -42,7 +42,7 @@
readonly attribute boolean useCurrentView;
readonly attribute SVGViewSpec currentView;
attribute unrestricted float currentScale;
- [NewObject] readonly attribute SVGPoint currentTranslate;
+ readonly attribute SVGPoint currentTranslate;
unsigned long suspendRedraw(optional unsigned long maxWaitMilliseconds = 0);
void unsuspendRedraw(optional unsigned long suspendHandleId = 0);
Modified: trunk/Source/WebCore/svg/SVGValue.h (243335 => 243336)
--- trunk/Source/WebCore/svg/SVGValue.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/SVGValue.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -33,7 +33,6 @@
#include "SVGMarkerTypes.h"
#include "SVGNumberListValues.h"
#include "SVGPathByteStream.h"
-#include "SVGPointListValues.h"
#include "SVGPreserveAspectRatioValue.h"
#include "SVGPropertyTraits.h"
#include "SVGTransformListValues.h"
@@ -44,21 +43,11 @@
using SVGValueVariant = Variant<
std::pair<SVGAngleValue, unsigned>*,
- bool*,
- Color*,
unsigned*,
- int*,
- std::pair<int, int>*,
SVGLengthValue*,
SVGLengthListValues*,
- float*,
SVGNumberListValues*,
- std::pair<float, float>*,
SVGPathByteStream*,
- SVGPointListValues*,
- SVGPreserveAspectRatioValue*,
- FloatRect*,
- String*,
SVGTransformListValues*
>;
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h (243335 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -99,6 +99,28 @@
};
template<typename OwnerType>
+class SVGAnimatedPointListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPointList> {
+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPointList>;
+ using Base::property;
+
+public:
+ using Base::Base;
+ template<Ref<SVGAnimatedPointList> OwnerType::*property>
+ constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPointListAccessor, property>(); }
+
+private:
+ std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+ {
+ return SVGAnimatedPointListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
+ }
+
+ void appendAnimatedInstance(OwnerType& owner, SVGAttributeAnimator& animator) const final
+ {
+ static_cast<SVGAnimatedPointListAnimator&>(animator).appendAnimatedInstance(property(owner));
+ }
+};
+
+template<typename OwnerType>
class SVGAnimatedPreserveAspectRatioAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPreserveAspectRatio> {
using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPreserveAspectRatio>;
using Base::property;
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h (243335 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -27,6 +27,7 @@
#include "SVGAnimatedPropertyAnimator.h"
#include "SVGAnimatedPropertyImpl.h"
+#include "SVGAnimationAdditiveListFunctionImpl.h"
#include "SVGAnimationAdditiveValueFunctionImpl.h"
#include "SVGAnimationDiscreteFunctionImpl.h"
@@ -95,6 +96,23 @@
}
};
+class SVGAnimatedPointListAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedPointList, SVGAnimationPointListFunction> {
+ using Base = SVGAnimatedPropertyAnimator<SVGAnimatedPointList, SVGAnimationPointListFunction>;
+ using Base::Base;
+
+public:
+ static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPointList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+ {
+ return std::unique_ptr<SVGAnimatedPointListAnimator>(new SVGAnimatedPointListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
+ }
+
+private:
+ void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
+ {
+ m_function.progress(targetElement, percentage, repeatCount, m_animated->animVal());
+ }
+};
+
class SVGAnimatedPreserveAspectRatioAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedPreserveAspectRatio, SVGAnimationPreserveAspectRatioFunction> {
using Base = SVGAnimatedPropertyAnimator<SVGAnimatedPreserveAspectRatio, SVGAnimationPreserveAspectRatioFunction>;
using Base::Base;
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h (243335 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -30,10 +30,11 @@
#include "SVGAnimatedLength.h"
#include "SVGAnimatedLengthList.h"
#include "SVGAnimatedNumberList.h"
-#include "SVGAnimatedPointList.h"
#include "SVGAnimatedPrimitiveProperty.h"
+#include "SVGAnimatedPropertyList.h"
#include "SVGAnimatedTransformList.h"
#include "SVGAnimatedValueProperty.h"
+#include "SVGPointList.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGRect.h"
@@ -47,4 +48,6 @@
using SVGAnimatedRect = SVGAnimatedValueProperty<SVGRect>;
using SVGAnimatedPreserveAspectRatio = SVGAnimatedValueProperty<SVGPreserveAspectRatio>;
+using SVGAnimatedPointList = SVGAnimatedPropertyList<SVGPointList>;
+
}
Added: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h (0 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2019 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 "SVGAnimatedProperty.h"
+
+namespace WebCore {
+
+template<typename ListType>
+class SVGAnimatedPropertyList : public SVGAnimatedProperty {
+public:
+ template<typename... Arguments>
+ static Ref<SVGAnimatedPropertyList> create(SVGElement* contextElement, Arguments&&... arguments)
+ {
+ return adoptRef(*new SVGAnimatedPropertyList(contextElement, std::forward<Arguments>(arguments)...));
+ }
+
+ ~SVGAnimatedPropertyList()
+ {
+ m_baseVal->detach();
+ if (m_animVal)
+ m_animVal->detach();
+ }
+
+ // Used by the DOM.
+ const Ref<ListType>& baseVal() const { return m_baseVal; }
+
+ // Used by SVGElement::parseAttribute().
+ Ref<ListType>& baseVal() { return m_baseVal; }
+
+ // Used by the DOM.
+ const RefPtr<ListType>& animVal() const { return const_cast<SVGAnimatedPropertyList*>(this)->ensureAnimVal(); }
+
+ // Called by SVGAnimatedPropertyAnimator to pass the animVal to the SVGAnimationFunction::progress.
+ RefPtr<ListType>& animVal() { return ensureAnimVal(); }
+
+ // Used when committing a change from the SVGAnimatedProperty to the attribute.
+ String baseValAsString() const override { return m_baseVal->valueAsString(); }
+
+ // Used to apply the SVGAnimator change to the target element.
+ String animValAsString() const override
+ {
+ ASSERT(isAnimating());
+ return m_animVal->valueAsString();
+ }
+
+ // Managing the relationship with the owner.
+ void setDirty() override { m_baseVal->setDirty(); }
+ bool isDirty() const override { return m_baseVal->isDirty(); }
+ Optional<String> synchronize() override { return m_baseVal->synchronize(); }
+
+ // Used by RenderSVGElements and DumpRenderTree.
+ const ListType& currentValue() const
+ {
+ ASSERT_IMPLIES(isAnimating(), m_animVal);
+ return isAnimating() ? *m_animVal : m_baseVal.get();
+ }
+
+ // Controlling the animation.
+ void startAnimation() override
+ {
+ if (m_animVal)
+ *m_animVal = m_baseVal;
+ else
+ ensureAnimVal();
+ SVGAnimatedProperty::startAnimation();
+ }
+
+ void stopAnimation() override
+ {
+ if (m_animVal)
+ *m_animVal = m_baseVal;
+ SVGAnimatedProperty::stopAnimation();
+ }
+
+ // Controlling the instance animation.
+ void instanceStartAnimation(SVGAnimatedProperty& animated) override
+ {
+ m_animVal = static_cast<SVGAnimatedPropertyList&>(animated).animVal();
+ SVGAnimatedProperty::instanceStartAnimation(animated);
+ }
+
+ void instanceStopAnimation() override
+ {
+ m_animVal = nullptr;
+ SVGAnimatedProperty::instanceStopAnimation();
+ }
+
+protected:
+ template<typename... Arguments>
+ SVGAnimatedPropertyList(SVGElement* contextElement, Arguments&&... arguments)
+ : SVGAnimatedProperty(contextElement)
+ , m_baseVal(ListType::create(this, SVGPropertyAccess::ReadWrite, std::forward<Arguments>(arguments)...))
+ {
+ }
+
+ RefPtr<ListType>& ensureAnimVal()
+ {
+ if (!m_animVal)
+ m_animVal = ListType::create(m_baseVal, SVGPropertyAccess::ReadOnly);
+ return m_animVal;
+ }
+
+ // Called when m_baseVal changes or an item in m_baseVal changes.
+ void commitPropertyChange(SVGProperty* property) override
+ {
+ if (m_animVal)
+ *m_animVal = m_baseVal;
+ SVGAnimatedProperty::commitPropertyChange(property);
+ }
+
+ Ref<ListType> m_baseVal;
+ mutable RefPtr<ListType> m_animVal;
+};
+
+}
Added: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunction.h (0 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunction.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunction.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 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 "SVGAnimationAdditiveFunction.h"
+
+namespace WebCore {
+
+template<typename ListType>
+class SVGAnimationAdditiveListFunction : public SVGAnimationAdditiveFunction {
+public:
+ template<typename... Arguments>
+ SVGAnimationAdditiveListFunction(AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, Arguments&&... arguments)
+ : SVGAnimationAdditiveFunction(animationMode, calcMode, isAccumulated, isAdditive)
+ , m_from(ListType::create(std::forward<Arguments>(arguments)...))
+ , m_to(ListType::create(std::forward<Arguments>(arguments)...))
+ , m_toAtEndOfDuration(ListType::create(std::forward<Arguments>(arguments)...))
+ {
+ }
+
+protected:
+ const Ref<ListType>& toAtEndOfDuration() const { return !m_toAtEndOfDuration->isEmpty() ? m_toAtEndOfDuration : m_to; }
+
+ bool adjustAnimatedList(AnimationMode animationMode, float percentage, RefPtr<ListType>& animated, bool resizeAnimatedIfNeeded = true)
+ {
+ if (!m_to->numberOfItems())
+ return false;
+
+ if (m_from->numberOfItems() && m_from->size() != m_to->size()) {
+ if (percentage >= 0.5)
+ *animated = m_to;
+ else if (animationMode != AnimationMode::To)
+ *animated = m_from;
+ return false;
+ }
+
+ if (resizeAnimatedIfNeeded && animated->size() < m_to->size())
+ animated->resize(m_to->size());
+ return true;
+ }
+
+ Ref<ListType> m_from;
+ Ref<ListType> m_to;
+ Ref<ListType> m_toAtEndOfDuration;
+};
+
+}
Added: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h (0 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2019 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 "SVGAnimationAdditiveListFunction.h"
+#include "SVGPointList.h"
+
+namespace WebCore {
+
+class SVGElement;
+
+class SVGAnimationPointListFunction : public SVGAnimationAdditiveListFunction<SVGPointList> {
+public:
+ using Base = SVGAnimationAdditiveListFunction<SVGPointList>;
+ using Base::Base;
+
+ void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ {
+ m_from->parse(from);
+ m_to->parse(to);
+ }
+
+ void setToAtEndOfDurationValue(const String& toAtEndOfDuration) override
+ {
+ m_toAtEndOfDuration->parse(toAtEndOfDuration);
+ }
+
+ void progress(SVGElement*, float percentage, unsigned repeatCount, RefPtr<SVGPointList>& animated)
+ {
+ if (!adjustAnimatedList(m_animationMode, percentage, animated))
+ return;
+
+ const Vector<Ref<SVGPoint>>& fromItems = m_animationMode == AnimationMode::To ? animated->items() : m_from->items();
+ const Vector<Ref<SVGPoint>>& toItems = m_to->items();
+ const Vector<Ref<SVGPoint>>& toAtEndOfDurationItems = toAtEndOfDuration()->items();
+ Vector<Ref<SVGPoint>>& animatedItems = animated->items();
+
+ for (unsigned i = 0; i < toItems.size(); ++i) {
+ FloatPoint from = i < fromItems.size() ? fromItems[i]->value() : FloatPoint();
+ FloatPoint to = toItems[i]->value();
+ FloatPoint toAtEndOfDuration = i < toAtEndOfDurationItems.size() ? toAtEndOfDurationItems[i]->value() : FloatPoint();
+ FloatPoint& animated = animatedItems[i]->value();
+
+ float animatedX = Base::progress(percentage, repeatCount, from.x(), to.x(), toAtEndOfDuration.x(), animated.x());
+ float animatedY = Base::progress(percentage, repeatCount, from.y(), to.y(), toAtEndOfDuration.y(), animated.y());
+
+ animated = { animatedX, animatedY };
+ }
+ }
+
+private:
+ void addFromAndToValues(SVGElement*) override
+ {
+ const Vector<Ref<SVGPoint>>& fromItems = m_from->items();
+ Vector<Ref<SVGPoint>>& toItems = m_to->items();
+
+ if (!fromItems.size() || fromItems.size() != toItems.size())
+ return;
+
+ for (unsigned i = 0; i < fromItems.size(); ++i)
+ toItems[i]->setValue(fromItems[i]->value() + toItems[i]->value());
+ }
+};
+
+}
Modified: trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h (243335 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -29,7 +29,6 @@
#include "SVGAnimatedLength.h"
#include "SVGAnimatedLengthList.h"
#include "SVGAnimatedNumberList.h"
-#include "SVGAnimatedPointList.h"
#include "SVGAnimatedTransformList.h"
#include "SVGAttributeAccessor.h"
#include "SVGLegacyAnimatedProperty.h"
@@ -78,12 +77,6 @@
registerAttribute(SVGAnimatedNumberListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
}
- template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedPointListAttribute OwnerType::*attribute>
- void registerAttribute()
- {
- registerAttribute(SVGAnimatedPointListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
- }
-
template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedTransformListAttribute OwnerType::*attribute>
void registerAttribute()
{
Added: trunk/Source/WebCore/svg/properties/SVGPropertyList.h (0 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGPropertyList.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyList.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2018-2019 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 "SVGList.h"
+
+namespace WebCore {
+
+template<typename PropertyType>
+class SVGPropertyList : public SVGList<Ref<PropertyType>>, public SVGPropertyOwner {
+public:
+ using BaseList = SVGList<Ref<PropertyType>>;
+ using BaseList::isEmpty;
+ using BaseList::size;
+ using BaseList::append;
+
+protected:
+ using SVGPropertyOwner::SVGPropertyOwner;
+ using BaseList::m_items;
+ using BaseList::m_access;
+ using BaseList::m_owner;
+
+ SVGPropertyList(SVGPropertyOwner* owner = nullptr, SVGPropertyAccess access = SVGPropertyAccess::ReadWrite)
+ : BaseList(owner, access)
+ {
+ }
+
+ ~SVGPropertyList()
+ {
+ // Detach the items from the list before it is deleted.
+ detachItems();
+ }
+
+ void detachItems() override
+ {
+ for (auto& item : m_items)
+ item->detach();
+ }
+
+ SVGPropertyOwner* owner() const override { return m_owner; }
+
+ void commitPropertyChange(SVGProperty*) override
+ {
+ if (owner())
+ owner()->commitPropertyChange(this);
+ }
+
+ Ref<PropertyType> at(unsigned index) const override
+ {
+ ASSERT(index < size());
+ return m_items.at(index).copyRef();
+ }
+
+ Ref<PropertyType> insert(unsigned index, Ref<PropertyType>&& newItem) override
+ {
+ ASSERT(index <= size());
+
+ // Spec: if newItem is not a detached object, then set newItem to be
+ // a clone object of newItem.
+ if (newItem->isAttached())
+ newItem = newItem->clone();
+
+ // Spec: Attach newItem to the list object.
+ newItem->attach(this, m_access);
+ m_items.insert(index, WTFMove(newItem));
+ return at(index);
+ }
+
+ Ref<PropertyType> replace(unsigned index, Ref<PropertyType>&& newItem) override
+ {
+ ASSERT(index < size());
+ Ref<PropertyType>& item = m_items[index];
+
+ // Spec: Detach item.
+ item->detach();
+
+ // Spec: if newItem is not a detached object, then set newItem to be
+ // a clone object of newItem.
+ if (newItem->isAttached())
+ item = newItem->clone();
+ else
+ item = WTFMove(newItem);
+
+ // Spec: Attach newItem to the list object.
+ item->attach(this, m_access);
+ return at(index);
+ }
+
+ Ref<PropertyType> remove(unsigned index) override
+ {
+ ASSERT(index < size());
+ Ref<PropertyType> item = at(index);
+
+ // Spec: Detach item.
+ item->detach();
+ m_items.remove(index);
+ return WTFMove(item);
+ }
+
+ Ref<PropertyType> append(Ref<PropertyType>&& newItem) override
+ {
+ // Spec: if newItem is not a detached object, then set newItem to be
+ // a clone object of newItem.
+ if (newItem->isAttached())
+ newItem = newItem->clone();
+
+ // Spec: Attach newItem to the list object.
+ newItem->attach(this, m_access);
+ m_items.append(WTFMove(newItem));
+ return at(size() - 1);
+ }
+};
+
+}
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h (243335 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h 2019-03-21 22:04:56 UTC (rev 243335)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -67,6 +67,12 @@
registerProperty(attributeName, SVGAnimatedNumberAccessor<OwnerType>::template singleton<property>());
}
+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedPointList> OwnerType::*property>
+ static void registerProperty()
+ {
+ registerProperty(attributeName, SVGAnimatedPointListAccessor<OwnerType>::template singleton<property>());
+ }
+
template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedPreserveAspectRatio> OwnerType::*property>
static void registerProperty()
{
Added: trunk/Source/WebCore/svg/properties/SVGValuePropertyList.h (0 => 243336)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyList.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyList.h 2019-03-21 22:21:58 UTC (rev 243336)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2018-2019 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 "SVGPropertyList.h"
+
+namespace WebCore {
+
+template<typename PropertyType>
+class SVGValuePropertyList : public SVGPropertyList<PropertyType> {
+public:
+ using Base = SVGPropertyList<PropertyType>;
+ using Base::clearItems;
+ using Base::items;
+ using Base::size;
+
+ SVGValuePropertyList& operator=(const SVGValuePropertyList& other)
+ {
+ clearItems();
+ for (const auto& item : other.items())
+ append(PropertyType::create(item->value()));
+ return *this;
+ }
+
+ // This casting operator returns a Vector of the underlying ValueType,
+ // for example Vector<float> from SVGNumberList.
+ operator Vector<typename PropertyType::ValueType>() const
+ {
+ Vector<typename PropertyType::ValueType> values;
+ for (const auto& item : items())
+ values.append(item->value());
+ return values;
+ }
+
+ void resize(size_t newSize)
+ {
+ // Add new items.
+ while (size() < newSize)
+ append(PropertyType::create());
+
+ // Remove existing items.
+ while (size() > newSize)
+ remove(size() - 1);
+ }
+
+protected:
+ using Base::append;
+ using Base::remove;
+
+ // Base and default constructor. Do not use "using Base::Base" because of Windows and GTK ports.
+ SVGValuePropertyList(SVGPropertyOwner* owner = nullptr, SVGPropertyAccess access = SVGPropertyAccess::ReadWrite)
+ : Base(owner, access)
+ {
+ }
+
+ // Used by SVGAnimatedPropertyList when creating it animVal from baseVal.
+ SVGValuePropertyList(const SVGValuePropertyList& other, SVGPropertyAccess access = SVGPropertyAccess::ReadWrite)
+ : Base(other.owner(), access)
+ {
+ // Clone all items.
+ for (const auto& item : other.items())
+ append(PropertyType::create(item->value()));
+ }
+};
+
+}