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

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

Issue 196053009: Web Animations API: Constructing an Animation from a partial keyframe throws a JS exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@SyntheticKeyframesFix
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/animation/KeyframeEffectModel.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 applyTo = std::numeric_limits<double>::infinity(); 237 applyTo = std::numeric_limits<double>::infinity();
238 m_interpolationEffect->addInterpolation( 238 m_interpolationEffect->addInterpolation(
239 LegacyStyleInterpolation::create( 239 LegacyStyleInterpolation::create(
240 AnimatableValue::takeConstRef(start), 240 AnimatableValue::takeConstRef(start),
241 AnimatableValue::takeConstRef(end), iter->key), 241 AnimatableValue::takeConstRef(end), iter->key),
242 keyframes[i]->easing(), keyframes[i]->offset(), keyframes[i + 1] ->offset(), applyFrom, applyTo); 242 keyframes[i]->easing(), keyframes[i]->offset(), keyframes[i + 1] ->offset(), applyFrom, applyTo);
243 } 243 }
244 } 244 }
245 } 245 }
246 246
247 bool KeyframeEffectModel::isReplaceOnly()
248 {
249 ensureKeyframeGroups();
250 for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_ keyframeGroups->end(); ++iter) {
251 const PropertySpecificKeyframeVector& keyframeVector = iter->value->keyf rames();
252 for (size_t i = 0; i < keyframeVector.size(); ++i) {
253 if (keyframeVector[i]->composite() != AnimationEffect::CompositeRepl ace)
254 return false;
255 }
256 }
257 return true;
258 }
259
247 KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o ffset, PassRefPtr<TimingFunction> easing, const AnimatableValue* value, Composit eOperation composite) 260 KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o ffset, PassRefPtr<TimingFunction> easing, const AnimatableValue* value, Composit eOperation composite)
248 : m_offset(offset) 261 : m_offset(offset)
249 , m_easing(easing) 262 , m_easing(easing)
263 , m_composite(composite)
250 { 264 {
251 m_value = AnimatableValue::takeConstRef(value); 265 m_value = AnimatableValue::takeConstRef(value);
252 } 266 }
253 267
254 KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o ffset, PassRefPtr<TimingFunction> easing, PassRefPtr<AnimatableValue> value) 268 KeyframeEffectModel::PropertySpecificKeyframe::PropertySpecificKeyframe(double o ffset, PassRefPtr<TimingFunction> easing, PassRefPtr<AnimatableValue> value, Com positeOperation composite)
255 : m_offset(offset) 269 : m_offset(offset)
256 , m_easing(easing) 270 , m_easing(easing)
257 , m_value(value) 271 , m_value(value)
272 , m_composite(composite)
258 { 273 {
259 ASSERT(!isNull(m_offset)); 274 ASSERT(!isNull(m_offset));
260 } 275 }
261 276
262 PassOwnPtr<KeyframeEffectModel::PropertySpecificKeyframe> KeyframeEffectModel::P ropertySpecificKeyframe::cloneWithOffset(double offset) const 277 PassOwnPtr<KeyframeEffectModel::PropertySpecificKeyframe> KeyframeEffectModel::P ropertySpecificKeyframe::cloneWithOffset(double offset) const
263 { 278 {
264 return adoptPtr(new PropertySpecificKeyframe(offset, m_easing, m_value)); 279 return adoptPtr(new PropertySpecificKeyframe(offset, m_easing, m_value, m_co mposite));
265 } 280 }
266 281
267 282
268 void KeyframeEffectModel::PropertySpecificKeyframeGroup::appendKeyframe(PassOwnP tr<PropertySpecificKeyframe> keyframe) 283 void KeyframeEffectModel::PropertySpecificKeyframeGroup::appendKeyframe(PassOwnP tr<PropertySpecificKeyframe> keyframe)
269 { 284 {
270 ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->of fset()); 285 ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->of fset());
271 m_keyframes.append(keyframe); 286 m_keyframes.append(keyframe);
272 } 287 }
273 288
274 void KeyframeEffectModel::PropertySpecificKeyframeGroup::removeRedundantKeyframe s() 289 void KeyframeEffectModel::PropertySpecificKeyframeGroup::removeRedundantKeyframe s()
(...skipping 23 matching lines...) Expand all
298 if (m_keyframes.last()->offset() != 1.0) 313 if (m_keyframes.last()->offset() != 1.0)
299 appendKeyframe(adoptPtr(new PropertySpecificKeyframe(1, nullptr, Animata bleValue::neutralValue(), CompositeAdd))); 314 appendKeyframe(adoptPtr(new PropertySpecificKeyframe(1, nullptr, Animata bleValue::neutralValue(), CompositeAdd)));
300 } 315 }
301 316
302 void KeyframeEffectModel::trace(Visitor* visitor) 317 void KeyframeEffectModel::trace(Visitor* visitor)
303 { 318 {
304 visitor->trace(m_keyframes); 319 visitor->trace(m_keyframes);
305 } 320 }
306 321
307 } // namespace 322 } // namespace
OLDNEW
« no previous file with comments | « Source/core/animation/KeyframeEffectModel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698