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

Side by Side Diff: Source/core/css/resolver/AnimatedStyleBuilder.cpp

Issue 23548021: Web Animations CSS: Add unsigned short to support outline-width (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); 57 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
58 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); 58 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
59 return cssPrimitiveValue->convertToLength<AnyConversion>(style, state.rootEl ementStyle(), style->effectiveZoom()); 59 return cssPrimitiveValue->convertToLength<AnyConversion>(style, state.rootEl ementStyle(), style->effectiveZoom());
60 } 60 }
61 61
62 unsigned animatableValueToUnsigned(const AnimatableValue* value) 62 unsigned animatableValueToUnsigned(const AnimatableValue* value)
63 { 63 {
64 return clampTo<unsigned>(round(toAnimatableNumber(value)->toDouble())); 64 return clampTo<unsigned>(round(toAnimatableNumber(value)->toDouble()));
65 } 65 }
66 66
67 unsigned short animatableValueToUnsignedShort(const AnimatableValue* value)
68 {
69 return clampTo<unsigned short>(round(toAnimatableNumber(value)->toDouble())) ;
70 }
71
67 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe solverState& state) 72 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe solverState& state)
68 { 73 {
69 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value ); 74 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value );
70 return LengthBox( 75 return LengthBox(
71 animatableValueToLength(animatableLengthBox->top(), state), 76 animatableValueToLength(animatableLengthBox->top(), state),
72 animatableValueToLength(animatableLengthBox->right(), state), 77 animatableValueToLength(animatableLengthBox->right(), state),
73 animatableValueToLength(animatableLengthBox->bottom(), state), 78 animatableValueToLength(animatableLengthBox->bottom(), state),
74 animatableValueToLength(animatableLengthBox->left(), state)); 79 animatableValueToLength(animatableLengthBox->left(), state));
75 } 80 }
76 81
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 case CSSPropertyMinWidth: 177 case CSSPropertyMinWidth:
173 style->setMinWidth(animatableValueToLength(value, state)); 178 style->setMinWidth(animatableValueToLength(value, state));
174 return; 179 return;
175 case CSSPropertyOpacity: 180 case CSSPropertyOpacity:
176 style->setOpacity(toAnimatableNumber(value)->toDouble()); 181 style->setOpacity(toAnimatableNumber(value)->toDouble());
177 return; 182 return;
178 case CSSPropertyOutlineColor: 183 case CSSPropertyOutlineColor:
179 style->setOutlineColor(toAnimatableColor(value)->color()); 184 style->setOutlineColor(toAnimatableColor(value)->color());
180 style->setVisitedLinkOutlineColor(toAnimatableColor(value)->visitedLinkC olor()); 185 style->setVisitedLinkOutlineColor(toAnimatableColor(value)->visitedLinkC olor());
181 return; 186 return;
187 case CSSPropertyOutlineWidth:
188 style->setOutlineWidth(animatableValueToUnsignedShort(value));
189 return;
182 case CSSPropertyPaddingBottom: 190 case CSSPropertyPaddingBottom:
183 style->setPaddingBottom(animatableValueToLength(value, state)); 191 style->setPaddingBottom(animatableValueToLength(value, state));
184 return; 192 return;
185 case CSSPropertyPaddingLeft: 193 case CSSPropertyPaddingLeft:
186 style->setPaddingLeft(animatableValueToLength(value, state)); 194 style->setPaddingLeft(animatableValueToLength(value, state));
187 return; 195 return;
188 case CSSPropertyPaddingRight: 196 case CSSPropertyPaddingRight:
189 style->setPaddingRight(animatableValueToLength(value, state)); 197 style->setPaddingRight(animatableValueToLength(value, state));
190 return; 198 return;
191 case CSSPropertyPaddingTop: 199 case CSSPropertyPaddingTop:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 case CSSPropertyWidth: 249 case CSSPropertyWidth:
242 style->setWidth(animatableValueToLength(value, state)); 250 style->setWidth(animatableValueToLength(value, state));
243 return; 251 return;
244 default: 252 default:
245 RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(propert y), "Web Animations not yet implemented: Unable to apply AnimatableValue to Rend erStyle: %s", getPropertyNameString(property).utf8().data()); 253 RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(propert y), "Web Animations not yet implemented: Unable to apply AnimatableValue to Rend erStyle: %s", getPropertyNameString(property).utf8().data());
246 ASSERT_NOT_REACHED(); 254 ASSERT_NOT_REACHED();
247 } 255 }
248 } 256 }
249 257
250 } // namespace WebCore 258 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698