| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // as both their neighbours, as they will never be used by sample(). | 291 // as both their neighbours, as they will never be used by sample(). |
| 292 // Note that synthetic keyframes must be added before this method is | 292 // Note that synthetic keyframes must be added before this method is |
| 293 // called. | 293 // called. |
| 294 DCHECK_GE(m_keyframes.size(), 2U); | 294 DCHECK_GE(m_keyframes.size(), 2U); |
| 295 for (int i = m_keyframes.size() - 2; i > 0; --i) { | 295 for (int i = m_keyframes.size() - 2; i > 0; --i) { |
| 296 double offset = m_keyframes[i]->offset(); | 296 double offset = m_keyframes[i]->offset(); |
| 297 bool hasSameOffsetAsPreviousNeighbor = | 297 bool hasSameOffsetAsPreviousNeighbor = |
| 298 m_keyframes[i - 1]->offset() == offset; | 298 m_keyframes[i - 1]->offset() == offset; |
| 299 bool hasSameOffsetAsNextNeighbor = m_keyframes[i + 1]->offset() == offset; | 299 bool hasSameOffsetAsNextNeighbor = m_keyframes[i + 1]->offset() == offset; |
| 300 if (hasSameOffsetAsPreviousNeighbor && hasSameOffsetAsNextNeighbor) | 300 if (hasSameOffsetAsPreviousNeighbor && hasSameOffsetAsNextNeighbor) |
| 301 m_keyframes.remove(i); | 301 m_keyframes.erase(i); |
| 302 } | 302 } |
| 303 DCHECK_GE(m_keyframes.size(), 2U); | 303 DCHECK_GE(m_keyframes.size(), 2U); |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool KeyframeEffectModelBase::PropertySpecificKeyframeGroup:: | 306 bool KeyframeEffectModelBase::PropertySpecificKeyframeGroup:: |
| 307 addSyntheticKeyframeIfRequired( | 307 addSyntheticKeyframeIfRequired( |
| 308 PassRefPtr<TimingFunction> zeroOffsetEasing) { | 308 PassRefPtr<TimingFunction> zeroOffsetEasing) { |
| 309 DCHECK(!m_keyframes.isEmpty()); | 309 DCHECK(!m_keyframes.isEmpty()); |
| 310 | 310 |
| 311 bool addedSyntheticKeyframe = false; | 311 bool addedSyntheticKeyframe = false; |
| 312 | 312 |
| 313 if (m_keyframes.front()->offset() != 0.0) { | 313 if (m_keyframes.front()->offset() != 0.0) { |
| 314 m_keyframes.insert(0, m_keyframes.front()->neutralKeyframe( | 314 m_keyframes.insert(0, m_keyframes.front()->neutralKeyframe( |
| 315 0, std::move(zeroOffsetEasing))); | 315 0, std::move(zeroOffsetEasing))); |
| 316 addedSyntheticKeyframe = true; | 316 addedSyntheticKeyframe = true; |
| 317 } | 317 } |
| 318 if (m_keyframes.back()->offset() != 1.0) { | 318 if (m_keyframes.back()->offset() != 1.0) { |
| 319 appendKeyframe(m_keyframes.back()->neutralKeyframe(1, nullptr)); | 319 appendKeyframe(m_keyframes.back()->neutralKeyframe(1, nullptr)); |
| 320 addedSyntheticKeyframe = true; | 320 addedSyntheticKeyframe = true; |
| 321 } | 321 } |
| 322 | 322 |
| 323 return addedSyntheticKeyframe; | 323 return addedSyntheticKeyframe; |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace blink | 326 } // namespace blink |
| OLD | NEW |