Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp

Issue 2043273002: Defer compositor keyframe snapshots until the next style resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ensureInterpolationEffectPopulated(); 71 ensureInterpolationEffectPopulated();
72 72
73 bool changed = iteration != m_lastIteration || fraction != m_lastFraction || iterationDuration != m_lastIterationDuration; 73 bool changed = iteration != m_lastIteration || fraction != m_lastFraction || iterationDuration != m_lastIterationDuration;
74 m_lastIteration = iteration; 74 m_lastIteration = iteration;
75 m_lastFraction = fraction; 75 m_lastFraction = fraction;
76 m_lastIterationDuration = iterationDuration; 76 m_lastIterationDuration = iterationDuration;
77 m_interpolationEffect.getActiveInterpolations(fraction, iterationDuration, r esult); 77 m_interpolationEffect.getActiveInterpolations(fraction, iterationDuration, r esult);
78 return changed; 78 return changed;
79 } 79 }
80 80
81 void KeyframeEffectModelBase::forceConversionsToAnimatableValues(Element& elemen t, const ComputedStyle* baseStyle) 81 bool KeyframeEffectModelBase::snapshotNeutralCompositorKeyframes(Element& elemen t, const ComputedStyle& oldStyle, const ComputedStyle& newStyle, const ComputedS tyle* parentStyle) const
82 {
83 ensureKeyframeGroups();
84 // TODO(alancutter): Defer compositor keyframe snapshotting to style resolve to remove the Element and ComputedStyle dependency here.
85 snapshotAllCompositorKeyframes(element, baseStyle);
86 ensureInterpolationEffectPopulated();
87 }
88
89 bool KeyframeEffectModelBase::snapshotNeutralCompositorKeyframes(Element& elemen t, const ComputedStyle& oldStyle, const ComputedStyle& newStyle)
90 { 82 {
91 bool updated = false; 83 bool updated = false;
92 ensureKeyframeGroups(); 84 ensureKeyframeGroups();
93 for (CSSPropertyID property : CompositorAnimations::compositableProperties) { 85 for (CSSPropertyID property : CompositorAnimations::compositableProperties) {
94 if (CSSPropertyEquality::propertiesEqual(property, oldStyle, newStyle)) 86 if (CSSPropertyEquality::propertiesEqual(property, oldStyle, newStyle))
95 continue; 87 continue;
96 PropertySpecificKeyframeGroup* keyframeGroup = m_keyframeGroups->get(Pro pertyHandle(property)); 88 PropertySpecificKeyframeGroup* keyframeGroup = m_keyframeGroups->get(Pro pertyHandle(property));
97 if (!keyframeGroup) 89 if (!keyframeGroup)
98 continue; 90 continue;
99 for (auto& keyframe : keyframeGroup->m_keyframes) { 91 for (auto& keyframe : keyframeGroup->m_keyframes) {
100 if (keyframe->isNeutral()) 92 if (keyframe->isNeutral())
101 updated |= keyframe->populateAnimatableValue(property, element, &newStyle, true); 93 updated |= keyframe->populateAnimatableValue(property, element, newStyle, parentStyle);
102 } 94 }
103 } 95 }
104 return updated; 96 return updated;
105 } 97 }
106 98
107 bool KeyframeEffectModelBase::snapshotAllCompositorKeyframes(Element& element, c onst ComputedStyle* baseStyle) 99 bool KeyframeEffectModelBase::snapshotAllCompositorKeyframes(Element& element, c onst ComputedStyle& baseStyle, const ComputedStyle* parentStyle) const
108 { 100 {
101 m_needsCompositorKeyframesSnapshot = false;
109 bool updated = false; 102 bool updated = false;
110 ensureKeyframeGroups(); 103 ensureKeyframeGroups();
111 for (CSSPropertyID property : CompositorAnimations::compositableProperties) { 104 for (CSSPropertyID property : CompositorAnimations::compositableProperties) {
112 PropertySpecificKeyframeGroup* keyframeGroup = m_keyframeGroups->get(Pro pertyHandle(property)); 105 PropertySpecificKeyframeGroup* keyframeGroup = m_keyframeGroups->get(Pro pertyHandle(property));
113 if (!keyframeGroup) 106 if (!keyframeGroup)
114 continue; 107 continue;
115 for (auto& keyframe : keyframeGroup->m_keyframes) 108 for (auto& keyframe : keyframeGroup->m_keyframes)
116 updated |= keyframe->populateAnimatableValue(property, element, base Style, true); 109 updated |= keyframe->populateAnimatableValue(property, element, base Style, parentStyle);
117 } 110 }
118 return updated; 111 return updated;
119 } 112 }
120 113
121 KeyframeEffectModelBase::KeyframeVector KeyframeEffectModelBase::normalizedKeyfr ames(const KeyframeVector& keyframes) 114 KeyframeEffectModelBase::KeyframeVector KeyframeEffectModelBase::normalizedKeyfr ames(const KeyframeVector& keyframes)
122 { 115 {
123 double lastOffset = 0; 116 double lastOffset = 0;
124 KeyframeVector result; 117 KeyframeVector result;
125 result.reserveCapacity(keyframes.size()); 118 result.reserveCapacity(keyframes.size());
126 119
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 291 }
299 if (m_keyframes.last()->offset() != 1.0) { 292 if (m_keyframes.last()->offset() != 1.0) {
300 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, nullptr)); 293 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, nullptr));
301 addedSyntheticKeyframe = true; 294 addedSyntheticKeyframe = true;
302 } 295 }
303 296
304 return addedSyntheticKeyframe; 297 return addedSyntheticKeyframe;
305 } 298 }
306 299
307 } // namespace blink 300 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698