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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void SVGEnumerationBase::setValue(unsigned short value) { | 58 void SVGEnumerationBase::setValue(unsigned short value) { |
59 m_value = value; | 59 m_value = value; |
60 notifyChange(); | 60 notifyChange(); |
61 } | 61 } |
62 | 62 |
63 SVGParsingError SVGEnumerationBase::setValueAsString(const String& string) { | 63 SVGParsingError SVGEnumerationBase::setValueAsString(const String& string) { |
64 for (const auto& entry : m_entries) { | 64 for (const auto& entry : m_entries) { |
65 if (string == entry.second) { | 65 if (string == entry.second) { |
66 // 0 corresponds to _UNKNOWN enumeration values, and should not be settabl
e. | 66 // 0 corresponds to _UNKNOWN enumeration values, and should not be |
| 67 // settable. |
67 ASSERT(entry.first); | 68 ASSERT(entry.first); |
68 m_value = entry.first; | 69 m_value = entry.first; |
69 notifyChange(); | 70 notifyChange(); |
70 return SVGParseStatus::NoError; | 71 return SVGParseStatus::NoError; |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
74 notifyChange(); | 75 notifyChange(); |
75 return SVGParseStatus::ExpectedEnumeration; | 76 return SVGParseStatus::ExpectedEnumeration; |
76 } | 77 } |
(...skipping 20 matching lines...) Expand all Loading... |
97 animationElement->animateDiscreteType<unsigned short>( | 98 animationElement->animateDiscreteType<unsigned short>( |
98 percentage, fromEnumeration, toEnumeration, m_value); | 99 percentage, fromEnumeration, toEnumeration, m_value); |
99 } | 100 } |
100 | 101 |
101 float SVGEnumerationBase::calculateDistance(SVGPropertyBase*, SVGElement*) { | 102 float SVGEnumerationBase::calculateDistance(SVGPropertyBase*, SVGElement*) { |
102 // No paced animations for boolean. | 103 // No paced animations for boolean. |
103 return -1; | 104 return -1; |
104 } | 105 } |
105 | 106 |
106 } // namespace blink | 107 } // namespace blink |
OLD | NEW |