Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..376511a080c3af31048ed9bdcd7752b78f5b33bf |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/svg/SVGTreeScopeResources.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SVGTreeScopeResources_h |
| +#define SVGTreeScopeResources_h |
| + |
| +#include "platform/heap/Handle.h" |
| +#include "wtf/Forward.h" |
| +#include "wtf/HashMap.h" |
| +#include "wtf/HashSet.h" |
| +#include "wtf/text/AtomicStringHash.h" |
| + |
| +namespace blink { |
| + |
| +class Element; |
| +class TreeScope; |
| +class LayoutSVGResourceContainer; |
| + |
| +class SVGTreeScopeResources |
|
pdr.
2017/01/23 04:34:12
Can you add a very short comment here describing t
fs
2017/01/23 11:18:24
Done.
|
| + : public GarbageCollectedFinalized<SVGTreeScopeResources> { |
| + WTF_MAKE_NONCOPYABLE(SVGTreeScopeResources); |
| + |
| + public: |
| + typedef HeapHashSet<Member<Element>> SVGPendingElements; |
| + |
| + explicit SVGTreeScopeResources(TreeScope*); |
| + ~SVGTreeScopeResources(); |
| + |
| + void addResource(const AtomicString& id, LayoutSVGResourceContainer*); |
| + void removeResource(const AtomicString& id); |
| + 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 hasPendingResource(const AtomicString& id) const; |
| + bool isElementPendingResources(Element*) const; |
| + bool isElementPendingResource(Element*, const AtomicString& id) const; |
| + void clearHasPendingResourcesIfPossible(Element*); |
| + void removeElementFromPendingResources(Element*); |
| + SVGPendingElements* removePendingResource(const AtomicString& id); |
| + |
| + DECLARE_TRACE(); |
| + |
| + private: |
| + HashMap<AtomicString, LayoutSVGResourceContainer*> m_resources; |
| + // Resources that are pending. |
| + HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResources; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // SVGTreeScopeResources_h |