| 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/HashTools.h" | 53 #include "core/css/HashTools.h" |
| 55 #include "core/css/parser/CSSParserFastPaths.h" | 54 #include "core/css/parser/CSSParserFastPaths.h" |
| 56 #include "core/css/parser/CSSParserValues.h" | 55 #include "core/css/parser/CSSParserValues.h" |
| 57 #include "core/frame/UseCounter.h" | 56 #include "core/frame/UseCounter.h" |
| 58 #include "core/style/GridCoordinate.h" | 57 #include "core/style/GridCoordinate.h" |
| 59 #include "core/svg/SVGPathUtilities.h" | |
| 60 #include "platform/RuntimeEnabledFeatures.h" | 58 #include "platform/RuntimeEnabledFeatures.h" |
| 61 | 59 |
| 62 namespace blink { | 60 namespace blink { |
| 63 | 61 |
| 64 template <unsigned N> | 62 template <unsigned N> |
| 65 static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N]) | 63 static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N]) |
| 66 { | 64 { |
| 67 unsigned length = N - 1; // Ignore the trailing null character | 65 unsigned length = N - 1; // Ignore the trailing null character |
| 68 if (a.length() != length) | 66 if (a.length() != length) |
| 69 return false; | 67 return false; |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); | 898 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); |
| 901 if (!list || list->length() == 3) | 899 if (!list || list->length() == 3) |
| 902 return false; | 900 return false; |
| 903 // This values are added to match gecko serialization. | 901 // This values are added to match gecko serialization. |
| 904 if (list->length() == 1) | 902 if (list->length() == 1) |
| 905 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::UnitT
ype::Percentage)); | 903 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::UnitT
ype::Percentage)); |
| 906 addProperty(propId, list.release(), important); | 904 addProperty(propId, list.release(), important); |
| 907 return true; | 905 return true; |
| 908 } | 906 } |
| 909 | 907 |
| 910 case CSSPropertyMotion: | |
| 911 // <motion-path> && <motion-offset> && <motion-rotation> | |
| 912 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
| 913 return parseShorthand(propId, motionShorthand(), important); | |
| 914 case CSSPropertyMotionPath: | |
| 915 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
| 916 if (id == CSSValueNone) | |
| 917 validPrimitive = true; | |
| 918 else | |
| 919 parsedValue = parseMotionPath(); | |
| 920 break; | |
| 921 case CSSPropertyMotionOffset: | |
| 922 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
| 923 validPrimitive = validUnit(value, FLength | FPercent); | |
| 924 break; | |
| 925 case CSSPropertyMotionRotation: | |
| 926 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | |
| 927 parsedValue = parseMotionRotation(); | |
| 928 break; | |
| 929 | |
| 930 case CSSPropertyJustifyContent: | 908 case CSSPropertyJustifyContent: |
| 931 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 909 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 932 parsedValue = parseContentDistributionOverflowPosition(); | 910 parsedValue = parseContentDistributionOverflowPosition(); |
| 933 break; | 911 break; |
| 934 case CSSPropertyJustifySelf: | 912 case CSSPropertyJustifySelf: |
| 935 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 913 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 936 return parseItemPositionOverflowPosition(propId, important); | 914 return parseItemPositionOverflowPosition(propId, important); |
| 937 case CSSPropertyJustifyItems: | 915 case CSSPropertyJustifyItems: |
| 938 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 916 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 939 | 917 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 case CSSPropertyOrphans: | 1184 case CSSPropertyOrphans: |
| 1207 case CSSPropertyWidows: | 1185 case CSSPropertyWidows: |
| 1208 case CSSPropertyWebkitTapHighlightColor: | 1186 case CSSPropertyWebkitTapHighlightColor: |
| 1209 case CSSPropertyWebkitTextFillColor: | 1187 case CSSPropertyWebkitTextFillColor: |
| 1210 case CSSPropertyColor: | 1188 case CSSPropertyColor: |
| 1211 case CSSPropertyZIndex: | 1189 case CSSPropertyZIndex: |
| 1212 case CSSPropertyTextShadow: | 1190 case CSSPropertyTextShadow: |
| 1213 case CSSPropertyBoxShadow: | 1191 case CSSPropertyBoxShadow: |
| 1214 case CSSPropertyWebkitFilter: | 1192 case CSSPropertyWebkitFilter: |
| 1215 case CSSPropertyBackdropFilter: | 1193 case CSSPropertyBackdropFilter: |
| 1194 case CSSPropertyMotionPath: |
| 1195 case CSSPropertyMotionOffset: |
| 1196 case CSSPropertyMotionRotation: |
| 1197 case CSSPropertyMotion: |
| 1216 validPrimitive = false; | 1198 validPrimitive = false; |
| 1217 break; | 1199 break; |
| 1218 | 1200 |
| 1219 case CSSPropertyScrollSnapPointsX: | 1201 case CSSPropertyScrollSnapPointsX: |
| 1220 case CSSPropertyScrollSnapPointsY: | 1202 case CSSPropertyScrollSnapPointsY: |
| 1221 parsedValue = parseScrollSnapPoints(); | 1203 parsedValue = parseScrollSnapPoints(); |
| 1222 break; | 1204 break; |
| 1223 case CSSPropertyScrollSnapCoordinate: | 1205 case CSSPropertyScrollSnapCoordinate: |
| 1224 parsedValue = parseScrollSnapCoordinate(); | 1206 parsedValue = parseScrollSnapCoordinate(); |
| 1225 break; | 1207 break; |
| (...skipping 4771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5997 if (!isComma(a)) | 5979 if (!isComma(a)) |
| 5998 return nullptr; | 5980 return nullptr; |
| 5999 a = args->next(); | 5981 a = args->next(); |
| 6000 | 5982 |
| 6001 argNumber++; | 5983 argNumber++; |
| 6002 } | 5984 } |
| 6003 | 5985 |
| 6004 return transformValue.release(); | 5986 return transformValue.release(); |
| 6005 } | 5987 } |
| 6006 | 5988 |
| 6007 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionPath() | |
| 6008 { | |
| 6009 CSSParserValue* value = m_valueList->current(); | |
| 6010 | |
| 6011 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | |
| 6012 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV
aluePath) | |
| 6013 return nullptr; | |
| 6014 | |
| 6015 // FIXME: Add support for <fill-rule>. | |
| 6016 CSSParserValueList* functionArgs = value->function->args.get(); | |
| 6017 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) | |
| 6018 return nullptr; | |
| 6019 | |
| 6020 CSSParserValue* arg = functionArgs->current(); | |
| 6021 if (arg->m_unit != CSSParserValue::String) | |
| 6022 return nullptr; | |
| 6023 | |
| 6024 String pathString = arg->string; | |
| 6025 Path path; | |
| 6026 if (!buildPathFromString(pathString, path)) | |
| 6027 return nullptr; | |
| 6028 | |
| 6029 m_valueList->next(); | |
| 6030 return CSSPathValue::create(pathString); | |
| 6031 } | |
| 6032 | |
| 6033 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionRotation() | |
| 6034 { | |
| 6035 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | |
| 6036 bool hasAutoOrReverse = false; | |
| 6037 bool hasAngle = false; | |
| 6038 | |
| 6039 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | |
| 6040 if ((value->id == CSSValueAuto || value->id == CSSValueReverse) && !hasA
utoOrReverse) { | |
| 6041 list->append(cssValuePool().createIdentifierValue(value->id)); | |
| 6042 hasAutoOrReverse = true; | |
| 6043 } else if (!hasAngle && validUnit(value, FAngle)) { | |
| 6044 list->append(createPrimitiveNumericValue(value)); | |
| 6045 hasAngle = true; | |
| 6046 } else { | |
| 6047 break; | |
| 6048 } | |
| 6049 } | |
| 6050 | |
| 6051 if (!list->length()) | |
| 6052 return nullptr; | |
| 6053 | |
| 6054 return list.release(); | |
| 6055 } | |
| 6056 | |
| 6057 } // namespace blink | 5989 } // namespace blink |
| OLD | NEW |