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

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

Issue 832873002: Animation: Remove ASSERT_NOT_REACHED from LengthStyleInterpolation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add return 0px after ASSERT_NOT_REACHED() Created 5 years, 11 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 "config.h" 5 #include "config.h"
6 #include "core/animation/LengthStyleInterpolation.h" 6 #include "core/animation/LengthStyleInterpolation.h"
7 7
8 #include "core/css/CSSCalculationValue.h" 8 #include "core/css/CSSCalculationValue.h"
9 #include "core/css/resolver/StyleBuilder.h" 9 #include "core/css/resolver/StyleBuilder.h"
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 unsigned unitTypeCount = 0; 88 unsigned unitTypeCount = 0;
89 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { 89 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
90 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i)); 90 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i));
91 if (subType->value()) { 91 if (subType->value()) {
92 unitTypeCount++; 92 unitTypeCount++;
93 } 93 }
94 } 94 }
95 95
96 switch (unitTypeCount) { 96 switch (unitTypeCount) {
97 case 0: 97 case 0:
98 ASSERT_NOT_REACHED(); 98 ASSERT_NOT_REACHED();
shans 2015/01/07 23:07:49 Instead remove this assert and add a TODO to fix t
evemj (not active) 2015/01/07 23:28:03 Done.
99 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX);
99 case 1: 100 case 1:
100 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { 101 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
101 const InterpolableNumber *subValueType = toInterpolableNumber(listOf Types->get(i)); 102 const InterpolableNumber *subValueType = toInterpolableNumber(listOf Types->get(i));
102 if (subValueType->value()) { 103 if (subValueType->value()) {
103 double value = toInterpolableNumber(listOfValues->get(i))->value (); 104 double value = toInterpolableNumber(listOfValues->get(i))->value ();
104 if (range == ValueRangeNonNegative && value < 0) 105 if (range == ValueRangeNonNegative && value < 0)
105 value = 0; 106 value = 0;
106 return CSSPrimitiveValue::create(value, toUnitType(i)); 107 return CSSPrimitiveValue::create(value, toUnitType(i));
107 } 108 }
108 } 109 }
109 ASSERT_NOT_REACHED(); 110 ASSERT_NOT_REACHED();
110 default: 111 default:
111 return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpre ssion(nullptr, listOfValuesAndTypes, 0), range)); 112 return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpre ssion(nullptr, listOfValuesAndTypes, 0), range));
112 } 113 }
113 } 114 }
114 115
115 void LengthStyleInterpolation::apply(StyleResolverState& state) const 116 void LengthStyleInterpolation::apply(StyleResolverState& state) const
116 { 117 {
117 StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedV alue.get(), m_range).get()); 118 StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedV alue.get(), m_range).get());
118 } 119 }
119 120
120 void LengthStyleInterpolation::trace(Visitor* visitor) 121 void LengthStyleInterpolation::trace(Visitor* visitor)
121 { 122 {
122 StyleInterpolation::trace(visitor); 123 StyleInterpolation::trace(visitor);
123 } 124 }
124 125
125 } 126 }
OLDNEW
« Source/core/animation/InterpolableValue.cpp ('K') | « Source/core/animation/InterpolableValue.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698