Chromium Code Reviews| 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 3d9b622a7a639bf822f3f3a4401f1fc6dbc92182..2f3e43d489113c4bdf23d1da2eeb22c39b53e01c 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 : public NewSVGListPropertyHelper<SVGLengthList, SVGLength> { |
| +class SVGBoolean : public NewSVGPropertyBase { |
| public: |
| - typedef SVGLengthListTearOff TearOffType; |
| + // SVGBoolean do not have a tear-off type. |
|
haraken
2014/01/09 11:09:23
do not => does not
kouhei (in TOK)
2014/01/10 08:16:10
Done.
|
| + // 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)); |
| } |
| - ~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) |
|
haraken
2014/01/09 11:09:23
It looks a bit strange that toXXX takes a PassRefP
kouhei (in TOK)
2014/01/10 08:16:10
Discussed offline. Keeping this.
|
| +{ |
| + RefPtr<NewSVGPropertyBase> base = passBase; |
| + ASSERT(base->type() == SVGBoolean::classType()); |
| + return static_pointer_cast<SVGBoolean>(base.release()); |
| +} |
| + |
| } // namespace WebCore |
| -#endif // SVGLengthList_h |
| +#endif // SVGBoolean_h |