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

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

Issue 1412123015: Replace open-coded toSVG<type> with DEFINE_SVG_PROPERTY_TYPE_CASTS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGAnimatedColor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 PassRefPtr<LengthSVGInterpolation> LengthSVGInterpolation::create(SVGPropertyBas e* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) 24 PassRefPtr<LengthSVGInterpolation> LengthSVGInterpolation::create(SVGPropertyBas e* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute)
25 { 25 {
26 NonInterpolableType modeData; 26 NonInterpolableType modeData;
27 OwnPtr<InterpolableValue> startValue = toInterpolableValue(toSVGLength(start ).get(), attribute.get(), &modeData); 27 OwnPtr<InterpolableValue> startValue = toInterpolableValue(toSVGLength(start ), attribute.get(), &modeData);
28 OwnPtr<InterpolableValue> endValue = toInterpolableValue(toSVGLength(end).ge t(), attribute.get(), nullptr); 28 OwnPtr<InterpolableValue> endValue = toInterpolableValue(toSVGLength(end), a ttribute.get(), nullptr);
29 return adoptRef(new LengthSVGInterpolation(startValue.release(), endValue.re lease(), 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);
(...skipping 123 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGAnimatedColor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698