Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPath.cpp

Issue 1980893002: Remove OwnPtr::release() calls in core/ (part 4). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 namespace { 36 namespace {
37 37
38 PassOwnPtr<SVGPathByteStream> blendPathByteStreams(const SVGPathByteStream& from Stream, const SVGPathByteStream& toStream, float progress) 38 PassOwnPtr<SVGPathByteStream> blendPathByteStreams(const SVGPathByteStream& from Stream, const SVGPathByteStream& toStream, float progress)
39 { 39 {
40 OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); 40 OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create();
41 SVGPathByteStreamBuilder builder(*resultStream); 41 SVGPathByteStreamBuilder builder(*resultStream);
42 SVGPathByteStreamSource fromSource(fromStream); 42 SVGPathByteStreamSource fromSource(fromStream);
43 SVGPathByteStreamSource toSource(toStream); 43 SVGPathByteStreamSource toSource(toStream);
44 SVGPathBlender blender(&fromSource, &toSource, &builder); 44 SVGPathBlender blender(&fromSource, &toSource, &builder);
45 blender.blendAnimatedPath(progress); 45 blender.blendAnimatedPath(progress);
46 return resultStream.release(); 46 return resultStream;
47 } 47 }
48 48
49 PassOwnPtr<SVGPathByteStream> addPathByteStreams(const SVGPathByteStream& fromSt ream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) 49 PassOwnPtr<SVGPathByteStream> addPathByteStreams(const SVGPathByteStream& fromSt ream, const SVGPathByteStream& byStream, unsigned repeatCount = 1)
50 { 50 {
51 OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); 51 OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create();
52 SVGPathByteStreamBuilder builder(*resultStream); 52 SVGPathByteStreamBuilder builder(*resultStream);
53 SVGPathByteStreamSource fromSource(fromStream); 53 SVGPathByteStreamSource fromSource(fromStream);
54 SVGPathByteStreamSource bySource(byStream); 54 SVGPathByteStreamSource bySource(byStream);
55 SVGPathBlender blender(&fromSource, &bySource, &builder); 55 SVGPathBlender blender(&fromSource, &bySource, &builder);
56 blender.addAnimatedPath(repeatCount); 56 blender.addAnimatedPath(repeatCount);
57 return resultStream.release(); 57 return resultStream;
58 } 58 }
59 59
60 PassOwnPtr<SVGPathByteStream> conditionallyAddPathByteStreams(PassOwnPtr<SVGPath ByteStream> fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) 60 PassOwnPtr<SVGPathByteStream> conditionallyAddPathByteStreams(PassOwnPtr<SVGPath ByteStream> fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1)
61 { 61 {
62 if (fromStream->isEmpty() || byStream.isEmpty()) 62 if (fromStream->isEmpty() || byStream.isEmpty())
63 return fromStream; 63 return fromStream;
64 return addPathByteStreams(*fromStream, byStream, repeatCount); 64 return addPathByteStreams(*fromStream, byStream, repeatCount);
65 } 65 }
66 66
67 } // namespace 67 } // namespace
(...skipping 23 matching lines...) Expand all
91 91
92 SVGPath* SVGPath::clone() const 92 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(std::move(byteStream));
102 return parseStatus; 102 return parseStatus;
103 } 103 }
104 104
105 SVGPropertyBase* SVGPath::cloneForAnimation(const String& value) const 105 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(std::move(byteStream)));
110 } 110 }
111 111
112 void SVGPath::add(SVGPropertyBase* other, SVGElement*) 112 void SVGPath::add(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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } else { 151 } else {
152 m_pathValue = to.pathValue(); 152 m_pathValue = to.pathValue();
153 return; 153 return;
154 } 154 }
155 } 155 }
156 156
157 OwnPtr<SVGPathByteStream> newStream = blendPathByteStreams(*fromStream, toSt ream, percentage); 157 OwnPtr<SVGPathByteStream> newStream = blendPathByteStreams(*fromStream, toSt ream, percentage);
158 158
159 // Handle additive='sum'. 159 // Handle additive='sum'.
160 if (animationElement->isAdditive() && !isToAnimation) 160 if (animationElement->isAdditive() && !isToAnimation)
161 newStream = conditionallyAddPathByteStreams(newStream.release(), byteStr eam()); 161 newStream = conditionallyAddPathByteStreams(std::move(newStream), byteSt ream());
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(std::move(newStream), toSVGP ath(toAtEndOfDurationValue)->byteStream(), repeatCount);
166 166
167 m_pathValue = CSSPathValue::create(newStream.release()); 167 m_pathValue = CSSPathValue::create(std::move(newStream));
168 } 168 }
169 169
170 float SVGPath::calculateDistance(SVGPropertyBase* to, SVGElement*) 170 float SVGPath::calculateDistance(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698