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 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 if (!isComma(v)) | 3120 if (!isComma(v)) |
3121 return false; | 3121 return false; |
3122 args->next(); | 3122 args->next(); |
3123 return true; | 3123 return true; |
3124 } | 3124 } |
3125 | 3125 |
3126 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction
() | 3126 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction
() |
3127 { | 3127 { |
3128 CSSParserValue* value = m_valueList->current(); | 3128 CSSParserValue* value = m_valueList->current(); |
3129 if (value->id == CSSValueEase || value->id == CSSValueLinear || value->id ==
CSSValueEaseIn || value->id == CSSValueEaseOut | 3129 if (value->id == CSSValueEase || value->id == CSSValueLinear || value->id ==
CSSValueEaseIn || value->id == CSSValueEaseOut |
3130 || value->id == CSSValueEaseInOut || value->id == CSSValueStepStart || v
alue->id == CSSValueStepEnd) | 3130 || value->id == CSSValueEaseInOut || value->id == CSSValueStepStart || v
alue->id == CSSValueStepEnd |
| 3131 || (value->id == CSSValueStepMiddle && RuntimeEnabledFeatures::webAnimat
ionsAPIEnabled())) |
3131 return cssValuePool().createIdentifierValue(value->id); | 3132 return cssValuePool().createIdentifierValue(value->id); |
3132 | 3133 |
3133 // We must be a function. | 3134 // We must be a function. |
3134 if (value->unit != CSSParserValue::Function) | 3135 if (value->unit != CSSParserValue::Function) |
3135 return nullptr; | 3136 return nullptr; |
3136 | 3137 |
3137 CSSParserValueList* args = value->function->args.get(); | 3138 CSSParserValueList* args = value->function->args.get(); |
3138 | 3139 |
3139 if (equalIgnoringCase(value->function->name, "steps(")) { | 3140 if (equalIgnoringCase(value->function->name, "steps(")) { |
3140 // For steps, 1 or 2 params must be specified (comma-separated) | 3141 // For steps, 1 or 2 params must be specified (comma-separated) |
3141 if (!args || (args->size() != 1 && args->size() != 3)) | 3142 if (!args || (args->size() != 1 && args->size() != 3)) |
3142 return nullptr; | 3143 return nullptr; |
3143 | 3144 |
3144 // There are two values. | 3145 // There are two values. |
3145 int numSteps; | 3146 int numSteps; |
3146 bool stepAtStart = false; | 3147 StepsTimingFunction::StepAtPosition stepAtPosition = StepsTimingFunction
::StepAtEnd; |
3147 | 3148 |
3148 CSSParserValue* v = args->current(); | 3149 CSSParserValue* v = args->current(); |
3149 if (!validUnit(v, FInteger)) | 3150 if (!validUnit(v, FInteger)) |
3150 return nullptr; | 3151 return nullptr; |
3151 numSteps = clampToInteger(v->fValue); | 3152 numSteps = clampToInteger(v->fValue); |
3152 if (numSteps < 1) | 3153 if (numSteps < 1) |
3153 return nullptr; | 3154 return nullptr; |
3154 v = args->next(); | 3155 v = args->next(); |
3155 | 3156 |
3156 if (v) { | 3157 if (v) { |
3157 // There is a comma so we need to parse the second value | 3158 // There is a comma so we need to parse the second value |
3158 if (!isComma(v)) | 3159 if (!isComma(v)) |
3159 return nullptr; | 3160 return nullptr; |
3160 v = args->next(); | 3161 v = args->next(); |
3161 if (v->id != CSSValueStart && v->id != CSSValueEnd) | 3162 switch (v->id) { |
| 3163 case CSSValueMiddle: |
| 3164 if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) |
| 3165 return nullptr; |
| 3166 stepAtPosition = StepsTimingFunction::StepAtMiddle; |
| 3167 break; |
| 3168 case CSSValueStart: |
| 3169 stepAtPosition = StepsTimingFunction::StepAtStart; |
| 3170 break; |
| 3171 case CSSValueEnd: |
| 3172 stepAtPosition = StepsTimingFunction::StepAtEnd; |
| 3173 break; |
| 3174 default: |
3162 return nullptr; | 3175 return nullptr; |
3163 stepAtStart = v->id == CSSValueStart; | 3176 } |
3164 } | 3177 } |
3165 | 3178 |
3166 return CSSStepsTimingFunctionValue::create(numSteps, stepAtStart); | 3179 return CSSStepsTimingFunctionValue::create(numSteps, stepAtPosition); |
3167 } | 3180 } |
3168 | 3181 |
3169 if (equalIgnoringCase(value->function->name, "cubic-bezier(")) { | 3182 if (equalIgnoringCase(value->function->name, "cubic-bezier(")) { |
3170 // For cubic bezier, 4 values must be specified. | 3183 // For cubic bezier, 4 values must be specified. |
3171 if (!args || args->size() != 7) | 3184 if (!args || args->size() != 7) |
3172 return nullptr; | 3185 return nullptr; |
3173 | 3186 |
3174 // There are two points specified. The x values must be between 0 and 1
but the y values can exceed this range. | 3187 // There are two points specified. The x values must be between 0 and 1
but the y values can exceed this range. |
3175 double x1, y1, x2, y2; | 3188 double x1, y1, x2, y2; |
3176 | 3189 |
(...skipping 5260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8437 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8450 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8438 if (!seenStroke) | 8451 if (!seenStroke) |
8439 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8452 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8440 if (!seenMarkers) | 8453 if (!seenMarkers) |
8441 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8454 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8442 | 8455 |
8443 return parsedValues.release(); | 8456 return parsedValues.release(); |
8444 } | 8457 } |
8445 | 8458 |
8446 } // namespace WebCore | 8459 } // namespace WebCore |
OLD | NEW |