OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * Copyright (C) 2004, 2005, 2006 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 SVGLengthList_h | 31 #ifndef SVGLengthList_h |
22 #define SVGLengthList_h | 32 #define SVGLengthList_h |
23 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" |
24 #include "core/svg/SVGLength.h" | 35 #include "core/svg/SVGLength.h" |
25 #include "wtf/Vector.h" | 36 #include "core/svg/properties/NewSVGListPropertyHelper.h" |
26 | 37 |
27 namespace WebCore { | 38 namespace WebCore { |
28 | 39 |
29 class SVGLengthList : public Vector<SVGLength> { | 40 class SVGLengthListTearOff; |
| 41 |
| 42 class SVGLengthList : public NewSVGListPropertyHelper<SVGLengthList, SVGLength>
{ |
30 public: | 43 public: |
31 SVGLengthList() { } | 44 typedef SVGLengthListTearOff TearOffType; |
32 | 45 |
33 void parse(const String& value, SVGLengthMode); | 46 static PassRefPtr<SVGLengthList> create(SVGLengthMode mode = LengthModeOther
) |
34 String valueAsString() const; | 47 { |
| 48 return adoptRef(new SVGLengthList(mode)); |
| 49 } |
| 50 |
| 51 ~SVGLengthList(); |
| 52 |
| 53 PassRefPtr<SVGLengthList> clone(); |
| 54 |
| 55 void setValueAsString(const String&, ExceptionState&); |
| 56 |
| 57 // NewSVGPropertyBase: |
| 58 virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) cons
t OVERRIDE; |
| 59 virtual String valueAsString() const OVERRIDE; |
| 60 |
| 61 virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE; |
| 62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValue, PassRefPtr<NewSV
GPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, S
VGElement*) OVERRIDE; |
| 63 virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElemen
t*) OVERRIDE; |
| 64 |
| 65 static AnimatedPropertyType classType() { return AnimatedLengthList; } |
35 | 66 |
36 private: | 67 private: |
37 template<typename CharType> | 68 explicit SVGLengthList(SVGLengthMode); |
38 void parseInternal(const CharType*& ptr, const CharType* end, SVGLengthMode)
; | |
39 }; | |
40 | 69 |
41 template<> | 70 bool adjustFromToListValues(PassRefPtr<SVGLengthList> fromList, PassRefPtr<S
VGLengthList> toList, float percentage, bool isToAnimation, bool resizeAnimatedL
istIfNeeded); |
42 struct SVGPropertyTraits<SVGLengthList> { | |
43 typedef SVGLength ListItemType; | |
44 | 71 |
45 static SVGLengthList initialValue() { return SVGLengthList(); } | 72 template <typename CharType> |
46 static String toString(const SVGLengthList& type) { return type.valueAsStrin
g(); } | 73 void parseInternal(const CharType*& ptr, const CharType* end, ExceptionState
&); |
| 74 |
| 75 SVGLengthMode m_mode; |
47 }; | 76 }; |
48 | 77 |
49 } // namespace WebCore | 78 } // namespace WebCore |
50 | 79 |
51 #endif | 80 #endif // SVGLengthList_h |
OLD | NEW |