| Index: third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h
|
| diff --git a/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h b/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h
|
| index 437f5f87a81eae2aef83c8169cc28a4c28b53827..f0025016a639d4be61048c6785cefeef5c424077 100644
|
| --- a/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h
|
| +++ b/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef SVGTreeScopeResources_h
|
| #define SVGTreeScopeResources_h
|
|
|
| +#include "core/dom/IdTargetObserver.h"
|
| #include "platform/heap/Handle.h"
|
| #include "platform/wtf/Forward.h"
|
| #include "platform/wtf/HashMap.h"
|
| @@ -14,8 +15,9 @@
|
| namespace blink {
|
|
|
| class Element;
|
| -class TreeScope;
|
| class LayoutSVGResourceContainer;
|
| +class SVGElement;
|
| +class TreeScope;
|
|
|
| // This class keeps track of SVG resources and pending references to such for a
|
| // TreeScope. It's per-TreeScope because that matches the lookup scope of an
|
| @@ -28,36 +30,40 @@ class SVGTreeScopeResources
|
| explicit SVGTreeScopeResources(TreeScope*);
|
| ~SVGTreeScopeResources();
|
|
|
| - void UpdateResource(const AtomicString& id, LayoutSVGResourceContainer*);
|
| - void UpdateResource(const AtomicString& old_id,
|
| - const AtomicString& new_id,
|
| - LayoutSVGResourceContainer*);
|
| - void RemoveResource(const AtomicString& id, LayoutSVGResourceContainer*);
|
| - LayoutSVGResourceContainer* ResourceById(const AtomicString& id) const;
|
| -
|
| - // Pending resources are such which are referenced by any object in the SVG
|
| - // document, but do NOT exist yet. For instance, dynamically built gradients
|
| - // / patterns / clippers...
|
| - void AddPendingResource(const AtomicString& id, Element&);
|
| - bool IsElementPendingResource(Element&, const AtomicString& id) const;
|
| - void NotifyResourceAvailable(const AtomicString& id);
|
| - void RemoveElementFromPendingResources(Element&);
|
| + class Resource : public IdTargetObserver {
|
| + public:
|
| + Resource(TreeScope&, const AtomicString& id);
|
| + ~Resource() override;
|
|
|
| - DECLARE_TRACE();
|
| + Element* Target() const { return target_; }
|
| + LayoutSVGResourceContainer* ResourceContainer() const;
|
|
|
| - private:
|
| - void ClearHasPendingResourcesIfPossible(Element&);
|
| + void AddWatch(SVGElement&);
|
| + void RemoveWatch(SVGElement&);
|
| +
|
| + bool IsEmpty() const;
|
| +
|
| + DECLARE_TRACE();
|
|
|
| - using SVGPendingElements = HeapHashSet<Member<Element>>;
|
| - using ResourceMap = HashMap<AtomicString, LayoutSVGResourceContainer*>;
|
| + void NotifyResourceClients();
|
|
|
| - void RegisterResource(const AtomicString& id, LayoutSVGResourceContainer*);
|
| - void UnregisterResource(ResourceMap::iterator);
|
| - void NotifyPendingClients(const AtomicString& id);
|
| + private:
|
| + void IdTargetChanged() override;
|
|
|
| - ResourceMap resources_;
|
| - // Resources that are pending.
|
| - HeapHashMap<AtomicString, Member<SVGPendingElements>> pending_resources_;
|
| + Member<TreeScope> tree_scope_;
|
| + Member<Element> target_;
|
| + HeapHashSet<Member<SVGElement>> pending_clients_;
|
| + };
|
| + Resource* ResourceForId(const AtomicString& id);
|
| + Resource* ExistingResourceForId(const AtomicString& id) const;
|
| +
|
| + void RemoveUnreferencedResources();
|
| + void RemoveWatchesForElement(SVGElement&);
|
| +
|
| + DECLARE_TRACE();
|
| +
|
| + private:
|
| + HeapHashMap<AtomicString, Member<Resource>> resources_;
|
| Member<TreeScope> tree_scope_;
|
| };
|
|
|
|
|