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

Side by Side Diff: Source/core/animation/LengthSVGInterpolation.cpp

Issue 1276183004: Oilpan: Unship oilpan from temporary animation objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "core/animation/LengthSVGInterpolation.h" 6 #include "core/animation/LengthSVGInterpolation.h"
7 7
8 #include "core/css/CSSHelper.h" 8 #include "core/css/CSSHelper.h"
9 #include "core/svg/SVGAnimatedLength.h" 9 #include "core/svg/SVGAnimatedLength.h"
10 #include "core/svg/SVGAnimatedLengthList.h" 10 #include "core/svg/SVGAnimatedLengthList.h"
11 #include "core/svg/SVGElement.h" 11 #include "core/svg/SVGElement.h"
12 #include "core/svg/SVGLengthContext.h" 12 #include "core/svg/SVGLengthContext.h"
13 #include "wtf/StdLibExtras.h" 13 #include "wtf/StdLibExtras.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 PassRefPtrWillBeRawPtr<SVGLengthList> LengthSVGInterpolation::createList(const S VGAnimatedPropertyBase& attribute) 17 PassRefPtrWillBeRawPtr<SVGLengthList> LengthSVGInterpolation::createList(const S VGAnimatedPropertyBase& attribute)
18 { 18 {
19 ASSERT(attribute.type() == AnimatedLengthList); 19 ASSERT(attribute.type() == AnimatedLengthList);
20 const SVGAnimatedLengthList& animatedLengthList = static_cast<const SVGAnima tedLengthList&>(attribute); 20 const SVGAnimatedLengthList& animatedLengthList = static_cast<const SVGAnima tedLengthList&>(attribute);
21 return SVGLengthList::create(animatedLengthList.currentValue()->unitMode()); 21 return SVGLengthList::create(animatedLengthList.currentValue()->unitMode());
22 } 22 }
23 23
24 PassRefPtrWillBeRawPtr<LengthSVGInterpolation> LengthSVGInterpolation::create(SV GPropertyBase* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPr opertyBase> attribute) 24 PassRefPtr<LengthSVGInterpolation> LengthSVGInterpolation::create(SVGPropertyBas e* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute)
25 { 25 {
26 NonInterpolableType modeData; 26 NonInterpolableType modeData;
27 OwnPtrWillBeRawPtr<InterpolableValue> startValue = toInterpolableValue(toSVG Length(start).get(), attribute.get(), &modeData); 27 OwnPtr<InterpolableValue> startValue = toInterpolableValue(toSVGLength(start ).get(), attribute.get(), &modeData);
28 OwnPtrWillBeRawPtr<InterpolableValue> endValue = toInterpolableValue(toSVGLe ngth(end).get(), attribute.get(), nullptr); 28 OwnPtr<InterpolableValue> endValue = toInterpolableValue(toSVGLength(end).ge t(), attribute.get(), nullptr);
29 return adoptRefWillBeNoop(new LengthSVGInterpolation(startValue.release(), e ndValue.release(), attribute, modeData)); 29 return adoptRef(new LengthSVGInterpolation(startValue.release(), endValue.re lease(), attribute, modeData));
30 } 30 }
31 31
32 namespace { 32 namespace {
33 33
34 void populateModeData(const SVGAnimatedPropertyBase* attribute, LengthSVGInterpo lation::NonInterpolableType* ptrModeData) 34 void populateModeData(const SVGAnimatedPropertyBase* attribute, LengthSVGInterpo lation::NonInterpolableType* ptrModeData)
35 { 35 {
36 switch (attribute->type()) { 36 switch (attribute->type()) {
37 case AnimatedLength: { 37 case AnimatedLength: {
38 const SVGAnimatedLength& animatedLength = static_cast<const SVGAnimatedL ength&>(*attribute); 38 const SVGAnimatedLength& animatedLength = static_cast<const SVGAnimatedL ength&>(*attribute);
39 ptrModeData->unitMode = animatedLength.currentValue()->unitMode(); 39 ptrModeData->unitMode = animatedLength.currentValue()->unitMode();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return LengthInterpolatedNumber; 96 return LengthInterpolatedNumber;
97 case LengthTypeREMS: 97 case LengthTypeREMS:
98 return LengthInterpolatedREMS; 98 return LengthInterpolatedREMS;
99 case LengthTypeCHS: 99 case LengthTypeCHS:
100 return LengthInterpolatedCHS; 100 return LengthInterpolatedCHS;
101 } 101 }
102 } 102 }
103 103
104 } // namespace 104 } // namespace
105 105
106 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthSVGInterpolation::toInterpolable Value(SVGLength* length, const SVGAnimatedPropertyBase* attribute, NonInterpolab leType* ptrModeData) 106 PassOwnPtr<InterpolableValue> LengthSVGInterpolation::toInterpolableValue(SVGLen gth* length, const SVGAnimatedPropertyBase* attribute, NonInterpolableType* ptrM odeData)
107 { 107 {
108 if (ptrModeData) 108 if (ptrModeData)
109 populateModeData(attribute, ptrModeData); 109 populateModeData(attribute, ptrModeData);
110 110
111 double value = length->valueInSpecifiedUnits(); 111 double value = length->valueInSpecifiedUnits();
112 LengthInterpolatedUnit unitType = convertToInterpolatedUnit(length->unitType (), value); 112 LengthInterpolatedUnit unitType = convertToInterpolatedUnit(length->unitType (), value);
113 113
114 double values[numLengthInterpolatedUnits] = { }; 114 double values[numLengthInterpolatedUnits] = { };
115 values[unitType] = value; 115 values[unitType] = value;
116 116
117 OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create (numLengthInterpolatedUnits); 117 OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthIn terpolatedUnits);
118 for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) 118 for (size_t i = 0; i < numLengthInterpolatedUnits; ++i)
119 listOfValues->set(i, InterpolableNumber::create(values[i])); 119 listOfValues->set(i, InterpolableNumber::create(values[i]));
120 return listOfValues.release(); 120 return listOfValues.release();
121 } 121 }
122 122
123 PassRefPtrWillBeRawPtr<SVGLength> LengthSVGInterpolation::fromInterpolableValue( const InterpolableValue& interpolableValue, const NonInterpolableType& modeData, const SVGElement* element) 123 PassRefPtrWillBeRawPtr<SVGLength> LengthSVGInterpolation::fromInterpolableValue( const InterpolableValue& interpolableValue, const NonInterpolableType& modeData, const SVGElement* element)
124 { 124 {
125 const InterpolableList& listOfValues = toInterpolableList(interpolableValue) ; 125 const InterpolableList& listOfValues = toInterpolableList(interpolableValue) ;
126 ASSERT(element); 126 ASSERT(element);
127 127
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 result->setValueInSpecifiedUnits(value); 162 result->setValueInSpecifiedUnits(value);
163 return result.release(); 163 return result.release();
164 } 164 }
165 165
166 PassRefPtrWillBeRawPtr<SVGPropertyBase> LengthSVGInterpolation::interpolatedValu e(SVGElement& targetElement) const 166 PassRefPtrWillBeRawPtr<SVGPropertyBase> LengthSVGInterpolation::interpolatedValu e(SVGElement& targetElement) const
167 { 167 {
168 return fromInterpolableValue(*m_cachedValue, m_modeData, &targetElement); 168 return fromInterpolableValue(*m_cachedValue, m_modeData, &targetElement);
169 } 169 }
170 170
171 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698