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

Side by Side Diff: Source/core/svg/SVGEnumeration.h

Issue 1212253012: Fix virtual/override/final usage in Source/core/svg/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 39
40 class SVGEnumerationBase : public SVGPropertyBase { 40 class SVGEnumerationBase : public SVGPropertyBase {
41 public: 41 public:
42 typedef std::pair<unsigned short, String> StringEntry; 42 typedef std::pair<unsigned short, String> StringEntry;
43 typedef Vector<StringEntry> StringEntries; 43 typedef Vector<StringEntry> StringEntries;
44 44
45 // SVGEnumeration does not have a tear-off type. 45 // SVGEnumeration does not have a tear-off type.
46 typedef void TearOffType; 46 typedef void TearOffType;
47 typedef unsigned short PrimitiveType; 47 typedef unsigned short PrimitiveType;
48 48
49 virtual ~SVGEnumerationBase(); 49 ~SVGEnumerationBase() override;
50 50
51 unsigned short value() const { return m_value <= maxExposedEnumValue() ? m_v alue : 0; } 51 unsigned short value() const { return m_value <= maxExposedEnumValue() ? m_v alue : 0; }
52 void setValue(unsigned short, ExceptionState&); 52 void setValue(unsigned short, ExceptionState&);
53 53
54 // SVGPropertyBase: 54 // SVGPropertyBase:
55 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const = 0; 55 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const = 0;
56 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri ng&) const override; 56 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con st override;
57 57
58 virtual String valueAsString() const override; 58 String valueAsString() const override;
59 void setValueAsString(const String&, ExceptionState&); 59 void setValueAsString(const String&, ExceptionState&);
60 60
61 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr ide; 61 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override;
62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO fDurationValue, SVGElement*) override; 62 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWillBeRawP tr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDuratio nValue, SVGElement*) override;
63 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGElement*) override; 63 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt*) override;
64 64
65 static AnimatedPropertyType classType() { return AnimatedEnumeration; } 65 static AnimatedPropertyType classType() { return AnimatedEnumeration; }
66 66
67 // Ensure that |SVGAnimatedEnumerationBase::setBaseVal| is used instead of | SVGAnimatedProperty<SVGEnumerationBase>::setBaseVal|. 67 // Ensure that |SVGAnimatedEnumerationBase::setBaseVal| is used instead of | SVGAnimatedProperty<SVGEnumerationBase>::setBaseVal|.
68 void setValue(unsigned short) { ASSERT_NOT_REACHED(); } 68 void setValue(unsigned short) { ASSERT_NOT_REACHED(); }
69 69
70 static unsigned short valueOfLastEnum(const StringEntries& entries) { return entries.last().first; } 70 static unsigned short valueOfLastEnum(const StringEntries& entries) { return entries.last().first; }
71 71
72 protected: 72 protected:
73 SVGEnumerationBase(unsigned short value, const StringEntries& entries, unsig ned short maxExposed) 73 SVGEnumerationBase(unsigned short value, const StringEntries& entries, unsig ned short maxExposed)
(...skipping 27 matching lines...) Expand all
101 } 101 }
102 102
103 template<typename Enum> 103 template<typename Enum>
104 class SVGEnumeration : public SVGEnumerationBase { 104 class SVGEnumeration : public SVGEnumerationBase {
105 public: 105 public:
106 static PassRefPtrWillBeRawPtr<SVGEnumeration<Enum>> create(Enum newValue) 106 static PassRefPtrWillBeRawPtr<SVGEnumeration<Enum>> create(Enum newValue)
107 { 107 {
108 return adoptRefWillBeNoop(new SVGEnumeration<Enum>(newValue)); 108 return adoptRefWillBeNoop(new SVGEnumeration<Enum>(newValue));
109 } 109 }
110 110
111 virtual ~SVGEnumeration() 111 ~SVGEnumeration() override {}
112 {
113 }
114 112
115 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const override 113 PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const override
116 { 114 {
117 return create(enumValue()); 115 return create(enumValue());
118 } 116 }
119 117
120 Enum enumValue() const 118 Enum enumValue() const
121 { 119 {
122 ASSERT(m_value <= maxInternalEnumValue()); 120 ASSERT(m_value <= maxInternalEnumValue());
123 return static_cast<Enum>(m_value); 121 return static_cast<Enum>(m_value);
124 } 122 }
125 123
126 void setEnumValue(Enum value) 124 void setEnumValue(Enum value)
127 { 125 {
128 m_value = value; 126 m_value = value;
129 notifyChange(); 127 notifyChange();
130 } 128 }
131 129
132 protected: 130 protected:
133 explicit SVGEnumeration(Enum newValue) 131 explicit SVGEnumeration(Enum newValue)
134 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp osedEnumValue<Enum>()) 132 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp osedEnumValue<Enum>())
135 { 133 {
136 } 134 }
137 }; 135 };
138 136
139 } // namespace blink 137 } // namespace blink
140 138
141 #endif // SVGEnumeration_h 139 #endif // SVGEnumeration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698