| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modification, are permitted provided that the following conditions are |
| 6 * License as published by the Free Software Foundation; either | 6 * met: |
| 7 * version 2 of the License, or (at your option) any later version. | |
| 8 * | 7 * |
| 9 * This library is distributed in the hope that it will be useful, | 8 * * Redistributions of source code must retain the above copyright |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 * notice, this list of conditions and the following disclaimer. |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 * * Redistributions in binary form must reproduce the above |
| 12 * Library General Public License for more details. | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 13 * | 17 * |
| 14 * You should have received a copy of the GNU Library General Public License | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 * Boston, MA 02110-1301, USA. | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 18 */ | 29 */ |
| 19 | 30 |
| 20 #ifndef SVGAnimatedRect_h | 31 #ifndef SVGAnimatedRect_h |
| 21 #define SVGAnimatedRect_h | 32 #define SVGAnimatedRect_h |
| 22 | 33 |
| 23 #include "core/svg/SVGAnimatedTypeAnimator.h" | 34 #include "core/svg/SVGRectTearOff.h" |
| 24 #include "core/svg/SVGRect.h" | 35 #include "core/svg/properties/NewSVGAnimatedProperty.h" |
| 25 #include "core/svg/properties/SVGAnimatedPropertyMacros.h" | |
| 26 #include "core/svg/properties/SVGAnimatedPropertyTearOff.h" | |
| 27 | 36 |
| 28 namespace WebCore { | 37 namespace WebCore { |
| 29 | 38 |
| 30 typedef SVGAnimatedPropertyTearOff<SVGRect> SVGAnimatedRect; | 39 class SVGAnimatedRect : public NewSVGAnimatedProperty<SVGRect> { |
| 40 public: |
| 41 static PassRefPtr<SVGAnimatedRect> create(SVGElement* contextElement, const
QualifiedName& attributeName) |
| 42 { |
| 43 return adoptRef(new SVGAnimatedRect(contextElement, attributeName)); |
| 44 } |
| 31 | 45 |
| 32 // Helper macros to declare/define a SVGAnimatedRect object | 46 protected: |
| 33 #define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \ | 47 SVGAnimatedRect(SVGElement* contextElement, const QualifiedName& attributeNa
me) |
| 34 DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, SVGRect, UpperProperty, LowerProperty
) | 48 : NewSVGAnimatedProperty<SVGRect>(contextElement, attributeName, SVGRect
::create(SVGRect::InvalidSVGRectTag())) |
| 35 | 49 { |
| 36 #define DEFINE_ANIMATED_RECT(OwnerType, DOMAttribute, UpperProperty, LowerProper
ty) \ | 50 } |
| 37 DEFINE_ANIMATED_PROPERTY(AnimatedRect, OwnerType, DOMAttribute, DOMAttribute.loc
alName(), UpperProperty, LowerProperty, SVGAnimatedRect, SVGRect) | |
| 38 | |
| 39 class SVGAnimationElement; | |
| 40 | |
| 41 class SVGAnimatedRectAnimator FINAL : public SVGAnimatedTypeAnimator { | |
| 42 public: | |
| 43 SVGAnimatedRectAnimator(SVGAnimationElement*, SVGElement*); | |
| 44 virtual ~SVGAnimatedRectAnimator() { } | |
| 45 | |
| 46 virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&) OVERR
IDE; | |
| 47 virtual PassOwnPtr<SVGAnimatedType> startAnimValAnimation(const SVGElementAn
imatedPropertyList&) OVERRIDE; | |
| 48 virtual void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) OVE
RRIDE; | |
| 49 virtual void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SV
GAnimatedType*) OVERRIDE; | |
| 50 virtual void animValWillChange(const SVGElementAnimatedPropertyList&) OVERRI
DE; | |
| 51 virtual void animValDidChange(const SVGElementAnimatedPropertyList&) OVERRID
E; | |
| 52 | |
| 53 virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) OVERRIDE; | |
| 54 virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) OVERRIDE
; | |
| 55 virtual float calculateDistance(const String& fromString, const String& toSt
ring) OVERRIDE; | |
| 56 }; | 51 }; |
| 57 | 52 |
| 58 } // namespace WebCore | 53 } // namespace WebCore |
| 59 | 54 |
| 60 #endif | 55 #endif // SVGAnimatedRect_h |
| OLD | NEW |