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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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/SVGIntegerOptionalIntegerInterpolationType.h" 5 #include "core/animation/SVGIntegerOptionalIntegerInterpolationType.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/animation/InterpolationEnvironment.h" 8 #include "core/animation/InterpolationEnvironment.h"
9 #include "core/svg/SVGIntegerOptionalInteger.h" 9 #include "core/svg/SVGIntegerOptionalInteger.h"
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 InterpolationValue 23 InterpolationValue
24 SVGIntegerOptionalIntegerInterpolationType::maybeConvertSVGValue( 24 SVGIntegerOptionalIntegerInterpolationType::maybeConvertSVGValue(
25 const SVGPropertyBase& svgValue) const { 25 const SVGPropertyBase& svgValue) const {
26 if (svgValue.type() != AnimatedIntegerOptionalInteger) 26 if (svgValue.type() != AnimatedIntegerOptionalInteger)
27 return nullptr; 27 return nullptr;
28 28
29 const SVGIntegerOptionalInteger& integerOptionalInteger = 29 const SVGIntegerOptionalInteger& integerOptionalInteger =
30 toSVGIntegerOptionalInteger(svgValue); 30 toSVGIntegerOptionalInteger(svgValue);
31 std::unique_ptr<InterpolableList> result = InterpolableList::create(2); 31 std::unique_ptr<InterpolableList> result = InterpolableList::create(2);
32 result->set(0, InterpolableNumber::create( 32 result->set(0,
33 integerOptionalInteger.firstInteger()->value())); 33 InterpolableNumber::create(
34 result->set(1, InterpolableNumber::create( 34 integerOptionalInteger.firstInteger()->value()));
35 integerOptionalInteger.secondInteger()->value())); 35 result->set(1,
36 InterpolableNumber::create(
37 integerOptionalInteger.secondInteger()->value()));
36 return InterpolationValue(std::move(result)); 38 return InterpolationValue(std::move(result));
37 } 39 }
38 40
39 static SVGInteger* toPositiveInteger(const InterpolableValue* number) { 41 static SVGInteger* toPositiveInteger(const InterpolableValue* number) {
40 return SVGInteger::create( 42 return SVGInteger::create(
41 clampTo<int>(roundf(toInterpolableNumber(number)->value()), 1)); 43 clampTo<int>(roundf(toInterpolableNumber(number)->value()), 1));
42 } 44 }
43 45
44 SVGPropertyBase* SVGIntegerOptionalIntegerInterpolationType::appliedSVGValue( 46 SVGPropertyBase* SVGIntegerOptionalIntegerInterpolationType::appliedSVGValue(
45 const InterpolableValue& interpolableValue, 47 const InterpolableValue& interpolableValue,
46 const NonInterpolableValue*) const { 48 const NonInterpolableValue*) const {
47 const InterpolableList& list = toInterpolableList(interpolableValue); 49 const InterpolableList& list = toInterpolableList(interpolableValue);
48 return SVGIntegerOptionalInteger::create(toPositiveInteger(list.get(0)), 50 return SVGIntegerOptionalInteger::create(toPositiveInteger(list.get(0)),
49 toPositiveInteger(list.get(1))); 51 toPositiveInteger(list.get(1)));
50 } 52 }
51 53
52 } // namespace blink 54 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698