| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/css/StyleRuleKeyframe.h" | 6 #include "core/css/StyleRuleKeyframe.h" |
| 7 | 7 |
| 8 #include "core/css/StylePropertySet.h" | 8 #include "core/css/StylePropertySet.h" |
| 9 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
| 10 #include "core/css/parser/CSSParserValues.h" | 10 #include "core/css/parser/CSSParserValues.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 result.append(' '); | 79 result.append(' '); |
| 80 result.append('}'); | 80 result.append('}'); |
| 81 return result.toString(); | 81 return result.toString(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 PassOwnPtr<Vector<double>> StyleRuleKeyframe::createKeyList(CSSParserValueList*
keys) | 84 PassOwnPtr<Vector<double>> StyleRuleKeyframe::createKeyList(CSSParserValueList*
keys) |
| 85 { | 85 { |
| 86 size_t numKeys = keys ? keys->size() : 0; | 86 size_t numKeys = keys ? keys->size() : 0; |
| 87 OwnPtr<Vector<double>> keyVector = adoptPtr(new Vector<double>(numKeys)); | 87 OwnPtr<Vector<double>> keyVector = adoptPtr(new Vector<double>(numKeys)); |
| 88 for (size_t i = 0; i < numKeys; ++i) { | 88 for (size_t i = 0; i < numKeys; ++i) { |
| 89 ASSERT(keys->valueAt(i)->unit == blink::CSSPrimitiveValue::CSS_NUMBER); | 89 ASSERT(keys->valueAt(i)->unit == CSSPrimitiveValue::CSS_NUMBER); |
| 90 double key = keys->valueAt(i)->fValue; | 90 double key = keys->valueAt(i)->fValue; |
| 91 if (key < 0 || key > 100) { | 91 if (key < 0 || key > 100) { |
| 92 // As per http://www.w3.org/TR/css3-animations/#keyframes, | 92 // As per http://www.w3.org/TR/css3-animations/#keyframes, |
| 93 // "If a keyframe selector specifies negative percentage values | 93 // "If a keyframe selector specifies negative percentage values |
| 94 // or values higher than 100%, then the keyframe will be ignored." | 94 // or values higher than 100%, then the keyframe will be ignored." |
| 95 keyVector->clear(); | 95 keyVector->clear(); |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 keyVector->at(i) = key / 100; | 98 keyVector->at(i) = key / 100; |
| 99 } | 99 } |
| 100 return keyVector.release(); | 100 return keyVector.release(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleKeyframe) | 103 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleKeyframe) |
| 104 { | 104 { |
| 105 visitor->trace(m_properties); | 105 visitor->trace(m_properties); |
| 106 StyleRuleBase::traceAfterDispatch(visitor); | 106 StyleRuleBase::traceAfterDispatch(visitor); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace blink | 109 } // namespace blink |
| OLD | NEW |