| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const Range& range = other->m_ranges[index]; | 98 const Range& range = other->m_ranges[index]; |
| 99 unioned->add(range.m_start, range.m_end); | 99 unioned->add(range.m_start, range.m_end); |
| 100 } | 100 } |
| 101 | 101 |
| 102 m_ranges.swap(unioned->m_ranges); | 102 m_ranges.swap(unioned->m_ranges); |
| 103 } | 103 } |
| 104 | 104 |
| 105 double TimeRanges::start(unsigned index, ExceptionState& es) const | 105 double TimeRanges::start(unsigned index, ExceptionState& es) const |
| 106 { | 106 { |
| 107 if (index >= length()) { | 107 if (index >= length()) { |
| 108 es.throwDOMException(IndexSizeError); | 108 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 109 return 0; | 109 return 0; |
| 110 } | 110 } |
| 111 return m_ranges[index].m_start; | 111 return m_ranges[index].m_start; |
| 112 } | 112 } |
| 113 | 113 |
| 114 double TimeRanges::end(unsigned index, ExceptionState& es) const | 114 double TimeRanges::end(unsigned index, ExceptionState& es) const |
| 115 { | 115 { |
| 116 if (index >= length()) { | 116 if (index >= length()) { |
| 117 es.throwDOMException(IndexSizeError); | 117 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 118 return 0; | 118 return 0; |
| 119 } | 119 } |
| 120 return m_ranges[index].m_end; | 120 return m_ranges[index].m_end; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void TimeRanges::add(double start, double end) | 123 void TimeRanges::add(double start, double end) |
| 124 { | 124 { |
| 125 ASSERT(start <= end); | 125 ASSERT(start <= end); |
| 126 unsigned int overlappingArcIndex; | 126 unsigned int overlappingArcIndex; |
| 127 Range addedRange(start, end); | 127 Range addedRange(start, end); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 double endTime = end(ndx, IGNORE_EXCEPTION); | 181 double endTime = end(ndx, IGNORE_EXCEPTION); |
| 182 if (time >= startTime && time <= endTime) | 182 if (time >= startTime && time <= endTime) |
| 183 return time; | 183 return time; |
| 184 if (fabs(startTime - time) < closest) | 184 if (fabs(startTime - time) < closest) |
| 185 closest = fabsf(startTime - time); | 185 closest = fabsf(startTime - time); |
| 186 else if (fabs(endTime - time) < closest) | 186 else if (fabs(endTime - time) < closest) |
| 187 closest = fabsf(endTime - time); | 187 closest = fabsf(endTime - time); |
| 188 } | 188 } |
| 189 return closest; | 189 return closest; |
| 190 } | 190 } |
| OLD | NEW |