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

Side by Side Diff: Source/core/svg/properties/SVGListPropertyTearOffHelper.h

Issue 1177303004: Updated SVGListPropertyHelper as per SVG2 Spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed presubmit error 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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/properties/SVGListPropertyHelper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 typedef ItemProperty ItemPropertyType; 44 typedef ItemProperty ItemPropertyType;
45 typedef typename ItemPropertyType::TearOffType ItemTearOffType; 45 typedef typename ItemPropertyType::TearOffType ItemTearOffType;
46 46
47 static PassRefPtrWillBeRawPtr<ItemPropertyType> getValueForInsertionFromTear Off(PassRefPtrWillBeRawPtr<ItemTearOffType> passNewItem, SVGElement* contextElem ent, const QualifiedName& attributeName) 47 static PassRefPtrWillBeRawPtr<ItemPropertyType> getValueForInsertionFromTear Off(PassRefPtrWillBeRawPtr<ItemTearOffType> passNewItem, SVGElement* contextElem ent, const QualifiedName& attributeName)
48 { 48 {
49 RefPtrWillBeRawPtr<ItemTearOffType> newItem = passNewItem; 49 RefPtrWillBeRawPtr<ItemTearOffType> newItem = passNewItem;
50 50
51 // |newItem| is immutable, OR 51 // |newItem| is immutable, OR
52 // |newItem| belongs to a SVGElement, but it does not belong to an anima ted list 52 // |newItem| belongs to a SVGElement, but it does not belong to an anima ted list
53 // (for example: "textElement.x.baseVal.appendItem(rectElement.width.bas eVal)") 53 // (for example: "textElement.x.baseVal.appendItem(rectElement.width.bas eVal)")
54 if (newItem->isImmutable() 54 // Spec: If newItem is already in a list, then a new object is created w ith the same values as newItem and this item is inserted into the list.
55 || (newItem->contextElement() && !newItem->target()->ownerList())) { 55 // Otherwise, newItem itself is inserted into the list.
56 if (newItem->isImmutable() || newItem->target()->ownerList() || newItem- >contextElement()) {
56 // We have to copy the incoming |newItem|, 57 // We have to copy the incoming |newItem|,
57 // Otherwise we'll end up having two tearoffs that operate on the sa me SVGProperty. Consider the example below: 58 // Otherwise we'll end up having two tearoffs that operate on the sa me SVGProperty. Consider the example below:
58 // SVGRectElements SVGAnimatedLength 'width' property baseVal points to the same tear off object 59 // SVGRectElements SVGAnimatedLength 'width' property baseVal points to the same tear off object
59 // that's inserted into SVGTextElements SVGAnimatedLengthList 'x'. t extElement.x.baseVal.getItem(0).value += 150 would 60 // that's inserted into SVGTextElements SVGAnimatedLengthList 'x'. t extElement.x.baseVal.getItem(0).value += 150 would
60 // mutate the rectElement width _and_ the textElement x list. That's obviously wrong, take care of that. 61 // mutate the rectElement width _and_ the textElement x list. That's obviously wrong, take care of that.
61 return newItem->target()->clone(); 62 return newItem->target()->clone();
62 } 63 }
63 64
64 newItem->attachToSVGElementAttribute(contextElement, attributeName); 65 newItem->attachToSVGElementAttribute(contextElement, attributeName);
65 return newItem->target(); 66 return newItem->target();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return ItemTraits::createTearOff(value, 0, PropertyIsNotAnimVal, Qualifi edName::null()); 213 return ItemTraits::createTearOff(value, 0, PropertyIsNotAnimVal, Qualifi edName::null());
213 } 214 }
214 215
215 private: 216 private:
216 Derived* toDerived() { return static_cast<Derived*>(this); } 217 Derived* toDerived() { return static_cast<Derived*>(this); }
217 }; 218 };
218 219
219 } 220 }
220 221
221 #endif // SVGListPropertyTearOffHelper_h 222 #endif // SVGListPropertyTearOffHelper_h
OLDNEW
« no previous file with comments | « Source/core/svg/properties/SVGListPropertyHelper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698