| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 | 1975 |
| 1976 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& es) | 1976 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& es) |
| 1977 { | 1977 { |
| 1978 if (m_mediaController) { | 1978 if (m_mediaController) { |
| 1979 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1979 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 1980 return; | 1980 return; |
| 1981 } | 1981 } |
| 1982 seek(time, es); | 1982 seek(time, es); |
| 1983 } | 1983 } |
| 1984 | 1984 |
| 1985 double HTMLMediaElement::startTime() const | |
| 1986 { | |
| 1987 return 0; | |
| 1988 } | |
| 1989 | |
| 1990 double HTMLMediaElement::initialTime() const | 1985 double HTMLMediaElement::initialTime() const |
| 1991 { | 1986 { |
| 1992 if (m_fragmentStartTime != MediaPlayer::invalidTime()) | 1987 if (m_fragmentStartTime != MediaPlayer::invalidTime()) |
| 1993 return m_fragmentStartTime; | 1988 return m_fragmentStartTime; |
| 1994 | 1989 |
| 1995 return 0; | 1990 return 0; |
| 1996 } | 1991 } |
| 1997 | 1992 |
| 1998 double HTMLMediaElement::duration() const | 1993 double HTMLMediaElement::duration() const |
| 1999 { | 1994 { |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 double now = currentTime(); | 3047 double now = currentTime(); |
| 3053 double dur = duration(); | 3048 double dur = duration(); |
| 3054 | 3049 |
| 3055 // When the current playback position reaches the end of the media resource
when the direction of | 3050 // When the current playback position reaches the end of the media resource
when the direction of |
| 3056 // playback is forwards, then the user agent must follow these steps: | 3051 // playback is forwards, then the user agent must follow these steps: |
| 3057 if (!std::isnan(dur) && dur && now >= dur && m_playbackRate > 0) { | 3052 if (!std::isnan(dur) && dur && now >= dur && m_playbackRate > 0) { |
| 3058 // If the media element has a loop attribute specified and does not have
a current media controller, | 3053 // If the media element has a loop attribute specified and does not have
a current media controller, |
| 3059 if (loop() && !m_mediaController) { | 3054 if (loop() && !m_mediaController) { |
| 3060 m_sentEndEvent = false; | 3055 m_sentEndEvent = false; |
| 3061 // then seek to the earliest possible position of the media resourc
e and abort these steps. | 3056 // then seek to the earliest possible position of the media resourc
e and abort these steps. |
| 3062 seek(startTime(), IGNORE_EXCEPTION); | 3057 seek(0, IGNORE_EXCEPTION); |
| 3063 } else { | 3058 } else { |
| 3064 // If the media element does not have a current media controller, an
d the media element | 3059 // If the media element does not have a current media controller, an
d the media element |
| 3065 // has still ended playback, and the direction of playback is still
forwards, and paused | 3060 // has still ended playback, and the direction of playback is still
forwards, and paused |
| 3066 // is false, | 3061 // is false, |
| 3067 if (!m_mediaController && !m_paused) { | 3062 if (!m_mediaController && !m_paused) { |
| 3068 // changes paused to true and fires a simple event named pause a
t the media element. | 3063 // changes paused to true and fires a simple event named pause a
t the media element. |
| 3069 m_paused = true; | 3064 m_paused = true; |
| 3070 scheduleEvent(EventTypeNames::pause); | 3065 scheduleEvent(EventTypeNames::pause); |
| 3071 } | 3066 } |
| 3072 // Queue a task to fire a simple event named ended at the media elem
ent. | 3067 // Queue a task to fire a simple event named ended at the media elem
ent. |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3822 | 3817 |
| 3823 // A media element is blocked on its media controller if the MediaController
is a blocked | 3818 // A media element is blocked on its media controller if the MediaController
is a blocked |
| 3824 // media controller, | 3819 // media controller, |
| 3825 if (m_mediaController->isBlocked()) | 3820 if (m_mediaController->isBlocked()) |
| 3826 return true; | 3821 return true; |
| 3827 | 3822 |
| 3828 // or if its media controller position is either before the media resource's
earliest possible | 3823 // or if its media controller position is either before the media resource's
earliest possible |
| 3829 // position relative to the MediaController's timeline or after the end of t
he media resource | 3824 // position relative to the MediaController's timeline or after the end of t
he media resource |
| 3830 // relative to the MediaController's timeline. | 3825 // relative to the MediaController's timeline. |
| 3831 double mediaControllerPosition = m_mediaController->currentTime(); | 3826 double mediaControllerPosition = m_mediaController->currentTime(); |
| 3832 if (mediaControllerPosition < startTime() || mediaControllerPosition > start
Time() + duration()) | 3827 if (mediaControllerPosition < 0 || mediaControllerPosition > duration()) |
| 3833 return true; | 3828 return true; |
| 3834 | 3829 |
| 3835 return false; | 3830 return false; |
| 3836 } | 3831 } |
| 3837 | 3832 |
| 3838 void HTMLMediaElement::prepareMediaFragmentURI() | 3833 void HTMLMediaElement::prepareMediaFragmentURI() |
| 3839 { | 3834 { |
| 3840 MediaFragmentURIParser fragmentParser(m_currentSrc); | 3835 MediaFragmentURIParser fragmentParser(m_currentSrc); |
| 3841 double dur = duration(); | 3836 double dur = duration(); |
| 3842 | 3837 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3886 { | 3881 { |
| 3887 scheduleLayerUpdate(); | 3882 scheduleLayerUpdate(); |
| 3888 } | 3883 } |
| 3889 | 3884 |
| 3890 bool HTMLMediaElement::isInteractiveContent() const | 3885 bool HTMLMediaElement::isInteractiveContent() const |
| 3891 { | 3886 { |
| 3892 return fastHasAttribute(controlsAttr); | 3887 return fastHasAttribute(controlsAttr); |
| 3893 } | 3888 } |
| 3894 | 3889 |
| 3895 } | 3890 } |
| OLD | NEW |