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

Side by Side Diff: Source/core/svg/SVGElement.cpp

Issue 272523002: Remove SVGElementInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use attach/detach 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 m_SVGRareData.clear(); 100 m_SVGRareData.clear();
101 } 101 }
102 102
103 // With Oilpan, either removedFrom has been called or the document is dead 103 // With Oilpan, either removedFrom has been called or the document is dead
104 // as well and there is no reason to clear out the extensions. 104 // as well and there is no reason to clear out the extensions.
105 document().accessSVGExtensions().rebuildAllElementReferencesForTarget(this); 105 document().accessSVGExtensions().rebuildAllElementReferencesForTarget(this);
106 document().accessSVGExtensions().removeAllElementReferencesForTarget(this); 106 document().accessSVGExtensions().removeAllElementReferencesForTarget(this);
107 #endif 107 #endif
108 } 108 }
109 109
110 void SVGElement::detach(const AttachContext& context)
111 {
112 Element::detach(context);
113 if (correspondingElement() && correspondingElement()->instancesForElement(). contains(this))
pdr. 2014/06/04 04:07:52 Can we make instancesForElement protected and move
114 correspondingElement()->removeInstanceMapping(this);
115 }
116
117 void SVGElement::attach(const AttachContext& context)
118 {
119 Element::attach(context);
120 if (correspondingElement())
121 correspondingElement()->mapInstanceToElement(this);
122 }
123
110 short SVGElement::tabIndex() const 124 short SVGElement::tabIndex() const
111 { 125 {
112 if (supportsFocus()) 126 if (supportsFocus())
113 return Element::tabIndex(); 127 return Element::tabIndex();
114 return -1; 128 return -1;
115 } 129 }
116 130
117 void SVGElement::willRecalcStyle(StyleRecalcChange change) 131 void SVGElement::willRecalcStyle(StyleRecalcChange change)
118 { 132 {
119 if (!hasSVGRareData()) 133 if (!hasSVGRareData())
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end(); 1049 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end();
1036 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) { 1050 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) {
1037 (*it)->setCorrespondingElement(0); 1051 (*it)->setCorrespondingElement(0);
1038 1052
1039 if (SVGUseElement* element = (*it)->correspondingUseElement()) { 1053 if (SVGUseElement* element = (*it)->correspondingUseElement()) {
1040 ASSERT(element->inDocument()); 1054 ASSERT(element->inDocument());
1041 element->invalidateShadowTree(); 1055 element->invalidateShadowTree();
1042 } 1056 }
1043 } 1057 }
1044 1058
1059 svgRareData()->elementInstances().clear();
1060
1045 document().updateRenderTreeIfNeeded(); 1061 document().updateRenderTreeIfNeeded();
1046 } 1062 }
1047 1063
1048 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt) 1064 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt)
1049 : m_targetElement(targetElement) 1065 : m_targetElement(targetElement)
1050 { 1066 {
1051 if (m_targetElement) 1067 if (m_targetElement)
1052 m_targetElement->setInstanceUpdatesBlocked(true); 1068 m_targetElement->setInstanceUpdatesBlocked(true);
1053 } 1069 }
1054 1070
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 #endif 1182 #endif
1167 1183
1168 void SVGElement::trace(Visitor* visitor) 1184 void SVGElement::trace(Visitor* visitor)
1169 { 1185 {
1170 visitor->trace(m_elementsWithRelativeLengths); 1186 visitor->trace(m_elementsWithRelativeLengths);
1171 visitor->trace(m_SVGRareData); 1187 visitor->trace(m_SVGRareData);
1172 Element::trace(visitor); 1188 Element::trace(visitor);
1173 } 1189 }
1174 1190
1175 } 1191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698