| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
| 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 SVGPath::SVGPath() | 69 SVGPath::SVGPath() |
| 70 : SVGPropertyBase(classType()) | 70 : SVGPropertyBase(classType()) |
| 71 , m_pathValue(CSSPathValue::emptyPathValue()) | 71 , m_pathValue(CSSPathValue::emptyPathValue()) |
| 72 { | 72 { |
| 73 } | 73 } |
| 74 | 74 |
| 75 SVGPath::SVGPath(PassRefPtrWillBeRawPtr<CSSPathValue> pathValue) | 75 SVGPath::SVGPath(RawPtr<CSSPathValue> pathValue) |
| 76 : SVGPropertyBase(classType()) | 76 : SVGPropertyBase(classType()) |
| 77 , m_pathValue(pathValue) | 77 , m_pathValue(pathValue) |
| 78 { | 78 { |
| 79 ASSERT(m_pathValue); | 79 ASSERT(m_pathValue); |
| 80 } | 80 } |
| 81 | 81 |
| 82 SVGPath::~SVGPath() | 82 SVGPath::~SVGPath() |
| 83 { | 83 { |
| 84 } | 84 } |
| 85 | 85 |
| 86 String SVGPath::valueAsString() const | 86 String SVGPath::valueAsString() const |
| 87 { | 87 { |
| 88 return buildStringFromByteStream(byteStream()); | 88 return buildStringFromByteStream(byteStream()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 PassRefPtrWillBeRawPtr<SVGPath> SVGPath::clone() const | 92 RawPtr<SVGPath> SVGPath::clone() const |
| 93 { | 93 { |
| 94 return SVGPath::create(m_pathValue); | 94 return SVGPath::create(m_pathValue); |
| 95 } | 95 } |
| 96 | 96 |
| 97 SVGParsingError SVGPath::setValueAsString(const String& string) | 97 SVGParsingError SVGPath::setValueAsString(const String& string) |
| 98 { | 98 { |
| 99 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); | 99 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
| 100 SVGParsingError parseStatus = buildByteStreamFromString(string, *byteStream)
; | 100 SVGParsingError parseStatus = buildByteStreamFromString(string, *byteStream)
; |
| 101 m_pathValue = CSSPathValue::create(byteStream.release()); | 101 m_pathValue = CSSPathValue::create(byteStream.release()); |
| 102 return parseStatus; | 102 return parseStatus; |
| 103 } | 103 } |
| 104 | 104 |
| 105 PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGPath::cloneForAnimation(const String&
value) const | 105 RawPtr<SVGPropertyBase> SVGPath::cloneForAnimation(const String& value) const |
| 106 { | 106 { |
| 107 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); | 107 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
| 108 buildByteStreamFromString(value, *byteStream); | 108 buildByteStreamFromString(value, *byteStream); |
| 109 return SVGPath::create(CSSPathValue::create(byteStream.release())); | 109 return SVGPath::create(CSSPathValue::create(byteStream.release())); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SVGPath::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) | 112 void SVGPath::add(RawPtr<SVGPropertyBase> other, SVGElement*) |
| 113 { | 113 { |
| 114 const SVGPathByteStream& otherPathByteStream = toSVGPath(other)->byteStream(
); | 114 const SVGPathByteStream& otherPathByteStream = toSVGPath(other)->byteStream(
); |
| 115 if (byteStream().size() != otherPathByteStream.size() | 115 if (byteStream().size() != otherPathByteStream.size() |
| 116 || byteStream().isEmpty() | 116 || byteStream().isEmpty() |
| 117 || otherPathByteStream.isEmpty()) | 117 || otherPathByteStream.isEmpty()) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 m_pathValue = CSSPathValue::create(addPathByteStreams(byteStream(), otherPat
hByteStream)); | 120 m_pathValue = CSSPathValue::create(addPathByteStreams(byteStream(), otherPat
hByteStream)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void SVGPath::calculateAnimatedValue(SVGAnimationElement* animationElement, floa
t percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from
Value, PassRefPtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<S
VGPropertyBase> toAtEndOfDurationValue, SVGElement*) | 123 void SVGPath::calculateAnimatedValue(SVGAnimationElement* animationElement, floa
t percentage, unsigned repeatCount, RawPtr<SVGPropertyBase> fromValue, RawPtr<SV
GPropertyBase> toValue, RawPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGEleme
nt*) |
| 124 { | 124 { |
| 125 ASSERT(animationElement); | 125 ASSERT(animationElement); |
| 126 bool isToAnimation = animationElement->getAnimationMode() == ToAnimation; | 126 bool isToAnimation = animationElement->getAnimationMode() == ToAnimation; |
| 127 | 127 |
| 128 const SVGPath& to = toSVGPath(*toValue); | 128 const SVGPath& to = toSVGPath(*toValue); |
| 129 const SVGPathByteStream& toStream = to.byteStream(); | 129 const SVGPathByteStream& toStream = to.byteStream(); |
| 130 | 130 |
| 131 // If no 'to' value is given, nothing to animate. | 131 // If no 'to' value is given, nothing to animate. |
| 132 if (!toStream.size()) | 132 if (!toStream.size()) |
| 133 return; | 133 return; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 160 if (animationElement->isAdditive() && !isToAnimation) | 160 if (animationElement->isAdditive() && !isToAnimation) |
| 161 newStream = conditionallyAddPathByteStreams(newStream.release(), byteStr
eam()); | 161 newStream = conditionallyAddPathByteStreams(newStream.release(), byteStr
eam()); |
| 162 | 162 |
| 163 // Handle accumulate='sum'. | 163 // Handle accumulate='sum'. |
| 164 if (animationElement->isAccumulated() && repeatCount) | 164 if (animationElement->isAccumulated() && repeatCount) |
| 165 newStream = conditionallyAddPathByteStreams(newStream.release(), toSVGPa
th(toAtEndOfDurationValue)->byteStream(), repeatCount); | 165 newStream = conditionallyAddPathByteStreams(newStream.release(), toSVGPa
th(toAtEndOfDurationValue)->byteStream(), repeatCount); |
| 166 | 166 |
| 167 m_pathValue = CSSPathValue::create(newStream.release()); | 167 m_pathValue = CSSPathValue::create(newStream.release()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 float SVGPath::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVG
Element*) | 170 float SVGPath::calculateDistance(RawPtr<SVGPropertyBase> to, SVGElement*) |
| 171 { | 171 { |
| 172 // FIXME: Support paced animations. | 172 // FIXME: Support paced animations. |
| 173 return -1; | 173 return -1; |
| 174 } | 174 } |
| 175 | 175 |
| 176 DEFINE_TRACE(SVGPath) | 176 DEFINE_TRACE(SVGPath) |
| 177 { | 177 { |
| 178 visitor->trace(m_pathValue); | 178 visitor->trace(m_pathValue); |
| 179 SVGPropertyBase::trace(visitor); | 179 SVGPropertyBase::trace(visitor); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |