| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // ---------------------------- | 45 // ---------------------------- |
| 46 | 46 |
| 47 TextTrackCueBox::TextTrackCueBox(Document& document) | 47 TextTrackCueBox::TextTrackCueBox(Document& document) |
| 48 : HTMLDivElement(document) | 48 : HTMLDivElement(document) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 // ---------------------------- | 52 // ---------------------------- |
| 53 | 53 |
| 54 bool TextTrackCue::isInfiniteOrNonNumber(double value, const char* method, Excep
tionState& exceptionState) | 54 bool TextTrackCue::isInfiniteOrNonNumber(double value, ExceptionState& exception
State) |
| 55 { | 55 { |
| 56 if (!std::isfinite(value)) { | 56 if (!std::isfinite(value)) { |
| 57 exceptionState.throwTypeError(ExceptionMessages::failedToSet(method, "Te
xtTrackCue", ExceptionMessages::notAFiniteNumber(value))); | 57 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(value)
); |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 TextTrackCue::TextTrackCue(double start, double end) | 63 TextTrackCue::TextTrackCue(double start, double end) |
| 64 : m_startTime(start) | 64 : m_startTime(start) |
| 65 , m_endTime(end) | 65 , m_endTime(end) |
| 66 , m_cueIndex(invalidCueIndex) | 66 , m_cueIndex(invalidCueIndex) |
| 67 , m_track(0) | 67 , m_track(0) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return; | 103 return; |
| 104 | 104 |
| 105 cueWillChange(); | 105 cueWillChange(); |
| 106 m_id = id; | 106 m_id = id; |
| 107 cueDidChange(); | 107 cueDidChange(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void TextTrackCue::setStartTime(double value, ExceptionState& exceptionState) | 110 void TextTrackCue::setStartTime(double value, ExceptionState& exceptionState) |
| 111 { | 111 { |
| 112 // NaN, Infinity and -Infinity values should trigger a TypeError. | 112 // NaN, Infinity and -Infinity values should trigger a TypeError. |
| 113 if (isInfiniteOrNonNumber(value, "startTime", exceptionState)) | 113 if (isInfiniteOrNonNumber(value, exceptionState)) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 // TODO(93143): Add spec-compliant behavior for negative time values. | 116 // TODO(93143): Add spec-compliant behavior for negative time values. |
| 117 if (m_startTime == value || value < 0) | 117 if (m_startTime == value || value < 0) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 cueWillChange(); | 120 cueWillChange(); |
| 121 m_startTime = value; | 121 m_startTime = value; |
| 122 cueDidChange(); | 122 cueDidChange(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void TextTrackCue::setEndTime(double value, ExceptionState& exceptionState) | 125 void TextTrackCue::setEndTime(double value, ExceptionState& exceptionState) |
| 126 { | 126 { |
| 127 // NaN, Infinity and -Infinity values should trigger a TypeError. | 127 // NaN, Infinity and -Infinity values should trigger a TypeError. |
| 128 if (isInfiniteOrNonNumber(value, "endTime", exceptionState)) | 128 if (isInfiniteOrNonNumber(value, exceptionState)) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 // TODO(93143): Add spec-compliant behavior for negative time values. | 131 // TODO(93143): Add spec-compliant behavior for negative time values. |
| 132 if (m_endTime == value || value < 0) | 132 if (m_endTime == value || value < 0) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 cueWillChange(); | 135 cueWillChange(); |
| 136 m_endTime = value; | 136 m_endTime = value; |
| 137 cueDidChange(); | 137 cueDidChange(); |
| 138 } | 138 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (!active) | 182 if (!active) |
| 183 removeDisplayTree(); | 183 removeDisplayTree(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 const AtomicString& TextTrackCue::interfaceName() const | 186 const AtomicString& TextTrackCue::interfaceName() const |
| 187 { | 187 { |
| 188 return EventTargetNames::TextTrackCue; | 188 return EventTargetNames::TextTrackCue; |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace WebCore | 191 } // namespace WebCore |
| OLD | NEW |