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

Side by Side Diff: Source/core/svg/properties/SVGAnimatedProperty.cpp

Issue 24863002: Revert 157959 "Introduce a new reference graph to SVG*TearOffs." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 18 matching lines...) Expand all
29 : m_contextElement(contextElement) 29 : m_contextElement(contextElement)
30 , m_attributeName(attributeName) 30 , m_attributeName(attributeName)
31 , m_animatedPropertyType(animatedPropertyType) 31 , m_animatedPropertyType(animatedPropertyType)
32 , m_isAnimating(false) 32 , m_isAnimating(false)
33 , m_isReadOnly(false) 33 , m_isReadOnly(false)
34 { 34 {
35 } 35 }
36 36
37 SVGAnimatedProperty::~SVGAnimatedProperty() 37 SVGAnimatedProperty::~SVGAnimatedProperty()
38 { 38 {
39 // Remove wrapper from cache.
40 Cache* cache = animatedPropertyCache();
41 const Cache::const_iterator end = cache->end();
42 for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
43 if (it->value == this) {
44 cache->remove(it->key);
45 break;
46 }
47 }
48
39 // Assure that animationEnded() was called, if animationStarted() was called before. 49 // Assure that animationEnded() was called, if animationStarted() was called before.
40 ASSERT(!m_isAnimating); 50 ASSERT(!m_isAnimating);
41 } 51 }
42 52
43 void SVGAnimatedProperty::detachAnimatedPropertiesWrappersForElement(SVGElement* element)
44 {
45 Cache* cache = animatedPropertyCache();
46 const Cache::const_iterator end = cache->end();
47 for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
48 if (it->key.m_element == element)
49 it->value->detachWrappers();
50 }
51 }
52
53 void SVGAnimatedProperty::detachAnimatedPropertiesForElement(SVGElement* element )
54 {
55 // Remove wrappers from cache.
56 Cache* cache = animatedPropertyCache();
57
58 Vector<SVGAnimatedPropertyDescription> keysToRemove;
59
60 const Cache::const_iterator end = cache->end();
61 for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
62 if (it->key.m_element == element) {
63 it->value->resetContextElement();
64 keysToRemove.append(it->key);
65 }
66 }
67
68 for (Vector<SVGAnimatedPropertyDescription>::const_iterator it = keysToRemov e.begin(); it != keysToRemove.end(); ++it)
69 cache->remove(*it);
70 }
71
72 void SVGAnimatedProperty::commitChange() 53 void SVGAnimatedProperty::commitChange()
73 { 54 {
74 ASSERT(m_contextElement); 55 ASSERT(m_contextElement);
75 ASSERT(!m_contextElement->m_deletionHasBegun); 56 ASSERT(!m_contextElement->m_deletionHasBegun);
76 m_contextElement->invalidateSVGAttributes(); 57 m_contextElement->invalidateSVGAttributes();
77 m_contextElement->svgAttributeChanged(m_attributeName); 58 m_contextElement->svgAttributeChanged(m_attributeName);
78 } 59 }
79 60
80 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache() 61 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache()
81 { 62 {
82 static Cache* s_cache = new Cache; 63 static Cache* s_cache = new Cache;
83 return s_cache; 64 return s_cache;
84 } 65 }
85 66
86 } // namespace WebCore 67 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/svg/properties/SVGAnimatedProperty.h ('k') | Source/core/svg/properties/SVGListPropertyTearOff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698