Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: Source/core/svg/SVGTransformList.cpp

Issue 1177303004: Updated SVGListPropertyHelper as per SVG2 Spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGTransformList.cpp
diff --git a/Source/core/svg/SVGTransformList.cpp b/Source/core/svg/SVGTransformList.cpp
index 652fa55f04f36a2bd0c0d6af9d1951d37fdcd6a6..6e17b4f599995bb274759304ab0c9bc5e0c94f44 100644
--- a/Source/core/svg/SVGTransformList.cpp
+++ b/Source/core/svg/SVGTransformList.cpp
@@ -351,4 +351,52 @@ float SVGTransformList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase
return SVGTransformDistance(at(0), toList->at(0)).distance();
}
+PassRefPtrWillBeRawPtr<SVGTransform>SVGTransformList::initialize(PassRefPtrWillBeRawPtr<SVGTransform> passNewItem)
+{
+ RefPtrWillBeRawPtr<SVGTransform> newItem = passNewItem;
+
+ // SVG2-Draft Spec: If newItem is already in a list, then a new SVGTransform object is created with the same values as newItem and this item is inserted into the list.
+ // Otherwise, newItem itself is inserted into the list.
+ if (newItem->ownerList())
+ return Base::initialize(newItem->clone());
+
+ return Base::initialize(newItem);
+}
+
+PassRefPtrWillBeRawPtr<SVGTransform> SVGTransformList::appendItem(PassRefPtrWillBeRawPtr<SVGTransform> passNewItem)
+{
+ RefPtrWillBeRawPtr<SVGTransform> newItem = passNewItem;
+
+ // SVG2-Draft Spec: If newItem is already in a list, then a new SVGTransform object is created with the same values as newItem and this item is inserted into the list.
+ // Otherwise, newItem itself is inserted into the list.
+ if (newItem->ownerList())
+ return Base::appendItem(newItem->clone());
+
+ return Base::appendItem(newItem);
+}
+
+PassRefPtrWillBeRawPtr<SVGTransform> SVGTransformList::insertItemBefore(PassRefPtrWillBeRawPtr<SVGTransform> passNewItem, size_t index)
+{
+ RefPtrWillBeRawPtr<SVGTransform> newItem = passNewItem;
+
+ // SVG2-Draft Spec: If newItem is already in a list, then a new SVGTransform object is created with the same values as newItem and this item is inserted into the list.
+ // Otherwise, newItem itself is inserted into the list.
+ if (newItem->ownerList())
+ return Base::insertItemBefore(newItem->clone(), index);
+
+ return Base::insertItemBefore(newItem, index);
+}
+
+PassRefPtrWillBeRawPtr<SVGTransform> SVGTransformList::replaceItem(PassRefPtrWillBeRawPtr<SVGTransform> passNewItem, size_t index, ExceptionState& exceptionState)
+{
+ RefPtrWillBeRawPtr<SVGTransform> newItem = passNewItem;
+
+ // SVG2-Draft Spec: If newItem is already in a list, then a new SVGTransform object is created with the same values as newItem and this item is inserted into the list.
+ // Otherwise, newItem itself is inserted into the list.
+ if (newItem->ownerList())
+ return Base::replaceItem(newItem->clone(), index, exceptionState);
+
+ return Base::replaceItem(newItem, index, exceptionState);
+}
+
}
« LayoutTests/svg/dom/SVGTransformList-more.xhtml ('K') | « Source/core/svg/SVGTransformList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698