| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 typedef void TearOffType; | 46 typedef void TearOffType; |
| 47 typedef unsigned short PrimitiveType; | 47 typedef unsigned short PrimitiveType; |
| 48 | 48 |
| 49 virtual ~SVGEnumerationBase(); | 49 virtual ~SVGEnumerationBase(); |
| 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 PassRefPtr<SVGEnumerationBase> clone() const = 0; | 55 virtual PassRefPtr<SVGEnumerationBase> clone() const = 0; |
| 56 virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const O
VERRIDE; | 56 virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const o
verride; |
| 57 | 57 |
| 58 virtual String valueAsString() const OVERRIDE; | 58 virtual 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 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr
ide; |
| 62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa
se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) OVERRID
E; | 62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa
se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) overrid
e; |
| 63 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*)
OVERRIDE; | 63 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*)
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 public: | 105 public: |
| 106 static PassRefPtr<SVGEnumeration<Enum> > create(Enum newValue) | 106 static PassRefPtr<SVGEnumeration<Enum> > create(Enum newValue) |
| 107 { | 107 { |
| 108 return adoptRef(new SVGEnumeration<Enum>(newValue)); | 108 return adoptRef(new SVGEnumeration<Enum>(newValue)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual ~SVGEnumeration() | 111 virtual ~SVGEnumeration() |
| 112 { | 112 { |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual PassRefPtr<SVGEnumerationBase> clone() const OVERRIDE | 115 virtual PassRefPtr<SVGEnumerationBase> clone() const override |
| 116 { | 116 { |
| 117 return create(enumValue()); | 117 return create(enumValue()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 Enum enumValue() const | 120 Enum enumValue() const |
| 121 { | 121 { |
| 122 ASSERT(m_value <= maxInternalEnumValue()); | 122 ASSERT(m_value <= maxInternalEnumValue()); |
| 123 return static_cast<Enum>(m_value); | 123 return static_cast<Enum>(m_value); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void setEnumValue(Enum value) | 126 void setEnumValue(Enum value) |
| 127 { | 127 { |
| 128 m_value = value; | 128 m_value = value; |
| 129 notifyChange(); | 129 notifyChange(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 explicit SVGEnumeration(Enum newValue) | 133 explicit SVGEnumeration(Enum newValue) |
| 134 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp
osedEnumValue<Enum>()) | 134 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp
osedEnumValue<Enum>()) |
| 135 { | 135 { |
| 136 } | 136 } |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace blink | 139 } // namespace blink |
| 140 | 140 |
| 141 #endif // SVGEnumeration_h | 141 #endif // SVGEnumeration_h |
| OLD | NEW |