| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ASSERT(other); | 106 ASSERT(other); |
| 107 RefPtr<TimeRanges> unioned = copy(); | 107 RefPtr<TimeRanges> unioned = copy(); |
| 108 for (size_t index = 0; index < other->m_ranges.size(); ++index) { | 108 for (size_t index = 0; index < other->m_ranges.size(); ++index) { |
| 109 const Range& range = other->m_ranges[index]; | 109 const Range& range = other->m_ranges[index]; |
| 110 unioned->add(range.m_start, range.m_end); | 110 unioned->add(range.m_start, range.m_end); |
| 111 } | 111 } |
| 112 | 112 |
| 113 m_ranges.swap(unioned->m_ranges); | 113 m_ranges.swap(unioned->m_ranges); |
| 114 } | 114 } |
| 115 | 115 |
| 116 double TimeRanges::start(unsigned index, ExceptionState& es) const | 116 double TimeRanges::start(unsigned index, ExceptionState& exceptionState) const |
| 117 { | 117 { |
| 118 if (index >= length()) { | 118 if (index >= length()) { |
| 119 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 119 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 120 return 0; | 120 return 0; |
| 121 } | 121 } |
| 122 return m_ranges[index].m_start; | 122 return m_ranges[index].m_start; |
| 123 } | 123 } |
| 124 | 124 |
| 125 double TimeRanges::end(unsigned index, ExceptionState& es) const | 125 double TimeRanges::end(unsigned index, ExceptionState& exceptionState) const |
| 126 { | 126 { |
| 127 if (index >= length()) { | 127 if (index >= length()) { |
| 128 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 128 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 129 return 0; | 129 return 0; |
| 130 } | 130 } |
| 131 return m_ranges[index].m_end; | 131 return m_ranges[index].m_end; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void TimeRanges::add(double start, double end) | 134 void TimeRanges::add(double start, double end) |
| 135 { | 135 { |
| 136 ASSERT(start <= end); | 136 ASSERT(start <= end); |
| 137 unsigned int overlappingArcIndex; | 137 unsigned int overlappingArcIndex; |
| 138 Range addedRange(start, end); | 138 Range addedRange(start, end); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 double endTime = end(ndx, IGNORE_EXCEPTION); | 192 double endTime = end(ndx, IGNORE_EXCEPTION); |
| 193 if (time >= startTime && time <= endTime) | 193 if (time >= startTime && time <= endTime) |
| 194 return time; | 194 return time; |
| 195 if (fabs(startTime - time) < closest) | 195 if (fabs(startTime - time) < closest) |
| 196 closest = fabsf(startTime - time); | 196 closest = fabsf(startTime - time); |
| 197 else if (fabs(endTime - time) < closest) | 197 else if (fabs(endTime - time) < closest) |
| 198 closest = fabsf(endTime - time); | 198 closest = fabsf(endTime - time); |
| 199 } | 199 } |
| 200 return closest; | 200 return closest; |
| 201 } | 201 } |
| OLD | NEW |