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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/LengthStyleInterpolation.h" 5 #include "core/animation/LengthStyleInterpolation.h"
6 6
7 #include "core/animation/LengthPropertyFunctions.h" 7 #include "core/animation/LengthPropertyFunctions.h"
8 #include "core/animation/css/CSSAnimatableValueFactory.h" 8 #include "core/animation/css/CSSAnimatableValueFactory.h"
9 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/resolver/StyleBuilder.h" 10 #include "core/css/resolver/StyleBuilder.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return false; 65 return false;
66 } 66 }
67 return result; 67 return result;
68 } 68 }
69 69
70 static CSSPrimitiveValue::UnitType toUnitType(int lengthUnitType) 70 static CSSPrimitiveValue::UnitType toUnitType(int lengthUnitType)
71 { 71 {
72 return static_cast<CSSPrimitiveValue::UnitType>(CSSPrimitiveValue::lengthUni tTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(lengthUnitType))) ; 72 return static_cast<CSSPrimitiveValue::UnitType>(CSSPrimitiveValue::lengthUni tTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(lengthUnitType))) ;
73 } 73 }
74 74
75 static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> constructCalcExpression(con st InterpolableList* list) 75 static RawPtr<CSSCalcExpressionNode> constructCalcExpression(const InterpolableL ist* list)
76 { 76 {
77 const InterpolableList* listOfValues = toInterpolableList(list->get(0)); 77 const InterpolableList* listOfValues = toInterpolableList(list->get(0));
78 const InterpolableList* listOfTypes = toInterpolableList(list->get(1)); 78 const InterpolableList* listOfTypes = toInterpolableList(list->get(1));
79 RefPtrWillBeRawPtr<CSSCalcExpressionNode> expression = nullptr; 79 RawPtr<CSSCalcExpressionNode> expression = nullptr;
80 for (size_t position = 0; position < CSSPrimitiveValue::LengthUnitTypeCount; position++) { 80 for (size_t position = 0; position < CSSPrimitiveValue::LengthUnitTypeCount; position++) {
81 const InterpolableNumber *subValueType = toInterpolableNumber(listOfType s->get(position)); 81 const InterpolableNumber *subValueType = toInterpolableNumber(listOfType s->get(position));
82 if (!subValueType->value()) 82 if (!subValueType->value())
83 continue; 83 continue;
84 double value = toInterpolableNumber(listOfValues->get(position))->value( ); 84 double value = toInterpolableNumber(listOfValues->get(position))->value( );
85 RefPtrWillBeRawPtr<CSSCalcExpressionNode> currentTerm = CSSCalcValue::cr eateExpressionNode(CSSPrimitiveValue::create(value, toUnitType(position))); 85 RawPtr<CSSCalcExpressionNode> currentTerm = CSSCalcValue::createExpressi onNode(CSSPrimitiveValue::create(value, toUnitType(position)));
86 if (expression) 86 if (expression)
87 expression = CSSCalcValue::createExpressionNode(expression.release() , currentTerm.release(), CalcAdd); 87 expression = CSSCalcValue::createExpressionNode(expression.release() , currentTerm.release(), CalcAdd);
88 else 88 else
89 expression = currentTerm.release(); 89 expression = currentTerm.release();
90 } 90 }
91 return expression.release(); 91 return expression.release();
92 } 92 }
93 93
94 static double clampToRange(double x, ValueRange range) 94 static double clampToRange(double x, ValueRange range)
95 { 95 {
(...skipping 19 matching lines...) Expand all
115 if (hasPixels) 115 if (hasPixels)
116 return Length(CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixe lsAndPercent.pixels, range)), Fixed); 116 return Length(CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixe lsAndPercent.pixels, range)), Fixed);
117 if (hasPercent) 117 if (hasPercent)
118 return Length(clampToRange(pixelsAndPercent.percent, range), Percent); 118 return Length(clampToRange(pixelsAndPercent.percent, range), Percent);
119 ASSERT_NOT_REACHED(); 119 ASSERT_NOT_REACHED();
120 return Length(0, Fixed); 120 return Length(0, Fixed);
121 } 121 }
122 122
123 } // namespace 123 } // namespace
124 124
125 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> LengthStyleInterpolation::fromInterpol ableValue(const InterpolableValue& value, InterpolationRange range) 125 RawPtr<CSSPrimitiveValue> LengthStyleInterpolation::fromInterpolableValue(const InterpolableValue& value, InterpolationRange range)
126 { 126 {
127 const InterpolableList* listOfValuesAndTypes = toInterpolableList(&value); 127 const InterpolableList* listOfValuesAndTypes = toInterpolableList(&value);
128 const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTyp es->get(0)); 128 const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTyp es->get(0));
129 const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndType s->get(1)); 129 const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndType s->get(1));
130 unsigned unitTypeCount = 0; 130 unsigned unitTypeCount = 0;
131 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { 131 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
132 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i)); 132 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i));
133 if (subType->value()) { 133 if (subType->value()) {
134 unitTypeCount++; 134 unitTypeCount++;
135 } 135 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value, ra nge).get()); 174 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value, ra nge).get());
175 } 175 }
176 176
177 void LengthStyleInterpolation::apply(StyleResolverState& state) const 177 void LengthStyleInterpolation::apply(StyleResolverState& state) const
178 { 178 {
179 applyInterpolableValue(m_id, *m_cachedValue, m_range, state); 179 applyInterpolableValue(m_id, *m_cachedValue, m_range, state);
180 } 180 }
181 181
182 } // namespace blink 182 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698