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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h

Issue 2633143002: SVG objects with same idrefs conflict when under different shadow root (Closed)
Patch Set: ensureSVGTreeScopedResources(); add comment Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef SVGDocumentExtensions_h 21 #ifndef SVGDocumentExtensions_h
22 #define SVGDocumentExtensions_h 22 #define SVGDocumentExtensions_h
23 23
24 #include "core/layout/svg/SVGResourcesCache.h" 24 #include "core/layout/svg/SVGResourcesCache.h"
25 #include "platform/geometry/FloatPoint.h" 25 #include "platform/geometry/FloatPoint.h"
26 #include "platform/heap/Handle.h" 26 #include "platform/heap/Handle.h"
27 #include "wtf/Forward.h" 27 #include "wtf/Forward.h"
28 #include "wtf/HashMap.h"
29 #include "wtf/HashSet.h" 28 #include "wtf/HashSet.h"
30 #include "wtf/text/AtomicStringHash.h"
31 29
32 namespace blink { 30 namespace blink {
33 31
34 class Document; 32 class Document;
35 class Element;
36 class LayoutSVGResourceContainer;
37 class SVGElement; 33 class SVGElement;
38 class SVGSVGElement; 34 class SVGSVGElement;
39 class SubtreeLayoutScope; 35 class SubtreeLayoutScope;
40 36
41 class SVGDocumentExtensions 37 class SVGDocumentExtensions
42 : public GarbageCollectedFinalized<SVGDocumentExtensions> { 38 : public GarbageCollectedFinalized<SVGDocumentExtensions> {
43 WTF_MAKE_NONCOPYABLE(SVGDocumentExtensions); 39 WTF_MAKE_NONCOPYABLE(SVGDocumentExtensions);
44 40
45 public: 41 public:
46 typedef HeapHashSet<Member<Element>> SVGPendingElements;
47 explicit SVGDocumentExtensions(Document*); 42 explicit SVGDocumentExtensions(Document*);
48 ~SVGDocumentExtensions(); 43 ~SVGDocumentExtensions();
49 44
50 void addTimeContainer(SVGSVGElement*); 45 void addTimeContainer(SVGSVGElement*);
51 void removeTimeContainer(SVGSVGElement*); 46 void removeTimeContainer(SVGSVGElement*);
52 47
53 // Records the SVG element as having a Web Animation on an SVG attribute that 48 // Records the SVG element as having a Web Animation on an SVG attribute that
54 // needs applying. 49 // needs applying.
55 void addWebAnimationsPendingSVGElement(SVGElement&); 50 void addWebAnimationsPendingSVGElement(SVGElement&);
56 51
57 void addResource(const AtomicString& id, LayoutSVGResourceContainer*);
58 void removeResource(const AtomicString& id);
59 LayoutSVGResourceContainer* resourceById(const AtomicString& id) const;
60
61 static void serviceOnAnimationFrame(Document&); 52 static void serviceOnAnimationFrame(Document&);
62 53
63 void startAnimations(); 54 void startAnimations();
64 void pauseAnimations(); 55 void pauseAnimations();
65 void dispatchSVGLoadEventToOutermostSVGElements(); 56 void dispatchSVGLoadEventToOutermostSVGElements();
66 57
67 void reportError(const String&); 58 void reportError(const String&);
68 59
69 SVGResourcesCache& resourcesCache() { return m_resourcesCache; } 60 SVGResourcesCache& resourcesCache() { return m_resourcesCache; }
70 61
(...skipping 10 matching lines...) Expand all
81 static SVGSVGElement* rootElement(const Document&); 72 static SVGSVGElement* rootElement(const Document&);
82 SVGSVGElement* rootElement() const; 73 SVGSVGElement* rootElement() const;
83 74
84 DECLARE_TRACE(); 75 DECLARE_TRACE();
85 76
86 private: 77 private:
87 Member<Document> m_document; 78 Member<Document> m_document;
88 HeapHashSet<Member<SVGSVGElement>> m_timeContainers; 79 HeapHashSet<Member<SVGSVGElement>> m_timeContainers;
89 using SVGElementSet = HeapHashSet<Member<SVGElement>>; 80 using SVGElementSet = HeapHashSet<Member<SVGElement>>;
90 SVGElementSet m_webAnimationsPendingSVGElements; 81 SVGElementSet m_webAnimationsPendingSVGElements;
91 HashMap<AtomicString, LayoutSVGResourceContainer*> m_resources;
92 // Resources that are pending.
93 HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResources;
94 SVGResourcesCache m_resourcesCache; 82 SVGResourcesCache m_resourcesCache;
95 // Root SVG elements with relative length descendants. 83 // Root SVG elements with relative length descendants.
96 HeapHashSet<Member<SVGSVGElement>> m_relativeLengthSVGRoots; 84 HeapHashSet<Member<SVGSVGElement>> m_relativeLengthSVGRoots;
97 FloatPoint m_translate; 85 FloatPoint m_translate;
98 #if DCHECK_IS_ON() 86 #if DCHECK_IS_ON()
99 bool m_inRelativeLengthSVGRootsInvalidation = false; 87 bool m_inRelativeLengthSVGRootsInvalidation = false;
100 #endif 88 #endif
101 89
102 public: 90 public:
103 // This HashMap contains a list of pending resources. Pending resources, are
104 // such which are referenced by any object in the SVG document, but do NOT
105 // exist yet.
106 // For instance, dynamically build gradients / patterns / clippers...
107 void addPendingResource(const AtomicString& id, Element*);
108 bool hasPendingResource(const AtomicString& id) const;
109 bool isElementPendingResources(Element*) const;
110 bool isElementPendingResource(Element*, const AtomicString& id) const;
111 void clearHasPendingResourcesIfPossible(Element*);
112 void removeElementFromPendingResources(Element*);
113 SVGPendingElements* removePendingResource(const AtomicString& id);
114
115 void serviceAnimations(); 91 void serviceAnimations();
116 }; 92 };
117 93
118 } // namespace blink 94 } // namespace blink
119 95
120 #endif 96 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/BUILD.gn ('k') | third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698