| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/animation/KeyframeEffectModel.h" | 36 #include "core/animation/KeyframeEffectModel.h" |
| 37 #include "core/animation/StringKeyframe.h" | 37 #include "core/animation/StringKeyframe.h" |
| 38 #include "core/css/parser/BisonCSSParser.h" | 38 #include "core/css/parser/BisonCSSParser.h" |
| 39 #include "core/css/resolver/CSSToStyleMap.h" | 39 #include "core/css/resolver/CSSToStyleMap.h" |
| 40 #include "core/css/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
| 41 #include "core/dom/Element.h" | 41 #include "core/dom/Element.h" |
| 42 #include "wtf/NonCopyingSort.h" | 42 #include "wtf/NonCopyingSort.h" |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 // FIXME: Remove this once we've removed the dependency on Element. | 46 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat
e) |
| 47 static bool checkDocumentAndRenderer(Element* element) | |
| 48 { | 47 { |
| 49 if (!element || !element->inActiveDocument()) | 48 // FIXME: Remove the dependency on element. |
| 50 return false; | 49 if (!element) |
| 51 element->document().updateRenderTreeIfNeeded(); | |
| 52 return element->renderer(); | |
| 53 } | |
| 54 | |
| 55 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat
e, bool unsafe) | |
| 56 { | |
| 57 // FIXME: This test will not be neccessary once resolution of keyframe value
s occurs at | |
| 58 // animation application time. | |
| 59 if (!unsafe && !checkDocumentAndRenderer(element)) | |
| 60 return nullptr; | 50 return nullptr; |
| 61 | 51 |
| 62 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); | 52 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); |
| 63 StringKeyframeVector keyframes; | 53 StringKeyframeVector keyframes; |
| 64 bool everyFrameHasOffset = true; | 54 bool everyFrameHasOffset = true; |
| 65 bool looselySortedByOffset = true; | 55 bool looselySortedByOffset = true; |
| 66 double lastOffset = -std::numeric_limits<double>::infinity(); | 56 double lastOffset = -std::numeric_limits<double>::infinity(); |
| 67 | 57 |
| 68 for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) { | 58 for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) { |
| 69 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); | 59 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (!keyframeEffectModel->isReplaceOnly()) { | 119 if (!keyframeEffectModel->isReplaceOnly()) { |
| 130 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); | 120 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); |
| 131 return nullptr; | 121 return nullptr; |
| 132 } | 122 } |
| 133 keyframeEffectModel->forceConversionsToAnimatableValues(element); | 123 keyframeEffectModel->forceConversionsToAnimatableValues(element); |
| 134 | 124 |
| 135 return keyframeEffectModel; | 125 return keyframeEffectModel; |
| 136 } | 126 } |
| 137 | 127 |
| 138 } // namespace WebCore | 128 } // namespace WebCore |
| OLD | NEW |