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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include "core/svg/SVGBoolean.h" | 33 #include "core/svg/SVGBoolean.h" |
34 | 34 |
35 #include "bindings/v8/ExceptionState.h" | 35 #include "bindings/v8/ExceptionState.h" |
36 #include "bindings/v8/ExceptionStatePlaceholder.h" | 36 #include "bindings/v8/ExceptionStatePlaceholder.h" |
37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
38 #include "core/svg/SVGAnimationElement.h" | 38 #include "core/svg/SVGAnimationElement.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 PassRefPtr<NewSVGPropertyBase> SVGBoolean::cloneForAnimation(const String& value
) const | 42 PassRefPtr<SVGPropertyBase> SVGBoolean::cloneForAnimation(const String& value) c
onst |
43 { | 43 { |
44 RefPtr<SVGBoolean> svgBoolean = create(); | 44 RefPtr<SVGBoolean> svgBoolean = create(); |
45 svgBoolean->setValueAsString(value, IGNORE_EXCEPTION); | 45 svgBoolean->setValueAsString(value, IGNORE_EXCEPTION); |
46 return svgBoolean.release(); | 46 return svgBoolean.release(); |
47 } | 47 } |
48 | 48 |
49 String SVGBoolean::valueAsString() const | 49 String SVGBoolean::valueAsString() const |
50 { | 50 { |
51 return m_value ? "true" : "false"; | 51 return m_value ? "true" : "false"; |
52 } | 52 } |
53 | 53 |
54 void SVGBoolean::setValueAsString(const String& value, ExceptionState& exception
State) | 54 void SVGBoolean::setValueAsString(const String& value, ExceptionState& exception
State) |
55 { | 55 { |
56 if (value == "true") { | 56 if (value == "true") { |
57 m_value = true; | 57 m_value = true; |
58 } else if (value == "false") { | 58 } else if (value == "false") { |
59 m_value = false; | 59 m_value = false; |
60 } else { | 60 } else { |
61 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid."); | 61 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid."); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 void SVGBoolean::add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) | 65 void SVGBoolean::add(PassRefPtr<SVGPropertyBase>, SVGElement*) |
66 { | 66 { |
67 ASSERT_NOT_REACHED(); | 67 ASSERT_NOT_REACHED(); |
68 } | 68 } |
69 | 69 |
70 void SVGBoolean::calculateAnimatedValue(SVGAnimationElement* animationElement, f
loat percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, Pass
RefPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase>, SVGElement*) | 70 void SVGBoolean::calculateAnimatedValue(SVGAnimationElement* animationElement, f
loat percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRef
Ptr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase>, SVGElement*) |
71 { | 71 { |
72 ASSERT(animationElement); | 72 ASSERT(animationElement); |
73 bool fromBoolean = animationElement->animationMode() == ToAnimation ? m_valu
e : toSVGBoolean(from)->value(); | 73 bool fromBoolean = animationElement->animationMode() == ToAnimation ? m_valu
e : toSVGBoolean(from)->value(); |
74 bool toBoolean = toSVGBoolean(to)->value(); | 74 bool toBoolean = toSVGBoolean(to)->value(); |
75 | 75 |
76 animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoole
an, m_value); | 76 animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoole
an, m_value); |
77 } | 77 } |
78 | 78 |
79 float SVGBoolean::calculateDistance(PassRefPtr<NewSVGPropertyBase>, SVGElement*) | 79 float SVGBoolean::calculateDistance(PassRefPtr<SVGPropertyBase>, SVGElement*) |
80 { | 80 { |
81 // No paced animations for boolean. | 81 // No paced animations for boolean. |
82 return -1; | 82 return -1; |
83 } | 83 } |
84 | 84 |
85 } | 85 } |
OLD | NEW |