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

Side by Side Diff: third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/animatable/AnimatablePath.h" 5 #include "core/animation/animatable/AnimatablePath.h"
6 6
7 #include "core/style/DataEquivalency.h" 7 #include "core/style/DataEquivalency.h"
8 #include "core/svg/SVGPathBlender.h" 8 #include "core/svg/SVGPathBlender.h"
9 #include "core/svg/SVGPathByteStreamBuilder.h" 9 #include "core/svg/SVGPathByteStreamBuilder.h"
10 #include "core/svg/SVGPathByteStreamSource.h" 10 #include "core/svg/SVGPathByteStreamSource.h"
11 #include <memory>
11 12
12 namespace blink { 13 namespace blink {
13 14
14 bool AnimatablePath::usesDefaultInterpolationWith(const AnimatableValue* value) const 15 bool AnimatablePath::usesDefaultInterpolationWith(const AnimatableValue* value) const
15 { 16 {
16 // Default interpolation is used if the paths have different lengths, 17 // Default interpolation is used if the paths have different lengths,
17 // or the paths have a segment with different types (ignoring "relativeness" ). 18 // or the paths have a segment with different types (ignoring "relativeness" ).
18 19
19 const StylePath* toPath = toAnimatablePath(value)->path(); 20 const StylePath* toPath = toAnimatablePath(value)->path();
20 if (!m_path || !toPath) 21 if (!m_path || !toPath)
(...skipping 15 matching lines...) Expand all
36 } 37 }
37 38
38 return toSource.hasMoreData(); 39 return toSource.hasMoreData();
39 } 40 }
40 41
41 PassRefPtr<AnimatableValue> AnimatablePath::interpolateTo(const AnimatableValue* value, double fraction) const 42 PassRefPtr<AnimatableValue> AnimatablePath::interpolateTo(const AnimatableValue* value, double fraction) const
42 { 43 {
43 if (usesDefaultInterpolationWith(value)) 44 if (usesDefaultInterpolationWith(value))
44 return defaultInterpolateTo(this, value, fraction); 45 return defaultInterpolateTo(this, value, fraction);
45 46
46 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); 47 std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create();
47 SVGPathByteStreamBuilder builder(*byteStream); 48 SVGPathByteStreamBuilder builder(*byteStream);
48 49
49 SVGPathByteStreamSource fromSource(path()->byteStream()); 50 SVGPathByteStreamSource fromSource(path()->byteStream());
50 SVGPathByteStreamSource toSource(toAnimatablePath(value)->path()->byteStream ()); 51 SVGPathByteStreamSource toSource(toAnimatablePath(value)->path()->byteStream ());
51 52
52 SVGPathBlender blender(&fromSource, &toSource, &builder); 53 SVGPathBlender blender(&fromSource, &toSource, &builder);
53 bool ok = blender.blendAnimatedPath(fraction); 54 bool ok = blender.blendAnimatedPath(fraction);
54 ASSERT_UNUSED(ok, ok); 55 ASSERT_UNUSED(ok, ok);
55 return AnimatablePath::create(StylePath::create(std::move(byteStream))); 56 return AnimatablePath::create(StylePath::create(std::move(byteStream)));
56 } 57 }
57 58
58 bool AnimatablePath::equalTo(const AnimatableValue* value) const 59 bool AnimatablePath::equalTo(const AnimatableValue* value) const
59 { 60 {
60 return dataEquivalent(m_path.get(), toAnimatablePath(value)->path()); 61 return dataEquivalent(m_path.get(), toAnimatablePath(value)->path());
61 } 62 }
62 63
63 } // namespace blink 64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698