| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 namespace { | 50 namespace { |
| 51 | 51 |
| 52 bool compareKeyframes(const RefPtr<StringKeyframe>& a, | 52 bool compareKeyframes(const RefPtr<StringKeyframe>& a, |
| 53 const RefPtr<StringKeyframe>& b) { | 53 const RefPtr<StringKeyframe>& b) { |
| 54 return a->offset() < b->offset(); | 54 return a->offset() < b->offset(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Gets offset value from keyframeDictionary and returns false if this value was
invalid. | 57 // Gets offset value from keyframeDictionary and returns false if this value was |
| 58 // invalid. |
| 58 bool getAndCheckOffset(const Dictionary& keyframeDictionary, | 59 bool getAndCheckOffset(const Dictionary& keyframeDictionary, |
| 59 double& offset, | 60 double& offset, |
| 60 double lastOffset, | 61 double lastOffset, |
| 61 ExceptionState& exceptionState) { | 62 ExceptionState& exceptionState) { |
| 62 DictionaryHelper::get(keyframeDictionary, "offset", offset); | 63 DictionaryHelper::get(keyframeDictionary, "offset", offset); |
| 63 | 64 |
| 64 // Keyframes with offsets outside the range [0.0, 1.0] are an error. | 65 // Keyframes with offsets outside the range [0.0, 1.0] are an error. |
| 65 if (std::isnan(offset)) { | 66 if (std::isnan(offset)) { |
| 66 exceptionState.throwTypeError("Non numeric offset provided"); | 67 exceptionState.throwTypeError("Non numeric offset provided"); |
| 67 return false; | 68 return false; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (effectInput.isNull() || !element) | 171 if (effectInput.isNull() || !element) |
| 171 return nullptr; | 172 return nullptr; |
| 172 | 173 |
| 173 if (effectInput.isDictionarySequence()) | 174 if (effectInput.isDictionarySequence()) |
| 174 return convertArrayForm(*element, effectInput.getAsDictionarySequence(), | 175 return convertArrayForm(*element, effectInput.getAsDictionarySequence(), |
| 175 exceptionState); | 176 exceptionState); |
| 176 | 177 |
| 177 const Dictionary& dictionary = effectInput.getAsDictionary(); | 178 const Dictionary& dictionary = effectInput.getAsDictionary(); |
| 178 DictionaryIterator iterator = dictionary.getIterator(executionContext); | 179 DictionaryIterator iterator = dictionary.getIterator(executionContext); |
| 179 if (!iterator.isNull()) { | 180 if (!iterator.isNull()) { |
| 180 // TODO(alancutter): Convert keyframes during iteration rather than after to
match spec. | 181 // TODO(alancutter): Convert keyframes during iteration rather than after to |
| 182 // match spec. |
| 181 Vector<Dictionary> keyframeDictionaries; | 183 Vector<Dictionary> keyframeDictionaries; |
| 182 if (exhaustDictionaryIterator(iterator, executionContext, exceptionState, | 184 if (exhaustDictionaryIterator(iterator, executionContext, exceptionState, |
| 183 keyframeDictionaries)) | 185 keyframeDictionaries)) |
| 184 return convertArrayForm(*element, keyframeDictionaries, exceptionState); | 186 return convertArrayForm(*element, keyframeDictionaries, exceptionState); |
| 185 return nullptr; | 187 return nullptr; |
| 186 } | 188 } |
| 187 | 189 |
| 188 return convertObjectForm(*element, dictionary, executionContext, | 190 return convertObjectForm(*element, dictionary, executionContext, |
| 189 exceptionState); | 191 exceptionState); |
| 190 } | 192 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 370 } |
| 369 | 371 |
| 370 std::sort(keyframes.begin(), keyframes.end(), compareKeyframes); | 372 std::sort(keyframes.begin(), keyframes.end(), compareKeyframes); |
| 371 | 373 |
| 372 DCHECK(!exceptionState.hadException()); | 374 DCHECK(!exceptionState.hadException()); |
| 373 | 375 |
| 374 return createEffectModelFromKeyframes(element, keyframes, exceptionState); | 376 return createEffectModelFromKeyframes(element, keyframes, exceptionState); |
| 375 } | 377 } |
| 376 | 378 |
| 377 } // namespace blink | 379 } // namespace blink |
| OLD | NEW |