| 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 4286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4297 if (!isComma(v)) | 4297 if (!isComma(v)) |
| 4298 return false; | 4298 return false; |
| 4299 args->next(); | 4299 args->next(); |
| 4300 return true; | 4300 return true; |
| 4301 } | 4301 } |
| 4302 | 4302 |
| 4303 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction
() | 4303 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction
() |
| 4304 { | 4304 { |
| 4305 CSSParserValue* value = m_valueList->current(); | 4305 CSSParserValue* value = m_valueList->current(); |
| 4306 if (value->id == CSSValueEase || value->id == CSSValueLinear || value->id ==
CSSValueEaseIn || value->id == CSSValueEaseOut | 4306 if (value->id == CSSValueEase || value->id == CSSValueLinear || value->id ==
CSSValueEaseIn || value->id == CSSValueEaseOut |
| 4307 || value->id == CSSValueEaseInOut || value->id == CSSValueStepStart || v
alue->id == CSSValueStepEnd) | 4307 || value->id == CSSValueEaseInOut || value->id == CSSValueStepStart || v
alue->id == CSSValueStepEnd |
| 4308 || (value->id == CSSValueStepMiddle && RuntimeEnabledFeatures::webAnimat
ionsAPIEnabled())) |
| 4308 return cssValuePool().createIdentifierValue(value->id); | 4309 return cssValuePool().createIdentifierValue(value->id); |
| 4309 | 4310 |
| 4310 // We must be a function. | 4311 // We must be a function. |
| 4311 if (value->unit != CSSParserValue::Function) | 4312 if (value->unit != CSSParserValue::Function) |
| 4312 return nullptr; | 4313 return nullptr; |
| 4313 | 4314 |
| 4314 CSSParserValueList* args = value->function->args.get(); | 4315 CSSParserValueList* args = value->function->args.get(); |
| 4315 | 4316 |
| 4316 if (equalIgnoringCase(value->function->name, "steps(")) { | 4317 if (equalIgnoringCase(value->function->name, "steps(")) { |
| 4317 // For steps, 1 or 2 params must be specified (comma-separated) | 4318 // For steps, 1 or 2 params must be specified (comma-separated) |
| 4318 if (!args || (args->size() != 1 && args->size() != 3)) | 4319 if (!args || (args->size() != 1 && args->size() != 3)) |
| 4319 return nullptr; | 4320 return nullptr; |
| 4320 | 4321 |
| 4321 // There are two values. | 4322 // There are two values. |
| 4322 int numSteps; | 4323 int numSteps; |
| 4323 bool stepAtStart = false; | 4324 StepsTimingFunction::StepAtPosition stepAtPosition = StepsTimingFunction
::StepAtEnd; |
| 4324 | 4325 |
| 4325 CSSParserValue* v = args->current(); | 4326 CSSParserValue* v = args->current(); |
| 4326 if (!validUnit(v, FInteger)) | 4327 if (!validUnit(v, FInteger)) |
| 4327 return nullptr; | 4328 return nullptr; |
| 4328 numSteps = clampToInteger(v->fValue); | 4329 numSteps = clampToInteger(v->fValue); |
| 4329 if (numSteps < 1) | 4330 if (numSteps < 1) |
| 4330 return nullptr; | 4331 return nullptr; |
| 4331 v = args->next(); | 4332 v = args->next(); |
| 4332 | 4333 |
| 4333 if (v) { | 4334 if (v) { |
| 4334 // There is a comma so we need to parse the second value | 4335 // There is a comma so we need to parse the second value |
| 4335 if (!isComma(v)) | 4336 if (!isComma(v)) |
| 4336 return nullptr; | 4337 return nullptr; |
| 4337 v = args->next(); | 4338 v = args->next(); |
| 4338 if (v->id != CSSValueStart && v->id != CSSValueEnd) | 4339 switch (v->id) { |
| 4340 case CSSValueMiddle: |
| 4341 if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) |
| 4342 return nullptr; |
| 4343 stepAtPosition = StepsTimingFunction::StepAtMiddle; |
| 4344 break; |
| 4345 case CSSValueStart: |
| 4346 stepAtPosition = StepsTimingFunction::StepAtStart; |
| 4347 break; |
| 4348 case CSSValueEnd: |
| 4349 stepAtPosition = StepsTimingFunction::StepAtEnd; |
| 4350 break; |
| 4351 default: |
| 4339 return nullptr; | 4352 return nullptr; |
| 4340 stepAtStart = v->id == CSSValueStart; | 4353 } |
| 4341 } | 4354 } |
| 4342 | 4355 |
| 4343 return CSSStepsTimingFunctionValue::create(numSteps, stepAtStart); | 4356 return CSSStepsTimingFunctionValue::create(numSteps, stepAtPosition); |
| 4344 } | 4357 } |
| 4345 | 4358 |
| 4346 if (equalIgnoringCase(value->function->name, "cubic-bezier(")) { | 4359 if (equalIgnoringCase(value->function->name, "cubic-bezier(")) { |
| 4347 // For cubic bezier, 4 values must be specified. | 4360 // For cubic bezier, 4 values must be specified. |
| 4348 if (!args || args->size() != 7) | 4361 if (!args || args->size() != 7) |
| 4349 return nullptr; | 4362 return nullptr; |
| 4350 | 4363 |
| 4351 // There are two points specified. The x values must be between 0 and 1
but the y values can exceed this range. | 4364 // There are two points specified. The x values must be between 0 and 1
but the y values can exceed this range. |
| 4352 double x1, y1, x2, y2; | 4365 double x1, y1, x2, y2; |
| 4353 | 4366 |
| (...skipping 5811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10165 { | 10178 { |
| 10166 // The tokenizer checks for the construct of an+b. | 10179 // The tokenizer checks for the construct of an+b. |
| 10167 // However, since the {ident} rule precedes the {nth} rule, some of those | 10180 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 10168 // tokens are identified as string literal. Furthermore we need to accept | 10181 // tokens are identified as string literal. Furthermore we need to accept |
| 10169 // "odd" and "even" which does not match to an+b. | 10182 // "odd" and "even" which does not match to an+b. |
| 10170 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10183 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 10171 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10184 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 10172 } | 10185 } |
| 10173 | 10186 |
| 10174 } | 10187 } |
| OLD | NEW |