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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 years, 10 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return; 243 return;
244 244
245 m_keyframeGroups = adoptPtr(new KeyframeGroupMap); 245 m_keyframeGroups = adoptPtr(new KeyframeGroupMap);
246 const KeyframeVector keyframes = normalizedKeyframes(getFrames()); 246 const KeyframeVector keyframes = normalizedKeyframes(getFrames());
247 for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyfra meIter != keyframes.end(); ++keyframeIter) { 247 for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyfra meIter != keyframes.end(); ++keyframeIter) {
248 const Keyframe* keyframe = keyframeIter->get(); 248 const Keyframe* keyframe = keyframeIter->get();
249 PropertySet keyframeProperties = keyframe->properties(); 249 PropertySet keyframeProperties = keyframe->properties();
250 for (PropertySet::const_iterator propertyIter = keyframeProperties.begin (); propertyIter != keyframeProperties.end(); ++propertyIter) { 250 for (PropertySet::const_iterator propertyIter = keyframeProperties.begin (); propertyIter != keyframeProperties.end(); ++propertyIter) {
251 CSSPropertyID property = *propertyIter; 251 CSSPropertyID property = *propertyIter;
252 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper ty); 252 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper ty);
253 if (groupIter == m_keyframeGroups->end()) { 253 PropertySpecificKeyframeGroup* group;
254 KeyframeGroupMap::AddResult result = m_keyframeGroups->add(prope rty, adoptPtr(new PropertySpecificKeyframeGroup)); 254 if (groupIter == m_keyframeGroups->end())
255 ASSERT(result.isNewEntry); 255 group = m_keyframeGroups->add(property, adoptPtr(new PropertySpe cificKeyframeGroup)).storedValue->value.get();
256 groupIter = result.iterator; 256 else
257 } 257 group = groupIter->value.get();
258 groupIter->value->appendKeyframe(adoptPtr( 258
259 group->appendKeyframe(adoptPtr(
259 new PropertySpecificKeyframe(keyframe->offset(), keyframe->easin g(), keyframe->propertyValue(property), keyframe->composite()))); 260 new PropertySpecificKeyframe(keyframe->offset(), keyframe->easin g(), keyframe->propertyValue(property), keyframe->composite())));
260 } 261 }
261 } 262 }
262 263
263 // Add synthetic keyframes. 264 // Add synthetic keyframes.
264 for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_ keyframeGroups->end(); ++iter) { 265 for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_ keyframeGroups->end(); ++iter) {
265 iter->value->addSyntheticKeyframeIfRequired(); 266 iter->value->addSyntheticKeyframeIfRequired();
266 iter->value->removeRedundantKeyframes(); 267 iter->value->removeRedundantKeyframes();
267 } 268 }
268 } 269 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 if ((*after)->offset() == offset) 383 if ((*after)->offset() == offset)
383 return const_cast<CompositableValue*>((*after)->value()); 384 return const_cast<CompositableValue*>((*after)->value());
384 385
385 double fraction = (offset - (*before)->offset()) / ((*after)->offset() - (*b efore)->offset()); 386 double fraction = (offset - (*before)->offset()) / ((*after)->offset() - (*b efore)->offset());
386 if (const TimingFunction* timingFunction = (*before)->easing()) 387 if (const TimingFunction* timingFunction = (*before)->easing())
387 fraction = timingFunction->evaluate(fraction, accuracyForKeyframeEasing) ; 388 fraction = timingFunction->evaluate(fraction, accuracyForKeyframeEasing) ;
388 return BlendedCompositableValue::create((*before)->value(), (*after)->value( ), fraction); 389 return BlendedCompositableValue::create((*before)->value(), (*after)->value( ), fraction);
389 } 390 }
390 391
391 } // namespace 392 } // namespace
OLDNEW
« no previous file with comments | « Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl ('k') | Source/core/css/CSSFontFaceSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698