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

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

Issue 19744002: Web Animations: Add CSSAnimatableValueFactory API (partial implementation) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move folders and add const to param Created 7 years, 4 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
« no previous file with comments | « Source/core/animation/AnimatableNumber.h ('k') | Source/core/animation/AnimatableValue.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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(factor, CSSPrimitiveValue::CSS_NUMBER)), 132 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(factor, CSSPrimitiveValue::CSS_NUMBER)),
133 CalcMultiply)); 133 CalcMultiply));
134 } 134 }
135 return AnimatableNumber::create(m_number * factor, m_unitType); 135 return AnimatableNumber::create(m_number * factor, m_unitType);
136 } 136 }
137 137
138 AnimatableNumber::NumberUnitType AnimatableNumber::primitiveUnitToNumberType(uns igned short primitiveUnit) 138 AnimatableNumber::NumberUnitType AnimatableNumber::primitiveUnitToNumberType(uns igned short primitiveUnit)
139 { 139 {
140 switch (primitiveUnit) { 140 switch (primitiveUnit) {
141 case CSSPrimitiveValue::CSS_NUMBER: 141 case CSSPrimitiveValue::CSS_NUMBER:
142 return UnitTypeNone; 142 return UnitTypeNumber;
143 case CSSPrimitiveValue::CSS_PX: 143 case CSSPrimitiveValue::CSS_PX:
144 case CSSPrimitiveValue::CSS_CM: 144 case CSSPrimitiveValue::CSS_CM:
145 case CSSPrimitiveValue::CSS_MM: 145 case CSSPrimitiveValue::CSS_MM:
146 case CSSPrimitiveValue::CSS_IN: 146 case CSSPrimitiveValue::CSS_IN:
147 case CSSPrimitiveValue::CSS_PT: 147 case CSSPrimitiveValue::CSS_PT:
148 case CSSPrimitiveValue::CSS_PC: 148 case CSSPrimitiveValue::CSS_PC:
149 return UnitTypeLength; 149 return UnitTypeLength;
150 case CSSPrimitiveValue::CSS_EMS: 150 case CSSPrimitiveValue::CSS_EMS:
151 return UnitTypeFontSize; 151 return UnitTypeFontSize;
152 case CSSPrimitiveValue::CSS_EXS: 152 case CSSPrimitiveValue::CSS_EXS:
(...skipping 26 matching lines...) Expand all
179 case CSSPrimitiveValue::CSS_DPCM: 179 case CSSPrimitiveValue::CSS_DPCM:
180 return UnitTypeResolution; 180 return UnitTypeResolution;
181 default: 181 default:
182 return UnitTypeInvalid; 182 return UnitTypeInvalid;
183 } 183 }
184 } 184 }
185 185
186 unsigned short AnimatableNumber::numberTypeToPrimitiveUnit(NumberUnitType number Type) 186 unsigned short AnimatableNumber::numberTypeToPrimitiveUnit(NumberUnitType number Type)
187 { 187 {
188 switch (numberType) { 188 switch (numberType) {
189 case UnitTypeNone: 189 case UnitTypeNumber:
190 return CSSPrimitiveValue::CSS_NUMBER; 190 return CSSPrimitiveValue::CSS_NUMBER;
191 case UnitTypeLength: 191 case UnitTypeLength:
192 return CSSPrimitiveValue::CSS_PX; 192 return CSSPrimitiveValue::CSS_PX;
193 case UnitTypeFontSize: 193 case UnitTypeFontSize:
194 return CSSPrimitiveValue::CSS_EMS; 194 return CSSPrimitiveValue::CSS_EMS;
195 case UnitTypeFontXSize: 195 case UnitTypeFontXSize:
196 return CSSPrimitiveValue::CSS_EXS; 196 return CSSPrimitiveValue::CSS_EXS;
197 case UnitTypeRootFontSize: 197 case UnitTypeRootFontSize:
198 return CSSPrimitiveValue::CSS_REMS; 198 return CSSPrimitiveValue::CSS_REMS;
199 case UnitTypePercentage: 199 case UnitTypePercentage:
(...skipping 15 matching lines...) Expand all
215 case UnitTypeResolution: 215 case UnitTypeResolution:
216 return CSSPrimitiveValue::CSS_DPPX; 216 return CSSPrimitiveValue::CSS_DPPX;
217 case UnitTypeInvalid: 217 case UnitTypeInvalid:
218 return CSSPrimitiveValue::CSS_UNKNOWN; 218 return CSSPrimitiveValue::CSS_UNKNOWN;
219 } 219 }
220 ASSERT_NOT_REACHED(); 220 ASSERT_NOT_REACHED();
221 return CSSPrimitiveValue::CSS_UNKNOWN; 221 return CSSPrimitiveValue::CSS_UNKNOWN;
222 } 222 }
223 223
224 } // namespace WebCore 224 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/animation/AnimatableNumber.h ('k') | Source/core/animation/AnimatableValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698