• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2     Copyright (C) 2006 Apple Computer, Inc.
3                   2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 
5     This file is part of the WebKit project
6 
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11 
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16 
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef SVGDocumentExtensions_h
24 #define SVGDocumentExtensions_h
25 
26 #if ENABLE(SVG)
27 #include <memory>
28 
29 #include <wtf/HashSet.h>
30 #include <wtf/HashMap.h>
31 
32 #include "StringHash.h"
33 #include "StringImpl.h"
34 
35 namespace WebCore {
36 
37 class Document;
38 class String;
39 class SVGStyledElement;
40 class SVGSMILElement;
41 class SVGSVGElement;
42 
43 class SVGDocumentExtensions : public Noncopyable {
44 public:
45     SVGDocumentExtensions(Document*);
46     ~SVGDocumentExtensions();
47 
48     void addTimeContainer(SVGSVGElement*);
49     void removeTimeContainer(SVGSVGElement*);
50 
51     void startAnimations();
52     void pauseAnimations();
53     void unpauseAnimations();
54     bool sampleAnimationAtTime(const String& elementId, SVGSMILElement*, double time);
55 
56     void reportWarning(const String&);
57     void reportError(const String&);
58 
59 private:
60     Document* m_doc; // weak reference
61     HashSet<SVGSVGElement*> m_timeContainers; // For SVG 1.2 support this will need to be made more general.
62     HashMap<String, HashSet<SVGStyledElement*>*> m_pendingResources;
63 
64     SVGDocumentExtensions(const SVGDocumentExtensions&);
65     SVGDocumentExtensions& operator=(const SVGDocumentExtensions&);
66 
67 public:
68     // This HashMap contains a list of pending resources. Pending resources, are such
69     // which are referenced by any object in the SVG document, but do NOT exist yet.
70     // For instance, dynamically build gradients / patterns / clippers...
71     void addPendingResource(const AtomicString& id, SVGStyledElement*);
72     bool isPendingResource(const AtomicString& id) const;
73     std::auto_ptr<HashSet<SVGStyledElement*> > removePendingResource(const AtomicString& id);
74 };
75 
76 }
77 
78 #endif
79 #endif
80