OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "bindings/v8/ExceptionState.h" | 26 #include "bindings/v8/ExceptionState.h" |
27 #include "core/dom/ExceptionCode.h" | 27 #include "core/dom/ExceptionCode.h" |
28 #include "core/svg/SVGAnimationElement.h" | 28 #include "core/svg/SVGAnimationElement.h" |
29 #include "core/svg/SVGParserUtilities.h" | 29 #include "core/svg/SVGParserUtilities.h" |
30 #include "wtf/text/StringBuilder.h" | 30 #include "wtf/text/StringBuilder.h" |
31 #include "wtf/text/WTFString.h" | 31 #include "wtf/text/WTFString.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 SVGRect::SVGRect() | 35 SVGRect::SVGRect() |
36 : NewSVGPropertyBase(classType()) | 36 : SVGPropertyBase(classType()) |
37 , m_isValid(true) | 37 , m_isValid(true) |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 SVGRect::SVGRect(InvalidSVGRectTag) | 41 SVGRect::SVGRect(InvalidSVGRectTag) |
42 : NewSVGPropertyBase(classType()) | 42 : SVGPropertyBase(classType()) |
43 { | 43 { |
44 setInvalid(); | 44 setInvalid(); |
45 } | 45 } |
46 | 46 |
47 SVGRect::SVGRect(const FloatRect& rect) | 47 SVGRect::SVGRect(const FloatRect& rect) |
48 : NewSVGPropertyBase(classType()) | 48 : SVGPropertyBase(classType()) |
49 , m_isValid(true) | 49 , m_isValid(true) |
50 , m_value(rect) | 50 , m_value(rect) |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 PassRefPtr<SVGRect> SVGRect::clone() const | 54 PassRefPtr<SVGRect> SVGRect::clone() const |
55 { | 55 { |
56 return SVGRect::create(m_value); | 56 return SVGRect::create(m_value); |
57 } | 57 } |
58 | 58 |
59 PassRefPtr<NewSVGPropertyBase> SVGRect::cloneForAnimation(const String& value) c
onst | 59 PassRefPtr<SVGPropertyBase> SVGRect::cloneForAnimation(const String& value) cons
t |
60 { | 60 { |
61 RefPtr<SVGRect> rect = SVGRect::create(); | 61 RefPtr<SVGRect> rect = SVGRect::create(); |
62 rect->setValueAsString(value, IGNORE_EXCEPTION); | 62 rect->setValueAsString(value, IGNORE_EXCEPTION); |
63 return rect.release(); | 63 return rect.release(); |
64 } | 64 } |
65 | 65 |
66 template<typename CharType> | 66 template<typename CharType> |
67 void SVGRect::parse(const CharType*& ptr, const CharType* end, ExceptionState& e
xceptionState) | 67 void SVGRect::parse(const CharType*& ptr, const CharType* end, ExceptionState& e
xceptionState) |
68 { | 68 { |
69 const CharType* start = ptr; | 69 const CharType* start = ptr; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 builder.append(String::number(x())); | 123 builder.append(String::number(x())); |
124 builder.append(' '); | 124 builder.append(' '); |
125 builder.append(String::number(y())); | 125 builder.append(String::number(y())); |
126 builder.append(' '); | 126 builder.append(' '); |
127 builder.append(String::number(width())); | 127 builder.append(String::number(width())); |
128 builder.append(' '); | 128 builder.append(' '); |
129 builder.append(String::number(height())); | 129 builder.append(String::number(height())); |
130 return builder.toString(); | 130 return builder.toString(); |
131 } | 131 } |
132 | 132 |
133 void SVGRect::add(PassRefPtr<NewSVGPropertyBase> other, SVGElement*) | 133 void SVGRect::add(PassRefPtr<SVGPropertyBase> other, SVGElement*) |
134 { | 134 { |
135 m_value += toSVGRect(other)->value(); | 135 m_value += toSVGRect(other)->value(); |
136 } | 136 } |
137 | 137 |
138 void SVGRect::calculateAnimatedValue(SVGAnimationElement* animationElement, floa
t percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValue, Pa
ssRefPtr<NewSVGPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEndOfDu
rationValue, SVGElement*) | 138 void SVGRect::calculateAnimatedValue(SVGAnimationElement* animationElement, floa
t percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue, PassR
efPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurationVal
ue, SVGElement*) |
139 { | 139 { |
140 ASSERT(animationElement); | 140 ASSERT(animationElement); |
141 RefPtr<SVGRect> fromRect = animationElement->animationMode() == ToAnimation
? this : toSVGRect(fromValue); | 141 RefPtr<SVGRect> fromRect = animationElement->animationMode() == ToAnimation
? this : toSVGRect(fromValue); |
142 RefPtr<SVGRect> toRect = toSVGRect(toValue); | 142 RefPtr<SVGRect> toRect = toSVGRect(toValue); |
143 RefPtr<SVGRect> toAtEndOfDurationRect = toSVGRect(toAtEndOfDurationValue); | 143 RefPtr<SVGRect> toAtEndOfDurationRect = toSVGRect(toAtEndOfDurationValue); |
144 | 144 |
145 float animatedX = x(); | 145 float animatedX = x(); |
146 float animatedY = y(); | 146 float animatedY = y(); |
147 float animatedWidth = width(); | 147 float animatedWidth = width(); |
148 float animatedHeight = height(); | 148 float animatedHeight = height(); |
149 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->x
(), toRect->x(), toAtEndOfDurationRect->x(), animatedX); | 149 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->x
(), toRect->x(), toAtEndOfDurationRect->x(), animatedX); |
150 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->y
(), toRect->y(), toAtEndOfDurationRect->y(), animatedY); | 150 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->y
(), toRect->y(), toAtEndOfDurationRect->y(), animatedY); |
151 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->w
idth(), toRect->width(), toAtEndOfDurationRect->width(), animatedWidth); | 151 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->w
idth(), toRect->width(), toAtEndOfDurationRect->width(), animatedWidth); |
152 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->h
eight(), toRect->height(), toAtEndOfDurationRect->height(), animatedHeight); | 152 animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->h
eight(), toRect->height(), toAtEndOfDurationRect->height(), animatedHeight); |
153 | 153 |
154 m_value = FloatRect(animatedX, animatedY, animatedWidth, animatedHeight); | 154 m_value = FloatRect(animatedX, animatedY, animatedWidth, animatedHeight); |
155 } | 155 } |
156 | 156 |
157 float SVGRect::calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElement*
contextElement) | 157 float SVGRect::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement* con
textElement) |
158 { | 158 { |
159 // FIXME: Distance calculation is not possible for SVGRect right now. We nee
d the distance for every single value. | 159 // FIXME: Distance calculation is not possible for SVGRect right now. We nee
d the distance for every single value. |
160 return -1; | 160 return -1; |
161 } | 161 } |
162 | 162 |
163 void SVGRect::setInvalid() | 163 void SVGRect::setInvalid() |
164 { | 164 { |
165 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f); | 165 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f); |
166 m_isValid = false; | 166 m_isValid = false; |
167 } | 167 } |
168 | 168 |
169 } | 169 } |
OLD | NEW |