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

Unified Diff: Source/core/svg/properties/SVGListPropertyTearOffHelper.h

Issue 321403004: SVG: Items inserted into list should be made a tear-off. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add baseline for mac Created 6 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
« no previous file with comments | « Source/core/svg/SVGPathSegListTearOff.h ('k') | Source/core/svg/properties/SVGPropertyTearOff.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/properties/SVGListPropertyTearOffHelper.h
diff --git a/Source/core/svg/properties/SVGListPropertyTearOffHelper.h b/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
index 8c6e6bc81e676b26367957a791e23304dfdd93b5..73038f590ca4e032d5b1b3f46332fb078ee95b12 100644
--- a/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
+++ b/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
@@ -44,7 +44,7 @@ public:
typedef ItemProperty ItemPropertyType;
typedef typename ItemPropertyType::TearOffType ItemTearOffType;
- static PassRefPtr<ItemPropertyType> getValueForInsertionFromTearOff(PassRefPtr<ItemTearOffType> passNewItem)
+ static PassRefPtr<ItemPropertyType> getValueForInsertionFromTearOff(PassRefPtr<ItemTearOffType> passNewItem, SVGElement* contextElement, const QualifiedName& attributeName)
{
RefPtr<ItemTearOffType> newItem = passNewItem;
@@ -54,13 +54,14 @@ public:
if (newItem->isImmutable()
|| (newItem->contextElement() && !newItem->target()->ownerList())) {
// We have to copy the incoming |newItem|,
- // Otherwise we'll end up having two tearoffs that operate on the same SVGProperty. Consider the example above:
+ // Otherwise we'll end up having two tearoffs that operate on the same SVGProperty. Consider the example below:
// SVGRectElements SVGAnimatedLength 'width' property baseVal points to the same tear off object
// that's inserted into SVGTextElements SVGAnimatedLengthList 'x'. textElement.x.baseVal.getItem(0).value += 150 would
// mutate the rectElement width _and_ the textElement x list. That's obviously wrong, take care of that.
return newItem->target()->clone();
}
+ newItem->attachToSVGElementAttribute(contextElement, attributeName);
return newItem->target();
}
@@ -202,9 +203,9 @@ protected:
{
}
- static PassRefPtr<ItemPropertyType> getValueForInsertionFromTearOff(PassRefPtr<ItemTearOffType> passNewItem)
+ PassRefPtr<ItemPropertyType> getValueForInsertionFromTearOff(PassRefPtr<ItemTearOffType> passNewItem)
{
- return ItemTraits::getValueForInsertionFromTearOff(passNewItem);
+ return ItemTraits::getValueForInsertionFromTearOff(passNewItem, toDerived()->contextElement(), toDerived()->attributeName());
}
PassRefPtr<ItemTearOffType> createItemTearOff(PassRefPtr<ItemPropertyType> value)
@@ -212,7 +213,10 @@ protected:
if (!value)
return nullptr;
- return ItemTraits::createTearOff(value, toDerived()->contextElement(), toDerived()->propertyIsAnimVal(), toDerived()->attributeName());
+ if (value->ownerList() == toDerived()->target())
+ return ItemTraits::createTearOff(value, toDerived()->contextElement(), toDerived()->propertyIsAnimVal(), toDerived()->attributeName());
+
+ return ItemTraits::createTearOff(value, 0, PropertyIsNotAnimVal, nullQName());
}
private:
« no previous file with comments | « Source/core/svg/SVGPathSegListTearOff.h ('k') | Source/core/svg/properties/SVGPropertyTearOff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698