Index: Source/core/svg/SVGBoolean.h |
diff --git a/Source/core/svg/SVGLengthList.h b/Source/core/svg/SVGBoolean.h |
similarity index 61% |
copy from Source/core/svg/SVGLengthList.h |
copy to Source/core/svg/SVGBoolean.h |
index 0b65bad3a1c9d11dca61942520f3df35980122c4..9444ed20cdd81181b29323d386bd73d9ae0cc60d 100644 |
--- a/Source/core/svg/SVGLengthList.h |
+++ b/Source/core/svg/SVGBoolean.h |
@@ -28,53 +28,60 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef SVGLengthList_h |
-#define SVGLengthList_h |
+#ifndef SVGBoolean_h |
+#define SVGBoolean_h |
-#include "bindings/v8/ScriptWrappable.h" |
-#include "core/svg/SVGLength.h" |
-#include "core/svg/properties/NewSVGListPropertyHelper.h" |
+#include "core/svg/properties/NewSVGProperty.h" |
namespace WebCore { |
-class SVGLengthListTearOff; |
- |
-class SVGLengthList FINAL : public NewSVGListPropertyHelper<SVGLengthList, SVGLength> { |
+class SVGBoolean : public NewSVGPropertyBase { |
public: |
- typedef SVGLengthListTearOff TearOffType; |
+ // SVGBoolean does not have a tear-off type. |
+ // The below typedef is used by NewSVGAnimatedProperty. |
+ typedef void TearOffType; |
+ typedef bool PrimitiveType; |
- static PassRefPtr<SVGLengthList> create(SVGLengthMode mode = LengthModeOther) |
+ static PassRefPtr<SVGBoolean> create(bool value = false) |
{ |
- return adoptRef(new SVGLengthList(mode)); |
+ return adoptRef(new SVGBoolean(value)); |
} |
- virtual ~SVGLengthList(); |
- |
- PassRefPtr<SVGLengthList> clone(); |
- |
- void setValueAsString(const String&, ExceptionState&); |
- |
- // NewSVGPropertyBase: |
+ PassRefPtr<SVGBoolean> clone() const { return create(m_value); } |
virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) const OVERRIDE; |
+ |
virtual String valueAsString() const OVERRIDE; |
+ void setValueAsString(const String&, ExceptionState&); |
virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE; |
- virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValue, PassRefPtr<NewSVGPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, SVGElement*) OVERRIDE; |
+ virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRefPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, SVGElement*) OVERRIDE; |
virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElement*) OVERRIDE; |
- static AnimatedPropertyType classType() { return AnimatedLengthList; } |
+ bool operator==(const SVGBoolean& other) const { return m_value == other.m_value; } |
+ bool operator!=(const SVGBoolean& other) const { return !operator==(other); } |
-private: |
- explicit SVGLengthList(SVGLengthMode); |
+ bool value() const { return m_value; } |
+ void setValue(bool value) { m_value = value; } |
- bool adjustFromToListValues(PassRefPtr<SVGLengthList> fromList, PassRefPtr<SVGLengthList> toList, float percentage, bool isToAnimation, bool resizeAnimatedListIfNeeded); |
+ static AnimatedPropertyType classType() { return AnimatedBoolean; } |
- template <typename CharType> |
- void parseInternal(const CharType*& ptr, const CharType* end, ExceptionState&); |
+private: |
+ SVGBoolean(bool value) |
+ : NewSVGPropertyBase(classType()) |
+ , m_value(value) |
+ { |
+ } |
- SVGLengthMode m_mode; |
+ bool m_value; |
}; |
+inline PassRefPtr<SVGBoolean> toSVGBoolean(PassRefPtr<NewSVGPropertyBase> passBase) |
+{ |
+ RefPtr<NewSVGPropertyBase> base = passBase; |
+ ASSERT(base->type() == SVGBoolean::classType()); |
+ return static_pointer_cast<SVGBoolean>(base.release()); |
+} |
+ |
} // namespace WebCore |
-#endif // SVGLengthList_h |
+#endif // SVGBoolean_h |