Commit f7a76ac4 authored by rob.buis@samsung.com's avatar rob.buis@samsung.com

Stop using SVGElementInstance in SVGElement

Stop using SVGElementInstance in SVGElement since we want to remove it.

BUG=313438

Review URL: https://codereview.chromium.org/272623003

git-svn-id: svn://svn.chromium.org/blink/trunk@173637 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c27ce484
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "core/rendering/svg/RenderSVGResourceContainer.h" #include "core/rendering/svg/RenderSVGResourceContainer.h"
#include "core/svg/SVGCursorElement.h" #include "core/svg/SVGCursorElement.h"
#include "core/svg/SVGDocumentExtensions.h" #include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGElementInstance.h"
#include "core/svg/SVGElementRareData.h" #include "core/svg/SVGElementRareData.h"
#include "core/svg/SVGGraphicsElement.h" #include "core/svg/SVGGraphicsElement.h"
#include "core/svg/SVGSVGElement.h" #include "core/svg/SVGSVGElement.h"
...@@ -528,28 +527,27 @@ SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions() ...@@ -528,28 +527,27 @@ SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions()
return document().accessSVGExtensions(); return document().accessSVGExtensions();
} }
void SVGElement::mapInstanceToElement(SVGElementInstance* instance) void SVGElement::mapInstanceToElement(SVGElement* instance)
{ {
ASSERT(instance); ASSERT(instance);
ASSERT(instance->inUseShadowTree());
HashSet<SVGElement*>& instances = ensureSVGRareData()->elementInstances(); HashSet<SVGElement*>& instances = ensureSVGRareData()->elementInstances();
ASSERT(!instances.contains(instance->shadowTreeElement())); ASSERT(!instances.contains(instance));
instances.add(instance->shadowTreeElement()); instances.add(instance);
} }
void SVGElement::removeInstanceMapping(SVGElementInstance* instance) void SVGElement::removeInstanceMapping(SVGElement* instance)
{ {
ASSERT(instance); ASSERT(instance);
ASSERT(instance->inUseShadowTree());
ASSERT(hasSVGRareData()); ASSERT(hasSVGRareData());
if (!instance->shadowTreeElement())
return;
HashSet<SVGElement*>& instances = svgRareData()->elementInstances(); HashSet<SVGElement*>& instances = svgRareData()->elementInstances();
ASSERT(instances.contains(instance->shadowTreeElement())); ASSERT(instances.contains(instance));
instances.remove(instance->shadowTreeElement()); instances.remove(instance);
} }
const HashSet<SVGElement*>& SVGElement::instancesForElement() const const HashSet<SVGElement*>& SVGElement::instancesForElement() const
......
...@@ -40,7 +40,6 @@ class SVGAnimatedPropertyBase; ...@@ -40,7 +40,6 @@ class SVGAnimatedPropertyBase;
class SubtreeLayoutScope; class SubtreeLayoutScope;
class SVGCursorElement; class SVGCursorElement;
class SVGDocumentExtensions; class SVGDocumentExtensions;
class SVGElementInstance;
class SVGElementRareData; class SVGElementRareData;
class SVGFitToViewBox; class SVGFitToViewBox;
class SVGSVGElement; class SVGSVGElement;
...@@ -109,6 +108,8 @@ public: ...@@ -109,6 +108,8 @@ public:
void invalidateSVGPresentationAttributeStyle() { ensureUniqueElementData().m_presentationAttributeStyleIsDirty = true; } void invalidateSVGPresentationAttributeStyle() { ensureUniqueElementData().m_presentationAttributeStyleIsDirty = true; }
const HashSet<SVGElement*>& instancesForElement() const; const HashSet<SVGElement*>& instancesForElement() const;
void mapInstanceToElement(SVGElement*);
void removeInstanceMapping(SVGElement*);
bool getBoundingBox(FloatRect&); bool getBoundingBox(FloatRect&);
...@@ -210,8 +211,6 @@ protected: ...@@ -210,8 +211,6 @@ protected:
bool hasFocusEventListeners() const; bool hasFocusEventListeners() const;
private: private:
friend class SVGElementInstance;
// FIXME: Author shadows should be allowed // FIXME: Author shadows should be allowed
// https://bugs.webkit.org/show_bug.cgi?id=77938 // https://bugs.webkit.org/show_bug.cgi?id=77938
virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false; } virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false; }
...@@ -222,9 +221,6 @@ private: ...@@ -222,9 +221,6 @@ private:
void buildPendingResourcesIfNeeded(); void buildPendingResourcesIfNeeded();
void mapInstanceToElement(SVGElementInstance*);
void removeInstanceMapping(SVGElementInstance*);
bool supportsSpatialNavigationFocus() const; bool supportsSpatialNavigationFocus() const;
HashSet<SVGElement*> m_elementsWithRelativeLengths; HashSet<SVGElement*> m_elementsWithRelativeLengths;
......
...@@ -139,7 +139,7 @@ void SVGElementInstance::detach() ...@@ -139,7 +139,7 @@ void SVGElementInstance::detach()
// Deregister as instance for passed element, if we haven't already. // Deregister as instance for passed element, if we haven't already.
if (shadowTreeElement() && m_element->instancesForElement().contains(shadowTreeElement())) if (shadowTreeElement() && m_element->instancesForElement().contains(shadowTreeElement()))
m_element->removeInstanceMapping(this); m_element->removeInstanceMapping(shadowTreeElement());
// DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection
m_shadowTreeElement = nullptr; m_shadowTreeElement = nullptr;
...@@ -157,7 +157,7 @@ void SVGElementInstance::setShadowTreeElement(SVGElement* element) ...@@ -157,7 +157,7 @@ void SVGElementInstance::setShadowTreeElement(SVGElement* element)
ASSERT(element); ASSERT(element);
m_shadowTreeElement = element; m_shadowTreeElement = element;
// Register as instance for passed element. // Register as instance for passed element.
m_element->mapInstanceToElement(this); m_element->mapInstanceToElement(shadowTreeElement());
} }
......
...@@ -324,15 +324,15 @@ void SVGUseElement::scheduleShadowTreeRecreation() ...@@ -324,15 +324,15 @@ void SVGUseElement::scheduleShadowTreeRecreation()
void SVGUseElement::clearResourceReferences() void SVGUseElement::clearResourceReferences()
{ {
// FIXME: We should try to optimize this, to at least allow partial reclones.
if (ShadowRoot* shadowTreeRootElement = userAgentShadowRoot())
shadowTreeRootElement->removeChildren();
if (m_targetElementInstance) { if (m_targetElementInstance) {
m_targetElementInstance->detach(); m_targetElementInstance->detach();
m_targetElementInstance = nullptr; m_targetElementInstance = nullptr;
} }
// FIXME: We should try to optimize this, to at least allow partial reclones.
if (ShadowRoot* shadowTreeRootElement = userAgentShadowRoot())
shadowTreeRootElement->removeChildren();
m_needsShadowTreeRecreation = false; m_needsShadowTreeRecreation = false;
document().unscheduleUseShadowTreeUpdate(*this); document().unscheduleUseShadowTreeUpdate(*this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment