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

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

Issue 2549563002: Only communicate CSSPrimitiveValue references from SVGLength (Closed)
Patch Set: Created 4 years 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/SVGAnimatedLength.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 "core/animation/SVGLengthInterpolationType.h" 5 #include "core/animation/SVGLengthInterpolationType.h"
6 6
7 #include "core/animation/InterpolationEnvironment.h" 7 #include "core/animation/InterpolationEnvironment.h"
8 #include "core/animation/StringKeyframe.h" 8 #include "core/animation/StringKeyframe.h"
9 #include "core/css/CSSHelper.h" 9 #include "core/css/CSSHelper.h"
10 #include "core/svg/SVGElement.h" 10 #include "core/svg/SVGElement.h"
11 #include "core/svg/SVGLength.h" 11 #include "core/svg/SVGLength.h"
12 #include "core/svg/SVGLengthContext.h" 12 #include "core/svg/SVGLengthContext.h"
13 #include <memory> 13 #include <memory>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 std::unique_ptr<InterpolableValue> 17 std::unique_ptr<InterpolableValue>
18 SVGLengthInterpolationType::neutralInterpolableValue() { 18 SVGLengthInterpolationType::neutralInterpolableValue() {
19 std::unique_ptr<InterpolableList> listOfValues = 19 std::unique_ptr<InterpolableList> listOfValues =
20 InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); 20 InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount);
21 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) 21 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i)
22 listOfValues->set(i, InterpolableNumber::create(0)); 22 listOfValues->set(i, InterpolableNumber::create(0));
23 23
24 return std::move(listOfValues); 24 return std::move(listOfValues);
25 } 25 }
26 26
27 InterpolationValue SVGLengthInterpolationType::convertSVGLength( 27 InterpolationValue SVGLengthInterpolationType::convertSVGLength(
28 const SVGLength& length) { 28 const SVGLength& length) {
29 const CSSPrimitiveValue* primitiveValue = length.asCSSPrimitiveValue(); 29 const CSSPrimitiveValue& primitiveValue = length.asCSSPrimitiveValue();
30 30
31 CSSLengthArray lengthArray; 31 CSSLengthArray lengthArray;
32 primitiveValue->accumulateLengthArray(lengthArray); 32 primitiveValue.accumulateLengthArray(lengthArray);
33 33
34 std::unique_ptr<InterpolableList> listOfValues = 34 std::unique_ptr<InterpolableList> listOfValues =
35 InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); 35 InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount);
36 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) 36 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i)
37 listOfValues->set(i, InterpolableNumber::create(lengthArray.values[i])); 37 listOfValues->set(i, InterpolableNumber::create(lengthArray.values[i]));
38 38
39 return InterpolationValue(std::move(listOfValues)); 39 return InterpolationValue(std::move(listOfValues));
40 } 40 }
41 41
42 SVGLength* SVGLengthInterpolationType::resolveInterpolableSVGLength( 42 SVGLength* SVGLengthInterpolationType::resolveInterpolableSVGLength(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 InterpolationEnvironment& environment) const { 115 InterpolationEnvironment& environment) const {
116 SVGElement& element = environment.svgElement(); 116 SVGElement& element = environment.svgElement();
117 SVGLengthContext lengthContext(&element); 117 SVGLengthContext lengthContext(&element);
118 element.setWebAnimatedAttribute( 118 element.setWebAnimatedAttribute(
119 attribute(), 119 attribute(),
120 resolveInterpolableSVGLength(interpolableValue, lengthContext, m_unitMode, 120 resolveInterpolableSVGLength(interpolableValue, lengthContext, m_unitMode,
121 m_negativeValuesForbidden)); 121 m_negativeValuesForbidden));
122 } 122 }
123 123
124 } // namespace blink 124 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGAnimatedLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698