| OLD | NEW |
| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 Length length = StyleBuilderConverter::convertLength(state, pair->second
()); | 642 Length length = StyleBuilderConverter::convertLength(state, pair->second
()); |
| 643 if (pair->first()->getValueID() == cssValueFor0) | 643 if (pair->first()->getValueID() == cssValueFor0) |
| 644 return length; | 644 return length; |
| 645 ASSERT(pair->first()->getValueID() == cssValueFor100); | 645 ASSERT(pair->first()->getValueID() == cssValueFor100); |
| 646 return length.subtractFromOneHundredPercent(); | 646 return length.subtractFromOneHundredPercent(); |
| 647 } | 647 } |
| 648 | 648 |
| 649 return StyleBuilderConverter::convertLength(state, primitiveValue); | 649 return StyleBuilderConverter::convertLength(state, primitiveValue); |
| 650 } | 650 } |
| 651 | 651 |
| 652 LengthPoint StyleBuilderConverter::convertObjectPosition(StyleResolverState& sta
te, CSSValue* value) | 652 LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state, CS
SValue* value) |
| 653 { | 653 { |
| 654 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 654 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 655 Pair* pair = primitiveValue->getPairValue(); | 655 Pair* pair = primitiveValue->getPairValue(); |
| 656 return LengthPoint( | 656 return LengthPoint( |
| 657 convertPositionLength<CSSValueLeft, CSSValueRight>(state, pair->first())
, | 657 convertPositionLength<CSSValueLeft, CSSValueRight>(state, pair->first())
, |
| 658 convertPositionLength<CSSValueTop, CSSValueBottom>(state, pair->second()
) | 658 convertPositionLength<CSSValueTop, CSSValueBottom>(state, pair->second()
) |
| 659 ); | 659 ); |
| 660 } | 660 } |
| 661 | 661 |
| 662 static float convertPerspectiveLength(StyleResolverState& state, CSSPrimitiveVal
ue* primitiveValue) | 662 static float convertPerspectiveLength(StyleResolverState& state, CSSPrimitiveVal
ue* primitiveValue) |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 CSSPrimitiveValue* primitiveValueY = toCSSPrimitiveValue(list->item(1)); | 894 CSSPrimitiveValue* primitiveValueY = toCSSPrimitiveValue(list->item(1)); |
| 895 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); | 895 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); |
| 896 | 896 |
| 897 return TransformOrigin( | 897 return TransformOrigin( |
| 898 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX)
, | 898 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX)
, |
| 899 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY)
, | 899 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY)
, |
| 900 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu
eZ) | 900 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu
eZ) |
| 901 ); | 901 ); |
| 902 } | 902 } |
| 903 | 903 |
| 904 ScrollSnapPoints StyleBuilderConverter::convertSnapPoints(StyleResolverState& st
ate, CSSValue* value) |
| 905 { |
| 906 // Handles: none | repeat(<length>) |
| 907 ScrollSnapPoints points; |
| 908 points.hasRepeat = false; |
| 909 |
| 910 if (!value->isFunctionValue()) |
| 911 return points; |
| 912 |
| 913 CSSFunctionValue* repeatFunction = toCSSFunctionValue(value); |
| 914 ASSERT_WITH_SECURITY_IMPLICATION(repeatFunction->length() == 1); |
| 915 points.repeatOffset = convertLength(state, toCSSPrimitiveValue(repeatFunctio
n->item(0))); |
| 916 points.hasRepeat = true; |
| 917 |
| 918 return points; |
| 919 } |
| 920 |
| 921 Vector<LengthPoint> StyleBuilderConverter::convertSnapCoordinates(StyleResolverS
tate& state, CSSValue* value) |
| 922 { |
| 923 // Handles: none | <position># |
| 924 Vector<LengthPoint> coordinates; |
| 925 |
| 926 if (!value->isValueList()) |
| 927 return coordinates; |
| 928 |
| 929 CSSValueList* valueList = toCSSValueList(value); |
| 930 coordinates.reserveInitialCapacity(valueList->length()); |
| 931 for (auto& snapCoordinate : *valueList) { |
| 932 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get())
); |
| 933 } |
| 934 |
| 935 return coordinates; |
| 936 } |
| 937 |
| 904 } // namespace blink | 938 } // namespace blink |
| OLD | NEW |