| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SVGEnumeration_h | 31 #ifndef SVGEnumeration_h |
| 32 #define SVGEnumeration_h | 32 #define SVGEnumeration_h |
| 33 | 33 |
| 34 #include "core/svg/SVGParsingError.h" |
| 34 #include "core/svg/properties/SVGProperty.h" | 35 #include "core/svg/properties/SVGProperty.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 class ExceptionState; | |
| 39 | |
| 40 class SVGEnumerationBase : public SVGPropertyBase { | 39 class SVGEnumerationBase : public SVGPropertyBase { |
| 41 public: | 40 public: |
| 42 typedef std::pair<unsigned short, String> StringEntry; | 41 typedef std::pair<unsigned short, String> StringEntry; |
| 43 typedef Vector<StringEntry> StringEntries; | 42 typedef Vector<StringEntry> StringEntries; |
| 44 | 43 |
| 45 // SVGEnumeration does not have a tear-off type. | 44 // SVGEnumeration does not have a tear-off type. |
| 46 typedef void TearOffType; | 45 typedef void TearOffType; |
| 47 typedef unsigned short PrimitiveType; | 46 typedef unsigned short PrimitiveType; |
| 48 | 47 |
| 49 ~SVGEnumerationBase() override; | 48 ~SVGEnumerationBase() override; |
| 50 | 49 |
| 51 unsigned short value() const { return m_value <= maxExposedEnumValue() ? m_v
alue : 0; } | 50 unsigned short value() const { return m_value <= maxExposedEnumValue() ? m_v
alue : 0; } |
| 52 void setValue(unsigned short); | 51 void setValue(unsigned short); |
| 53 | 52 |
| 54 // SVGPropertyBase: | 53 // SVGPropertyBase: |
| 55 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const = 0; | 54 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const = 0; |
| 56 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con
st override; | 55 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con
st override; |
| 57 | 56 |
| 58 String valueAsString() const override; | 57 String valueAsString() const override; |
| 59 void setValueAsString(const String&, ExceptionState&); | 58 SVGParsingError setValueAsString(const String&); |
| 60 | 59 |
| 61 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; | 60 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
| 62 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned
repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWillBeRawP
tr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDuratio
nValue, SVGElement*) override; | 61 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned
repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWillBeRawP
tr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDuratio
nValue, SVGElement*) override; |
| 63 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme
nt*) override; | 62 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme
nt*) override; |
| 64 | 63 |
| 65 static AnimatedPropertyType classType() { return AnimatedEnumeration; } | 64 static AnimatedPropertyType classType() { return AnimatedEnumeration; } |
| 66 | 65 |
| 67 static unsigned short valueOfLastEnum(const StringEntries& entries) { return
entries.last().first; } | 66 static unsigned short valueOfLastEnum(const StringEntries& entries) { return
entries.last().first; } |
| 68 | 67 |
| 69 // This is the maximum value that is exposed as an IDL constant on the relev
ant interface. | 68 // This is the maximum value that is exposed as an IDL constant on the relev
ant interface. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 protected: | 126 protected: |
| 128 explicit SVGEnumeration(Enum newValue) | 127 explicit SVGEnumeration(Enum newValue) |
| 129 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp
osedEnumValue<Enum>()) | 128 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp
osedEnumValue<Enum>()) |
| 130 { | 129 { |
| 131 } | 130 } |
| 132 }; | 131 }; |
| 133 | 132 |
| 134 } // namespace blink | 133 } // namespace blink |
| 135 | 134 |
| 136 #endif // SVGEnumeration_h | 135 #endif // SVGEnumeration_h |
| OLD | NEW |