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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "core/animation/KeyframeEffectModel.h" | 31 #include "core/animation/KeyframeEffectModel.h" |
32 | 32 |
33 #include "core/animation/AnimationEffectReadOnly.h" | 33 #include "core/animation/AnimationEffectReadOnly.h" |
34 #include "core/animation/CompositorAnimations.h" | 34 #include "core/animation/CompositorAnimations.h" |
35 #include "core/animation/css/CSSAnimatableValueFactory.h" | 35 #include "core/animation/css/CSSAnimatableValueFactory.h" |
36 #include "core/css/CSSPropertyEquality.h" | 36 #include "core/css/CSSPropertyEquality.h" |
37 #include "core/css/resolver/StyleResolver.h" | 37 #include "core/css/resolver/StyleResolver.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| 39 #include "core/frame/UseCounter.h" |
39 #include "platform/animation/AnimationUtilities.h" | 40 #include "platform/animation/AnimationUtilities.h" |
40 #include "platform/geometry/FloatBox.h" | 41 #include "platform/geometry/FloatBox.h" |
41 #include "platform/transforms/TransformationMatrix.h" | 42 #include "platform/transforms/TransformationMatrix.h" |
42 #include "wtf/PtrUtil.h" | 43 #include "wtf/PtrUtil.h" |
43 #include "wtf/text/StringHash.h" | 44 #include "wtf/text/StringHash.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 PropertyHandleSet KeyframeEffectModelBase::properties() const { | 48 PropertyHandleSet KeyframeEffectModelBase::properties() const { |
48 PropertyHandleSet result; | 49 PropertyHandleSet result; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 104 } |
104 return updated; | 105 return updated; |
105 } | 106 } |
106 | 107 |
107 bool KeyframeEffectModelBase::snapshotAllCompositorKeyframes( | 108 bool KeyframeEffectModelBase::snapshotAllCompositorKeyframes( |
108 Element& element, | 109 Element& element, |
109 const ComputedStyle& baseStyle, | 110 const ComputedStyle& baseStyle, |
110 const ComputedStyle* parentStyle) const { | 111 const ComputedStyle* parentStyle) const { |
111 m_needsCompositorKeyframesSnapshot = false; | 112 m_needsCompositorKeyframesSnapshot = false; |
112 bool updated = false; | 113 bool updated = false; |
| 114 bool hasNeutralCompositableKeyframe = false; |
113 ensureKeyframeGroups(); | 115 ensureKeyframeGroups(); |
114 for (CSSPropertyID property : CompositorAnimations::compositableProperties) { | 116 for (CSSPropertyID property : CompositorAnimations::compositableProperties) { |
115 PropertySpecificKeyframeGroup* keyframeGroup = | 117 PropertySpecificKeyframeGroup* keyframeGroup = |
116 m_keyframeGroups->get(PropertyHandle(property)); | 118 m_keyframeGroups->get(PropertyHandle(property)); |
117 if (!keyframeGroup) | 119 if (!keyframeGroup) |
118 continue; | 120 continue; |
119 for (auto& keyframe : keyframeGroup->m_keyframes) | 121 for (auto& keyframe : keyframeGroup->m_keyframes) { |
120 updated |= keyframe->populateAnimatableValue(property, element, baseStyle, | 122 updated |= keyframe->populateAnimatableValue(property, element, baseStyle, |
121 parentStyle); | 123 parentStyle); |
| 124 hasNeutralCompositableKeyframe |= keyframe->isNeutral(); |
| 125 } |
| 126 } |
| 127 if (updated && hasNeutralCompositableKeyframe) { |
| 128 UseCounter::count(element.document(), |
| 129 UseCounter::SyntheticKeyframesInCompositedCSSAnimation); |
122 } | 130 } |
123 return updated; | 131 return updated; |
124 } | 132 } |
125 | 133 |
126 KeyframeEffectModelBase::KeyframeVector | 134 KeyframeEffectModelBase::KeyframeVector |
127 KeyframeEffectModelBase::normalizedKeyframes(const KeyframeVector& keyframes) { | 135 KeyframeEffectModelBase::normalizedKeyframes(const KeyframeVector& keyframes) { |
128 double lastOffset = 0; | 136 double lastOffset = 0; |
129 KeyframeVector result; | 137 KeyframeVector result; |
130 result.reserveCapacity(keyframes.size()); | 138 result.reserveCapacity(keyframes.size()); |
131 | 139 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 317 } |
310 if (m_keyframes.back()->offset() != 1.0) { | 318 if (m_keyframes.back()->offset() != 1.0) { |
311 appendKeyframe(m_keyframes.back()->neutralKeyframe(1, nullptr)); | 319 appendKeyframe(m_keyframes.back()->neutralKeyframe(1, nullptr)); |
312 addedSyntheticKeyframe = true; | 320 addedSyntheticKeyframe = true; |
313 } | 321 } |
314 | 322 |
315 return addedSyntheticKeyframe; | 323 return addedSyntheticKeyframe; |
316 } | 324 } |
317 | 325 |
318 } // namespace blink | 326 } // namespace blink |
OLD | NEW |