Changeset 284725 in webkit
- Timestamp:
- Oct 22, 2021, 4:21:57 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/animations/animation-order-overflow-expected.txt (added)
-
LayoutTests/animations/animation-order-overflow.html (added)
-
LayoutTests/animations/animation-z-order-overflow-expected.txt (added)
-
LayoutTests/animations/animation-z-order-overflow.html (added)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_order-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_order.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_z_index-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_z_index.html (added)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/MathExtras.h (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/animation/AnimationUtilities.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284724 r284725 1 2021-10-22 Joonghun Park <pjh0718@gmail.com> 2 3 Integer interpolation in animations should be rounded towards positive infinity, not away from zero. 4 https://bugs.webkit.org/show_bug.cgi?id=232013 5 6 Currently, interpolation of <integer> is rounding away from 0. 7 The interpolation's result should be rounded according to the spec, 8 https://drafts.csswg.org/css-values-4/#combine-integers, which is 9 10 "the result is converted to an <integer> by rounding 11 to the nearest integer, with values halfway between 12 adjacent integers rounded towards positive infinity." 13 14 This patch also removes redundant static_cast<double>s 15 and potential overflow(e.g.'to' is the maximum integer and 'from' is 16 the minimum integer) from blend in AnimationUtilities.h. 17 18 Reviewed by Darin Adler. 19 20 * animations/animation-order-overflow-expected.txt: Added. 21 * animations/animation-order-overflow.html: Added. 22 * animations/animation-z-order-overflow-expected.txt: Added. 23 * animations/animation-z-order-overflow.html: Added. 24 1 25 2021-10-22 Chris Dumez <cdumez@apple.com> 2 26 -
trunk/LayoutTests/imported/w3c/ChangeLog
r284724 r284725 1 2021-10-22 Joonghun Park <pjh0718@gmail.com> 2 3 Integer interpolation in animations should be rounded towards positive infinity, not away from zero. 4 https://bugs.webkit.org/show_bug.cgi?id=232013 5 6 Currently, interpolation of <integer> is rounding away from 0. 7 The interpolation's result should be rounded according to the spec, 8 https://drafts.csswg.org/css-values-4/#combine-integers, which is 9 10 "the result is converted to an <integer> by rounding 11 to the nearest integer, with values halfway between 12 adjacent integers rounded towards positive infinity." 13 14 Reviewed by Darin Adler. 15 16 * web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_order-expected.txt: Added. 17 * web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_order.html: Added. 18 * web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_z_index-expected.txt: Added. 19 * web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_z_index.html: Added. 20 1 21 2021-10-22 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/Source/WTF/ChangeLog
r284673 r284725 1 2021-10-22 Joonghun Park <pjh0718@gmail.com> 2 3 Integer interpolation in animations should be rounded towards positive infinity, not away from zero. 4 https://bugs.webkit.org/show_bug.cgi?id=232013 5 6 Currently, interpolation of <integer> is rounding away from 0. 7 The interpolation's result should be rounded according to the spec, 8 https://drafts.csswg.org/css-values-4/#combine-integers, which is 9 10 "the result is converted to an <integer> by rounding 11 to the nearest integer, with values halfway between 12 adjacent integers rounded towards positive infinity." 13 14 Reviewed by Darin Adler. 15 16 * wtf/MathExtras.h: 17 (roundTowardsPositiveInfinity): 18 1 19 2021-10-22 Pablo Correa Gómez <ablocorrea@hotmail.com> 2 20 -
trunk/Source/WTF/wtf/MathExtras.h
r279193 r284725 137 137 constexpr inline float grad2rad(float g) { return deg2rad(grad2deg(g)); } 138 138 139 inline double roundTowardsPositiveInfinity(double value) { return std::floor(value + 0.5); } 140 inline float roundTowardsPositiveInfinity(float value) { return std::floor(value + 0.5f); } 141 139 142 // std::numeric_limits<T>::min() returns the smallest positive value for floating point types 140 143 template<typename T> constexpr T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); } -
trunk/Source/WebCore/ChangeLog
r284718 r284725 1 2021-10-22 Joonghun Park <pjh0718@gmail.com> 2 3 Integer interpolation in animations should be rounded towards positive infinity, not away from zero. 4 https://bugs.webkit.org/show_bug.cgi?id=232013 5 6 Currently, interpolation of <integer> is rounding away from 0. 7 The interpolation's result should be rounded according to the spec, 8 https://drafts.csswg.org/css-values-4/#combine-integers, which is 9 10 "the result is converted to an <integer> by rounding 11 to the nearest integer, with values halfway between 12 adjacent integers rounded towards positive infinity." 13 14 This patch also removes redundant static_cast<double>s 15 and potential overflow(e.g.'to' is the maximum integer and 'from' is 16 the minimum integer) from blend in AnimationUtilities.h. 17 18 Reviewed by Darin Adler. 19 20 Tests: animations/animation-order-overflow.html 21 animations/animation-z-order-overflow.html 22 imported/w3c/web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_order.html 23 imported/w3c/web-platform-tests/css/css-values/integer_interpolation_round_half_towards_positive_infinity_z_index.html 24 25 * platform/animation/AnimationUtilities.h: 26 (WebCore::blend): 27 1 28 2021-10-22 Kiet Ho <tho22@apple.com> 2 29 -
trunk/Source/WebCore/platform/animation/AnimationUtilities.h
r284600 r284725 46 46 47 47 inline int blend(int from, int to, const BlendingContext& context) 48 { 49 return static_cast<int>( lround(static_cast<double>(from) + static_cast<double>(to- from) * context.progress));48 { 49 return static_cast<int>(roundTowardsPositiveInfinity(from + (static_cast<double>(to) - from) * context.progress)); 50 50 } 51 51 52 52 inline unsigned blend(unsigned from, unsigned to, const BlendingContext& context) 53 53 { 54 return static_cast<unsigned>(lround(to > from ? static_cast<double>(from) + static_cast<double>(to - from) * context.progress : static_cast<double>(from) - static_cast<double>(from- to) * context.progress));54 return static_cast<unsigned>(lround(to > from ? from + (static_cast<double>(to) - from) * context.progress : from - (static_cast<double>(from) - to) * context.progress)); 55 55 } 56 56
Note:
See TracChangeset
for help on using the changeset viewer.