| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 { | 267 { |
| 268 double max = m_segments.isEmpty() ? 0 : m_segments.last().max(); | 268 double max = m_segments.isEmpty() ? 0 : m_segments.last().max(); |
| 269 ASSERT(upperBound > max); | 269 ASSERT(upperBound > max); |
| 270 m_segments.append(Segment(max, upperBound, timingFunction)); | 270 m_segments.append(Segment(max, upperBound, timingFunction)); |
| 271 } | 271 } |
| 272 virtual double evaluate(double fraction, double accuracy) const | 272 virtual double evaluate(double fraction, double accuracy) const |
| 273 { | 273 { |
| 274 RELEASE_ASSERT_WITH_MESSAGE(fraction >= 0 && fraction <= 1, "Web Animati
ons not yet implemented: Timing function behavior outside the range [0, 1] is no
t yet specified"); | 274 RELEASE_ASSERT_WITH_MESSAGE(fraction >= 0 && fraction <= 1, "Web Animati
ons not yet implemented: Timing function behavior outside the range [0, 1] is no
t yet specified"); |
| 275 ASSERT(!m_segments.isEmpty()); | 275 ASSERT(!m_segments.isEmpty()); |
| 276 ASSERT(m_segments.last().max() == 1); | 276 ASSERT(m_segments.last().max() == 1); |
| 277 const Segment* segment; | 277 size_t i = 0; |
| 278 for (size_t i = 0; i < m_segments.size(); ++i) { | 278 const Segment* segment = &m_segments[i++]; |
| 279 segment = &m_segments[i]; | 279 while (fraction >= segment->max() && i < m_segments.size()) { |
| 280 if (fraction < segment->max()) | 280 segment = &m_segments[i++]; |
| 281 break; | |
| 282 } | 281 } |
| 283 return segment->evaluate(fraction, accuracy); | 282 return segment->evaluate(fraction, accuracy); |
| 284 } | 283 } |
| 285 | 284 |
| 286 virtual bool operator==(const TimingFunction& other) const | 285 virtual bool operator==(const TimingFunction& other) const |
| 287 { | 286 { |
| 288 // This class is not exposed to CSS, so this method is not required. | 287 // This class is not exposed to CSS, so this method is not required. |
| 289 ASSERT_NOT_REACHED(); | 288 ASSERT_NOT_REACHED(); |
| 290 return false; | 289 return false; |
| 291 } | 290 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 319 { | 318 { |
| 320 ASSERT(RuntimeEnabledFeatures::webAnimationsEnabled()); | 319 ASSERT(RuntimeEnabledFeatures::webAnimationsEnabled()); |
| 321 } | 320 } |
| 322 | 321 |
| 323 Vector<Segment> m_segments; | 322 Vector<Segment> m_segments; |
| 324 }; | 323 }; |
| 325 | 324 |
| 326 } // namespace WebCore | 325 } // namespace WebCore |
| 327 | 326 |
| 328 #endif // TimingFunction_h | 327 #endif // TimingFunction_h |
| OLD | NEW |