OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SVGTreeScopeResources_h |
| 6 #define SVGTreeScopeResources_h |
| 7 |
| 8 #include "platform/geometry/FloatPoint.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 #include "wtf/Forward.h" |
| 11 #include "wtf/HashMap.h" |
| 12 #include "wtf/HashSet.h" |
| 13 #include "wtf/text/AtomicStringHash.h" |
| 14 |
| 15 |
| 16 namespace blink { |
| 17 class Element; |
| 18 class TreeScope; |
| 19 class LayoutSVGResourceContainer; |
| 20 |
| 21 class SVGTreeScopeResources : public GarbageCollectedFinalized<SVGTreeScopeResou
rces> { |
| 22 WTF_MAKE_NONCOPYABLE(SVGTreeScopeResources); |
| 23 public: |
| 24 typedef HeapHashSet<Member<Element>> SVGPendingElements; |
| 25 explicit SVGTreeScopeResources(TreeScope*); |
| 26 ~SVGTreeScopeResources(); |
| 27 void addResource(const AtomicString& id, LayoutSVGResourceContainer*); |
| 28 void removeResource(const AtomicString& id); |
| 29 LayoutSVGResourceContainer* resourceById(const AtomicString& id) const; |
| 30 |
| 31 // This HashMap contains a list of pending resources. Pending resources, are
such |
| 32 // which are referenced by any object in the SVG document, but do NOT exist
yet. |
| 33 // For instance, dynamically build gradients / patterns / clippers... |
| 34 void addPendingResource(const AtomicString& id, Element*); |
| 35 bool hasPendingResource(const AtomicString& id) const; |
| 36 bool isElementPendingResources(Element*) const; |
| 37 bool isElementPendingResource(Element*, const AtomicString& id) const; |
| 38 void clearHasPendingResourcesIfPossible(Element*); |
| 39 void removeElementFromPendingResources(Element*); |
| 40 SVGPendingElements* removePendingResource(const AtomicString& id); |
| 41 |
| 42 // The following two functions are used for scheduling a pending resource to
be removed. |
| 43 void markPendingResourcesForRemoval(const AtomicString&); |
| 44 Element* removeElementFromPendingResourcesForRemoval(const AtomicString&); |
| 45 |
| 46 DECLARE_TRACE(); |
| 47 private: |
| 48 Member<TreeScope> m_treeScope; |
| 49 HashMap<AtomicString, LayoutSVGResourceContainer*> m_resources; |
| 50 HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResources; //
Resources that are pending. |
| 51 HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResourcesForR
emoval; // Resources that are pending and scheduled for removal. |
| 52 |
| 53 SVGPendingElements* removePendingResourceForRemoval(const AtomicString&); |
| 54 }; |
| 55 } |
| 56 #endif // SVGTreeScopeResources_h |
OLD | NEW |