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

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

Issue 272523002: Remove SVGElementInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address esprehns nits 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/SVGElement.h ('k') | Source/core/svg/SVGElementInstance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGElement.cpp
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index 7f1904c2b9d4b2db6f74236dd3ac24ed2f8dae74..7b84ce2671c2a15a0a07e0219a01a881266e0b29 100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -107,6 +107,20 @@ SVGElement::~SVGElement()
#endif
}
+void SVGElement::detach(const AttachContext& context)
+{
+ Element::detach(context);
+ if (SVGElement* element = correspondingElement())
+ element->removeInstanceMapping(this);
+}
+
+void SVGElement::attach(const AttachContext& context)
+{
+ Element::attach(context);
+ if (SVGElement* element = correspondingElement())
+ element->mapInstanceToElement(this);
+}
+
short SVGElement::tabIndex() const
{
if (supportsFocus())
@@ -330,7 +344,7 @@ void SVGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node*
{
Element::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- // Invalidate all SVGElementInstances associated with us.
+ // Invalidate all instances associated with us.
if (!changedByParser)
invalidateInstances();
}
@@ -525,6 +539,9 @@ void SVGElement::removeInstanceMapping(SVGElement* instance)
ASSERT(instance);
ASSERT(instance->inUseShadowTree());
+ if (!hasSVGRareData())
+ return;
+
WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = svgRareData()->elementInstances();
ASSERT(instances.contains(instance));
@@ -1042,6 +1059,8 @@ void SVGElement::invalidateInstances()
}
}
+ svgRareData()->elementInstances().clear();
+
document().updateRenderTreeIfNeeded();
}
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGElementInstance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698