OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/css/CSSBorderImage.h" | 32 #include "core/css/CSSBorderImage.h" |
33 #include "core/css/CSSContentDistributionValue.h" | 33 #include "core/css/CSSContentDistributionValue.h" |
34 #include "core/css/CSSCounterValue.h" | 34 #include "core/css/CSSCounterValue.h" |
35 #include "core/css/CSSCrossfadeValue.h" | 35 #include "core/css/CSSCrossfadeValue.h" |
36 #include "core/css/CSSCursorImageValue.h" | 36 #include "core/css/CSSCursorImageValue.h" |
37 #include "core/css/CSSCustomIdentValue.h" | 37 #include "core/css/CSSCustomIdentValue.h" |
38 #include "core/css/CSSFunctionValue.h" | 38 #include "core/css/CSSFunctionValue.h" |
39 #include "core/css/CSSGridLineNamesValue.h" | 39 #include "core/css/CSSGridLineNamesValue.h" |
40 #include "core/css/CSSImageSetValue.h" | 40 #include "core/css/CSSImageSetValue.h" |
41 #include "core/css/CSSImageValue.h" | 41 #include "core/css/CSSImageValue.h" |
42 #include "core/css/CSSPathValue.h" | |
43 #include "core/css/CSSPrimitiveValueMappings.h" | 42 #include "core/css/CSSPrimitiveValueMappings.h" |
44 #include "core/css/CSSProperty.h" | 43 #include "core/css/CSSProperty.h" |
45 #include "core/css/CSSPropertyMetadata.h" | 44 #include "core/css/CSSPropertyMetadata.h" |
46 #include "core/css/CSSQuadValue.h" | 45 #include "core/css/CSSQuadValue.h" |
47 #include "core/css/CSSReflectValue.h" | 46 #include "core/css/CSSReflectValue.h" |
48 #include "core/css/CSSShadowValue.h" | 47 #include "core/css/CSSShadowValue.h" |
49 #include "core/css/CSSStringValue.h" | 48 #include "core/css/CSSStringValue.h" |
50 #include "core/css/CSSTimingFunctionValue.h" | 49 #include "core/css/CSSTimingFunctionValue.h" |
51 #include "core/css/CSSURIValue.h" | 50 #include "core/css/CSSURIValue.h" |
52 #include "core/css/CSSValuePair.h" | 51 #include "core/css/CSSValuePair.h" |
53 #include "core/css/CSSValuePool.h" | 52 #include "core/css/CSSValuePool.h" |
54 #include "core/css/CSSVariableReferenceValue.h" | 53 #include "core/css/CSSVariableReferenceValue.h" |
55 #include "core/css/HashTools.h" | 54 #include "core/css/HashTools.h" |
56 #include "core/css/parser/CSSParserFastPaths.h" | 55 #include "core/css/parser/CSSParserFastPaths.h" |
57 #include "core/css/parser/CSSParserValues.h" | 56 #include "core/css/parser/CSSParserValues.h" |
58 #include "core/frame/UseCounter.h" | 57 #include "core/frame/UseCounter.h" |
59 #include "core/style/GridCoordinate.h" | 58 #include "core/style/GridCoordinate.h" |
60 #include "core/svg/SVGPathUtilities.h" | |
61 #include "platform/RuntimeEnabledFeatures.h" | 59 #include "platform/RuntimeEnabledFeatures.h" |
62 | 60 |
63 namespace blink { | 61 namespace blink { |
64 | 62 |
65 template <unsigned N> | 63 template <unsigned N> |
66 static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N]) | 64 static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N]) |
67 { | 65 { |
68 unsigned length = N - 1; // Ignore the trailing null character | 66 unsigned length = N - 1; // Ignore the trailing null character |
69 if (a.length() != length) | 67 if (a.length() != length) |
70 return false; | 68 return false; |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); | 891 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); |
894 if (!list || list->length() == 3) | 892 if (!list || list->length() == 3) |
895 return false; | 893 return false; |
896 // This values are added to match gecko serialization. | 894 // This values are added to match gecko serialization. |
897 if (list->length() == 1) | 895 if (list->length() == 1) |
898 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::UnitT
ype::Percentage)); | 896 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::UnitT
ype::Percentage)); |
899 addProperty(propId, list.release(), important); | 897 addProperty(propId, list.release(), important); |
900 return true; | 898 return true; |
901 } | 899 } |
902 | 900 |
903 case CSSPropertyMotion: | |
904 // <motion-path> && <motion-offset> && <motion-rotation> | |
905 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
906 return parseShorthand(propId, motionShorthand(), important); | |
907 case CSSPropertyMotionPath: | |
908 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
909 if (id == CSSValueNone) | |
910 validPrimitive = true; | |
911 else | |
912 parsedValue = parseMotionPath(); | |
913 break; | |
914 case CSSPropertyMotionOffset: | |
915 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
916 validPrimitive = validUnit(value, FLength | FPercent); | |
917 break; | |
918 case CSSPropertyMotionRotation: | |
919 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
920 parsedValue = parseMotionRotation(); | |
921 break; | |
922 | |
923 case CSSPropertyJustifyContent: | 901 case CSSPropertyJustifyContent: |
924 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 902 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
925 parsedValue = parseContentDistributionOverflowPosition(); | 903 parsedValue = parseContentDistributionOverflowPosition(); |
926 break; | 904 break; |
927 case CSSPropertyJustifySelf: | 905 case CSSPropertyJustifySelf: |
928 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 906 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
929 return parseItemPositionOverflowPosition(propId, important); | 907 return parseItemPositionOverflowPosition(propId, important); |
930 case CSSPropertyJustifyItems: | 908 case CSSPropertyJustifyItems: |
931 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 909 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
932 | 910 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 case CSSPropertyColor: | 1181 case CSSPropertyColor: |
1204 case CSSPropertyZIndex: | 1182 case CSSPropertyZIndex: |
1205 case CSSPropertyTextShadow: | 1183 case CSSPropertyTextShadow: |
1206 case CSSPropertyBoxShadow: | 1184 case CSSPropertyBoxShadow: |
1207 case CSSPropertyWebkitFilter: | 1185 case CSSPropertyWebkitFilter: |
1208 case CSSPropertyBackdropFilter: | 1186 case CSSPropertyBackdropFilter: |
1209 case CSSPropertyTextDecorationColor: | 1187 case CSSPropertyTextDecorationColor: |
1210 case CSSPropertyWebkitTextDecorationsInEffect: | 1188 case CSSPropertyWebkitTextDecorationsInEffect: |
1211 case CSSPropertyTextDecorationLine: | 1189 case CSSPropertyTextDecorationLine: |
1212 case CSSPropertyTextDecoration: | 1190 case CSSPropertyTextDecoration: |
| 1191 case CSSPropertyMotionPath: |
| 1192 case CSSPropertyMotionOffset: |
| 1193 case CSSPropertyMotionRotation: |
| 1194 case CSSPropertyMotion: |
1213 validPrimitive = false; | 1195 validPrimitive = false; |
1214 break; | 1196 break; |
1215 | 1197 |
1216 case CSSPropertyScrollSnapPointsX: | 1198 case CSSPropertyScrollSnapPointsX: |
1217 case CSSPropertyScrollSnapPointsY: | 1199 case CSSPropertyScrollSnapPointsY: |
1218 parsedValue = parseScrollSnapPoints(); | 1200 parsedValue = parseScrollSnapPoints(); |
1219 break; | 1201 break; |
1220 case CSSPropertyScrollSnapCoordinate: | 1202 case CSSPropertyScrollSnapCoordinate: |
1221 parsedValue = parseScrollSnapCoordinate(); | 1203 parsedValue = parseScrollSnapCoordinate(); |
1222 break; | 1204 break; |
(...skipping 4738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5961 if (!isComma(a)) | 5943 if (!isComma(a)) |
5962 return nullptr; | 5944 return nullptr; |
5963 a = args->next(); | 5945 a = args->next(); |
5964 | 5946 |
5965 argNumber++; | 5947 argNumber++; |
5966 } | 5948 } |
5967 | 5949 |
5968 return transformValue.release(); | 5950 return transformValue.release(); |
5969 } | 5951 } |
5970 | 5952 |
5971 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionPath() | |
5972 { | |
5973 CSSParserValue* value = m_valueList->current(); | |
5974 | |
5975 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | |
5976 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV
aluePath) | |
5977 return nullptr; | |
5978 | |
5979 // FIXME: Add support for <fill-rule>. | |
5980 CSSParserValueList* functionArgs = value->function->args.get(); | |
5981 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) | |
5982 return nullptr; | |
5983 | |
5984 CSSParserValue* arg = functionArgs->current(); | |
5985 if (arg->m_unit != CSSParserValue::String) | |
5986 return nullptr; | |
5987 | |
5988 String pathString = arg->string; | |
5989 Path path; | |
5990 if (!buildPathFromString(pathString, path)) | |
5991 return nullptr; | |
5992 | |
5993 m_valueList->next(); | |
5994 return CSSPathValue::create(pathString); | |
5995 } | |
5996 | |
5997 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionRotation() | |
5998 { | |
5999 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | |
6000 bool hasAutoOrReverse = false; | |
6001 bool hasAngle = false; | |
6002 | |
6003 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | |
6004 if ((value->id == CSSValueAuto || value->id == CSSValueReverse) && !hasA
utoOrReverse) { | |
6005 list->append(cssValuePool().createIdentifierValue(value->id)); | |
6006 hasAutoOrReverse = true; | |
6007 } else if (!hasAngle && validUnit(value, FAngle)) { | |
6008 list->append(createPrimitiveNumericValue(value)); | |
6009 hasAngle = true; | |
6010 } else { | |
6011 break; | |
6012 } | |
6013 } | |
6014 | |
6015 if (!list->length()) | |
6016 return nullptr; | |
6017 | |
6018 return list.release(); | |
6019 } | |
6020 | |
6021 } // namespace blink | 5953 } // namespace blink |
OLD | NEW |