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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2135913002: Avoid overflowing motion-rotation when converting double to float (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/motion-path/motion-rotation-overflow-crash.html ('k') | no next file » | 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 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item); 743 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item);
744 if (primitiveValue.getValueID() == CSSValueAuto) { 744 if (primitiveValue.getValueID() == CSSValueAuto) {
745 result.type = MotionRotationAuto; 745 result.type = MotionRotationAuto;
746 } else if (primitiveValue.getValueID() == CSSValueReverse) { 746 } else if (primitiveValue.getValueID() == CSSValueReverse) {
747 result.type = MotionRotationAuto; 747 result.type = MotionRotationAuto;
748 result.angle += 180; 748 result.angle += 180;
749 } else { 749 } else {
750 result.angle += primitiveValue.computeDegrees(); 750 result.angle += primitiveValue.computeDegrees();
751 } 751 }
752 } 752 }
753 result.angle = clampTo<float>(result.angle);
753 754
754 return result; 755 return result;
755 } 756 }
756 757
757 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> 758 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100>
758 Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, c onst CSSValue& value) 759 Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, c onst CSSValue& value)
759 { 760 {
760 if (value.isValuePair()) { 761 if (value.isValuePair()) {
761 const CSSValuePair& pair = toCSSValuePair(value); 762 const CSSValuePair& pair = toCSSValuePair(value);
762 Length length = StyleBuilderConverter::convertLength(state, pair.second( )); 763 Length length = StyleBuilderConverter::convertLength(state, pair.second( ));
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1074
1074 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 1075 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
1075 { 1076 {
1076 if (value.isPathValue()) 1077 if (value.isPathValue())
1077 return toCSSPathValue(value).stylePath(); 1078 return toCSSPathValue(value).stylePath();
1078 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 1079 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
1079 return nullptr; 1080 return nullptr;
1080 } 1081 }
1081 1082
1082 } // namespace blink 1083 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/motion-path/motion-rotation-overflow-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698