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

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

Issue 809823002: replace COMPILE_ASSERT with static assert in core/css/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | « Source/core/css/StyleRule.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return BorderImageLength(toAnimatableLength(value)->length(state.style() ->effectiveZoom(), ValueRangeNonNegative)); 79 return BorderImageLength(toAnimatableLength(value)->length(state.style() ->effectiveZoom(), ValueRangeNonNegative));
80 if (value->isDouble()) 80 if (value->isDouble())
81 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo uble(), 0)); 81 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo uble(), 0));
82 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSVal ue(); 82 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSVal ue();
83 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); 83 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
84 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s tate.cssToLengthConversionData())); 84 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s tate.cssToLengthConversionData()));
85 } 85 }
86 86
87 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) 87 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
88 { 88 {
89 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV alues); 89 static_assert(WTF::IsInteger<T>::value, "should use integral type T when rou nding values");
90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max); 90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max);
91 } 91 }
92 92
93 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe solverState& state, ValueRange range = ValueRangeAll) 93 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe solverState& state, ValueRange range = ValueRangeAll)
94 { 94 {
95 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value ); 95 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value );
96 return LengthBox( 96 return LengthBox(
97 animatableValueToLength(animatableLengthBox->top(), state, range), 97 animatableValueToLength(animatableLengthBox->top(), state, range),
98 animatableValueToLength(animatableLengthBox->right(), state, range), 98 animatableValueToLength(animatableLengthBox->right(), state, range),
99 animatableValueToLength(animatableLengthBox->bottom(), state, range), 99 animatableValueToLength(animatableLengthBox->bottom(), state, range),
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 return; 624 return;
625 case CSSPropertyZoom: 625 case CSSPropertyZoom:
626 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min())); 626 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min()));
627 return; 627 return;
628 default: 628 default:
629 ASSERT_NOT_REACHED(); 629 ASSERT_NOT_REACHED();
630 } 630 }
631 } 631 }
632 632
633 } // namespace blink 633 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/StyleRule.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698