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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 { | 137 { |
138 m_timer.stop(); | 138 m_timer.stop(); |
139 } | 139 } |
140 | 140 |
141 void DocumentTimeline::DocumentTimelineTiming::serviceOnNextFrame() | 141 void DocumentTimeline::DocumentTimelineTiming::serviceOnNextFrame() |
142 { | 142 { |
143 if (m_timeline->m_document && m_timeline->m_document->view()) | 143 if (m_timeline->m_document && m_timeline->m_document->view()) |
144 m_timeline->m_document->view()->scheduleAnimation(); | 144 m_timeline->m_document->view()->scheduleAnimation(); |
145 } | 145 } |
146 | 146 |
| 147 double DocumentTimeline::currentTime(bool& isNull) |
| 148 { |
| 149 if (!m_document) { |
| 150 isNull = true; |
| 151 return std::numeric_limits<double>::quiet_NaN(); |
| 152 } |
| 153 double result = m_document->animationClock().currentTime() - m_zeroTime; |
| 154 isNull = std::isnan(result); |
| 155 return result; |
| 156 } |
| 157 |
147 double DocumentTimeline::currentTime() | 158 double DocumentTimeline::currentTime() |
148 { | 159 { |
149 if (!m_document) | 160 bool isNull; |
150 return std::numeric_limits<double>::quiet_NaN(); | 161 return currentTime(isNull); |
151 return m_document->animationClock().currentTime() - m_zeroTime; | |
152 } | 162 } |
153 | 163 |
154 double DocumentTimeline::effectiveTime() | 164 double DocumentTimeline::effectiveTime() |
155 { | 165 { |
156 double time = currentTime(); | 166 double time = currentTime(); |
157 return std::isnan(time) ? 0 : time; | 167 return std::isnan(time) ? 0 : time; |
158 } | 168 } |
159 | 169 |
160 void DocumentTimeline::pauseAnimationsForTesting(double pauseTime) | 170 void DocumentTimeline::pauseAnimationsForTesting(double pauseTime) |
161 { | 171 { |
(...skipping 25 matching lines...) Expand all Loading... |
187 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); | 197 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); |
188 } | 198 } |
189 return count; | 199 return count; |
190 } | 200 } |
191 | 201 |
192 void DocumentTimeline::detachFromDocument() { | 202 void DocumentTimeline::detachFromDocument() { |
193 m_document = 0; | 203 m_document = 0; |
194 } | 204 } |
195 | 205 |
196 } // namespace | 206 } // namespace |
OLD | NEW |