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

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

Issue 2594493002: offset-rotate: Clamp rotation to float prior to assignment (Closed)
Patch Set: Created 4 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
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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 888
889 const CSSValueList& list = toCSSValueList(value); 889 const CSSValueList& list = toCSSValueList(value);
890 ASSERT(list.length() == 1 || list.length() == 2); 890 ASSERT(list.length() == 1 || list.length() == 2);
891 for (const auto& item : list) { 891 for (const auto& item : list) {
892 if (item->isIdentifierValue() && 892 if (item->isIdentifierValue() &&
893 toCSSIdentifierValue(*item).getValueID() == CSSValueAuto) { 893 toCSSIdentifierValue(*item).getValueID() == CSSValueAuto) {
894 result.type = OffsetRotationAuto; 894 result.type = OffsetRotationAuto;
895 } else if (item->isIdentifierValue() && 895 } else if (item->isIdentifierValue() &&
896 toCSSIdentifierValue(*item).getValueID() == CSSValueReverse) { 896 toCSSIdentifierValue(*item).getValueID() == CSSValueReverse) {
897 result.type = OffsetRotationAuto; 897 result.type = OffsetRotationAuto;
898 result.angle += 180; 898 result.angle = clampTo<float>(result.angle + 180);
899 } else { 899 } else {
900 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item); 900 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item);
901 result.angle += primitiveValue.computeDegrees(); 901 result.angle =
902 clampTo<float>(result.angle + primitiveValue.computeDegrees());
902 } 903 }
903 } 904 }
904 result.angle = clampTo<float>(result.angle);
905 905
906 return result; 906 return result;
907 } 907 }
908 908
909 LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state, 909 LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state,
910 const CSSValue& value) { 910 const CSSValue& value) {
911 const CSSValuePair& pair = toCSSValuePair(value); 911 const CSSValuePair& pair = toCSSValuePair(value);
912 return LengthPoint( 912 return LengthPoint(
913 convertPositionLength<CSSValueLeft, CSSValueRight>(state, pair.first()), 913 convertPositionLength<CSSValueLeft, CSSValueRight>(state, pair.first()),
914 convertPositionLength<CSSValueTop, CSSValueBottom>(state, pair.second())); 914 convertPositionLength<CSSValueTop, CSSValueBottom>(state, pair.second()));
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 // Instead of the actual zoom, use 1 to avoid potential rounding errors 1295 // Instead of the actual zoom, use 1 to avoid potential rounding errors
1296 Length length = primitiveValue.convertToLength( 1296 Length length = primitiveValue.convertToLength(
1297 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); 1297 state.cssToLengthConversionData().copyWithAdjustedZoom(1));
1298 return *CSSPrimitiveValue::create(length, 1); 1298 return *CSSPrimitiveValue::create(length, 1);
1299 } 1299 }
1300 } 1300 }
1301 return value; 1301 return value;
1302 } 1302 }
1303 1303
1304 } // namespace blink 1304 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698