Chromium Code Reviews| Index: Source/core/svg/SVGNumber.h |
| diff --git a/Source/core/html/URLRegistry.h b/Source/core/svg/SVGNumber.h |
| similarity index 63% |
| copy from Source/core/html/URLRegistry.h |
| copy to Source/core/svg/SVGNumber.h |
| index 660acb92852636ea136d2c49dfa68c31e268946b..82edc5a53f1958d83a22905ed7ed31b7dc70b5e1 100644 |
| --- a/Source/core/html/URLRegistry.h |
| +++ b/Source/core/svg/SVGNumber.h |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (C) 2013 Google Inc. All rights reserved. |
| + * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are |
| @@ -28,34 +28,47 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef URLRegistry_h |
| -#define URLRegistry_h |
| +#ifndef SVGNumber_h |
| +#define SVGNumber_h |
| -#include "wtf/text/WTFString.h" |
| +#include "core/svg/properties/SVGPropertyTraits.h" |
| namespace WebCore { |
| -class KURL; |
| -class SecurityOrigin; |
| -class URLRegistry; |
| - |
| -class URLRegistrable { |
| +class SVGNumber { |
| + WTF_MAKE_FAST_ALLOCATED; |
| public: |
| - virtual ~URLRegistrable() { } |
| - virtual URLRegistry& registry() const = 0; |
| + SVGNumber() |
| + : m_value(0) |
|
abarth-chromium
2013/07/15 21:10:07
This line should be indented four more spaces.
|
| + { } |
|
abarth-chromium
2013/07/15 21:10:07
These should each be on their own line.
|
| + |
| + SVGNumber(float value) |
| + : m_value(value) |
| + { } |
| + |
| + SVGNumber& operator+=(const SVGNumber& rhs) |
| + { |
| + m_value += rhs.value(); |
| + return *this; |
| + } |
| + |
| + float value() const { return m_value; } |
| + float& valueRef() { return m_value; } |
| + String valueAsString() const { return String::number(m_value); } |
| + void setValue(float value) { m_value = value; } |
| + |
| +private: |
| + float m_value; |
| }; |
| -class URLRegistry { |
| - WTF_MAKE_FAST_ALLOCATED; |
| -public: |
| - virtual ~URLRegistry() { } |
| - virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) = 0; |
| - virtual void unregisterURL(const KURL&) = 0; |
| +COMPILE_ASSERT(sizeof(SVGNumber) == sizeof(float), SVGNumber_same_size_as_float); |
| - // This is an optional API |
| - virtual URLRegistrable* lookup(const String&) { ASSERT_NOT_REACHED(); return 0; } |
| +template<> |
| +struct SVGPropertyTraits<SVGNumber> { |
| + static SVGNumber initialValue() { return SVGNumber(); } |
| + static String toString(const SVGNumber& type) { return type.valueAsString(); } |
| }; |
| } // namespace WebCore |
| -#endif // URLRegistry_h |
| +#endif // SVGNumber_h |