blob: 0e19d4d3e6665b5c8b15654800023381bc56683e [file] [log] [blame]
zimmermann@webkit.orgf08b5ba2010-10-30 13:23:55 +00001/*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
commit-queue@webkit.org46c0f522016-11-13 10:05:43 +000020#pragma once
zimmermann@webkit.orgf08b5ba2010-10-30 13:23:55 +000021
zimmermann@webkit.orge5a72c62010-12-01 16:36:29 +000022#include "SVGAnimatedPropertyMacros.h"
krit@webkit.org1c0529c2010-12-22 12:25:23 +000023#include "SVGAnimatedStaticPropertyTearOff.h"
krit@webkit.orgba287042011-06-23 17:42:16 +000024#include "SVGAnimatedTypeAnimator.h"
zimmermann@webkit.orgf08b5ba2010-10-30 13:23:55 +000025
26namespace WebCore {
27
28typedef SVGAnimatedStaticPropertyTearOff<float> SVGAnimatedNumber;
29
zimmermann@webkit.orge5a72c62010-12-01 16:36:29 +000030// Helper macros to declare/define a SVGAnimatedNumber object
31#define DECLARE_ANIMATED_NUMBER(UpperProperty, LowerProperty) \
zandobersek@gmail.com7d97f1c2015-06-12 13:44:43 +000032DECLARE_ANIMATED_PROPERTY(SVGAnimatedNumber, float, UpperProperty, LowerProperty, )
zimmermann@webkit.orge5a72c62010-12-01 16:36:29 +000033
34#define DEFINE_ANIMATED_NUMBER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
commit-queue@webkit.orgafac0052017-10-30 23:41:01 +000035DEFINE_ANIMATED_PROPERTY(AnimatedNumber, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
zimmermann@webkit.orge5a72c62010-12-01 16:36:29 +000036
37#define DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \
zimmermann@webkit.orga2857422011-07-09 11:26:10 +000038DEFINE_ANIMATED_PROPERTY(AnimatedNumberOptionalNumber, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty)
zimmermann@webkit.orge5a72c62010-12-01 16:36:29 +000039
krit@webkit.orgba287042011-06-23 17:42:16 +000040class SVGAnimationElement;
41
andersca@apple.com16d2dd42014-01-16 23:08:24 +000042class SVGAnimatedNumberAnimator final : public SVGAnimatedTypeAnimator {
krit@webkit.orgc589d8c2011-06-19 20:11:24 +000043public:
krit@webkit.orgba287042011-06-23 17:42:16 +000044 SVGAnimatedNumberAnimator(SVGAnimationElement*, SVGElement*);
paroga@webkit.org09d08d62011-06-30 11:41:14 +000045
darin@apple.com11ff47c2016-03-04 16:47:55 +000046 std::unique_ptr<SVGAnimatedType> constructFromString(const String&) override;
47 std::unique_ptr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
48 void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
49 void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SVGAnimatedType&) override;
50 void animValWillChange(const SVGElementAnimatedPropertyList&) override;
51 void animValDidChange(const SVGElementAnimatedPropertyList&) override;
paroga@webkit.org09d08d62011-06-30 11:41:14 +000052
darin@apple.com11ff47c2016-03-04 16:47:55 +000053 void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) override;
54 void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) override;
55 float calculateDistance(const String& fromString, const String& toString) override;
krit@webkit.orgc589d8c2011-06-19 20:11:24 +000056};
paroga@webkit.org09d08d62011-06-30 11:41:14 +000057
zimmermann@webkit.orgf08b5ba2010-10-30 13:23:55 +000058} // namespace WebCore