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

Side by Side Diff: Source/core/svg/animation/SVGSMILElement.h

Issue 103393002: Use DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION to generate toSVGSMILElement() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef SVGSMILElement_h 26 #ifndef SVGSMILElement_h
27 #define SVGSMILElement_h 27 #define SVGSMILElement_h
28 28
29 #include "SVGNames.h"
29 #include "core/svg/SVGElement.h" 30 #include "core/svg/SVGElement.h"
30 #include "core/svg/animation/SMILTime.h" 31 #include "core/svg/animation/SMILTime.h"
31 #include "wtf/HashMap.h" 32 #include "wtf/HashMap.h"
32 33
33 namespace WebCore { 34 namespace WebCore {
34 35
35 class ConditionEventListener; 36 class ConditionEventListener;
36 class SMILTimeContainer; 37 class SMILTimeContainer;
37 class SVGSMILElement; 38 class SVGSMILElement;
38 39
39 template<typename T> class EventSender; 40 template<typename T> class EventSender;
40 typedef EventSender<SVGSMILElement> SMILEventSender; 41 typedef EventSender<SVGSMILElement> SMILEventSender;
41 42
42 // This class implements SMIL interval timing model as needed for SVG animation. 43 // This class implements SMIL interval timing model as needed for SVG animation.
43 class SVGSMILElement : public SVGElement { 44 class SVGSMILElement : public SVGElement {
44 public: 45 public:
45 SVGSMILElement(const QualifiedName&, Document&); 46 SVGSMILElement(const QualifiedName&, Document&);
46 virtual ~SVGSMILElement(); 47 virtual ~SVGSMILElement();
47 48
48 static bool isSMILElement(Node*);
49
50 bool isSupportedAttribute(const QualifiedName&); 49 bool isSupportedAttribute(const QualifiedName&);
51 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 50 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
52 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE; 51 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
53 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 52 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
54 virtual void removedFrom(ContainerNode*) OVERRIDE; 53 virtual void removedFrom(ContainerNode*) OVERRIDE;
55 54
56 virtual bool hasValidAttributeType() = 0; 55 virtual bool hasValidAttributeType() = 0;
57 virtual bool hasValidAttributeName(); 56 virtual bool hasValidAttributeName();
58 virtual void animationAttributeChanged() = 0; 57 virtual void animationAttributeChanged() = 0;
59 58
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 231
233 mutable SMILTime m_cachedDur; 232 mutable SMILTime m_cachedDur;
234 mutable SMILTime m_cachedRepeatDur; 233 mutable SMILTime m_cachedRepeatDur;
235 mutable SMILTime m_cachedRepeatCount; 234 mutable SMILTime m_cachedRepeatCount;
236 mutable SMILTime m_cachedMin; 235 mutable SMILTime m_cachedMin;
237 mutable SMILTime m_cachedMax; 236 mutable SMILTime m_cachedMax;
238 237
239 friend class ConditionEventListener; 238 friend class ConditionEventListener;
240 }; 239 };
241 240
242 inline SVGSMILElement* toSVGSMILElement(Element* element) 241 inline bool isSVGSMILElement(const Node& node)
243 { 242 {
244 ASSERT_WITH_SECURITY_IMPLICATION(!element || SVGSMILElement::isSMILElement(e lement)); 243 return node.hasTagName(SVGNames::setTag) || node.hasTagName(SVGNames::animat eTag) || node.hasTagName(SVGNames::animateMotionTag)
245 return static_cast<SVGSMILElement*>(element); 244 || node.hasTagName(SVGNames::animateTransformTag) || node.hasTagName(SVG Names::animateColorTag);
246 } 245 }
247 246
247 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement);
248
248 } 249 }
249 250
250 #endif // SVGSMILElement_h 251 #endif // SVGSMILElement_h
OLDNEW
« no previous file with comments | « Source/core/svg/animation/SMILTimeContainer.cpp ('k') | Source/core/svg/animation/SVGSMILElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698