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

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

Issue 266063002: Store SVGElement instead of SVGElementInstance for instancesForElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix nits Created 6 years, 8 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/SVGElement.cpp ('k') | Source/core/svg/SVGElementRareData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGElementInstance.cpp
diff --git a/Source/core/svg/SVGElementInstance.cpp b/Source/core/svg/SVGElementInstance.cpp
index d4aad6a48e582a5c65cdf1a4d27a23a9bc238ee1..9a14b1a4f8206a20c5f571d2c2f80fa909ca2c51 100644
--- a/Source/core/svg/SVGElementInstance.cpp
+++ b/Source/core/svg/SVGElementInstance.cpp
@@ -99,9 +99,6 @@ SVGElementInstance::SVGElementInstance(SVGUseElement* correspondingUseElement, S
ASSERT(m_element);
ScriptWrappable::init(this);
- // Register as instance for passed element.
- m_element->mapInstanceToElement(this);
-
#ifndef NDEBUG
instanceCounter.increment();
#endif
@@ -140,7 +137,7 @@ void SVGElementInstance::detach()
node->detach();
// Deregister as instance for passed element, if we haven't already.
- if (m_element->instancesForElement().contains(this))
+ if (m_element->instancesForElement().contains(shadowTreeElement()))
m_element->removeInstanceMapping(this);
// DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection
@@ -156,6 +153,9 @@ void SVGElementInstance::setShadowTreeElement(SVGElement* element)
{
ASSERT(element);
m_shadowTreeElement = element;
+ // Register as instance for passed element.
+ m_element->mapInstanceToElement(this);
+
}
void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child)
@@ -171,18 +171,14 @@ void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element)
if (element->instanceUpdatesBlocked())
return;
- const HashSet<SVGElementInstance*>& set = element->instancesForElement();
+ const HashSet<SVGElement*>& set = element->instancesForElement();
if (set.isEmpty())
return;
// Mark all use elements referencing 'element' for rebuilding
- const HashSet<SVGElementInstance*>::const_iterator end = set.end();
- for (HashSet<SVGElementInstance*>::const_iterator it = set.begin(); it != end; ++it) {
- ASSERT((*it)->shadowTreeElement());
- ASSERT((*it)->shadowTreeElement()->correspondingElement());
- ASSERT((*it)->shadowTreeElement()->correspondingElement() == (*it)->correspondingElement());
- ASSERT((*it)->correspondingElement() == element);
- (*it)->shadowTreeElement()->setCorrespondingElement(0);
+ const HashSet<SVGElement*>::const_iterator end = set.end();
+ for (HashSet<SVGElement*>::const_iterator it = set.begin(); it != end; ++it) {
+ (*it)->setCorrespondingElement(0);
if (SVGUseElement* element = (*it)->correspondingUseElement()) {
ASSERT(element->inDocument());
« no previous file with comments | « Source/core/svg/SVGElement.cpp ('k') | Source/core/svg/SVGElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698