OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | |
4 * | 3 * |
5 * This library is free software; you can redistribute it and/or | 4 * Redistribution and use in source and binary forms, with or without |
6 * modify it under the terms of the GNU Library General Public | 5 * modification, are permitted provided that the following conditions are |
7 * License as published by the Free Software Foundation; either | 6 * met: |
8 * version 2 of the License, or (at your option) any later version. | |
9 * | 7 * |
10 * This library is distributed in the hope that it will be useful, | 8 * * Redistributions of source code must retain the above copyright |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 * notice, this list of conditions and the following disclaimer. |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 * * Redistributions in binary form must reproduce the above |
13 * 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. |
14 * | 17 * |
15 * You should have received a copy of the GNU Library General Public License | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
16 * 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 |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
18 * 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. |
19 */ | 29 */ |
20 | 30 |
21 #ifndef SVGTransformList_h | 31 #ifndef SVGTransformList_h |
22 #define SVGTransformList_h | 32 #define SVGTransformList_h |
23 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" |
24 #include "core/svg/SVGTransform.h" | 35 #include "core/svg/SVGTransform.h" |
25 #include "core/svg/properties/SVGPropertyTraits.h" | 36 #include "core/svg/properties/NewSVGListPropertyHelper.h" |
26 #include "wtf/Vector.h" | |
27 | 37 |
28 namespace WebCore { | 38 namespace WebCore { |
29 | 39 |
30 class SVGTransformList : public Vector<SVGTransform> { | 40 class SVGTransformListTearOff; |
| 41 |
| 42 class SVGTransformList FINAL : public NewSVGListPropertyHelper<SVGTransformList,
SVGTransform> { |
31 public: | 43 public: |
32 SVGTransformList() { } | 44 typedef SVGTransformListTearOff TearOffType; |
33 | 45 |
34 SVGTransform createSVGTransformFromMatrix(const SVGMatrix&) const; | 46 static PassRefPtr<SVGTransformList> create() |
35 SVGTransform consolidate(); | 47 { |
| 48 return adoptRef(new SVGTransformList()); |
| 49 } |
36 | 50 |
37 // Internal use only | 51 static PassRefPtr<SVGTransformList> create(SVGTransformType, const String&); |
| 52 |
| 53 virtual ~SVGTransformList(); |
| 54 |
| 55 PassRefPtr<SVGTransform> createSVGTransformFromMatrix(const AffineTransform&
) const; |
| 56 PassRefPtr<SVGTransform> consolidate(); |
| 57 |
38 bool concatenate(AffineTransform& result) const; | 58 bool concatenate(AffineTransform& result) const; |
39 | 59 |
40 String valueAsString() const; | 60 // NewSVGPropertyBase: |
41 void parse(const String&); | 61 virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) cons
t OVERRIDE; |
42 }; | 62 PassRefPtr<SVGTransformList> clone(); |
43 | 63 |
44 template<> | 64 virtual String valueAsString() const OVERRIDE; |
45 struct SVGPropertyTraits<SVGTransformList> { | 65 void setValueAsString(const String&, ExceptionState&); |
46 static SVGTransformList initialValue() { return SVGTransformList(); } | 66 bool parse(const UChar*& ptr, const UChar* end); |
47 static String toString(const SVGTransformList& type) { return type.valueAsSt
ring(); } | 67 bool parse(const LChar*& ptr, const LChar* end); |
48 typedef SVGTransform ListItemType; | 68 |
| 69 virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE; |
| 70 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValue, PassRefPtr<NewSV
GPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, S
VGElement*) OVERRIDE; |
| 71 virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElemen
t*) OVERRIDE; |
| 72 |
| 73 static AnimatedPropertyType classType() { return AnimatedTransformList; } |
| 74 |
| 75 private: |
| 76 SVGTransformList(); |
| 77 |
| 78 bool adjustFromToListValues(PassRefPtr<SVGTransformList> fromList, PassRefPt
r<SVGTransformList> toList, float percentage, bool isToAnimation, bool resizeAni
matedListIfNeeded); |
| 79 |
| 80 template <typename CharType> |
| 81 bool parseInternal(const CharType*& ptr, const CharType* end); |
49 }; | 82 }; |
50 | 83 |
51 } // namespace WebCore | 84 } // namespace WebCore |
52 | 85 |
53 #endif // SVGTransformList_h | 86 #endif // SVGTransformList_h |
OLD | NEW |