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