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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 // 4.9 - Set the timeline offset to Not-a-Number (NaN). | 661 // 4.9 - Set the timeline offset to Not-a-Number (NaN). |
662 // 4.10 - Update the duration attribute to Not-a-Number (NaN). | 662 // 4.10 - Update the duration attribute to Not-a-Number (NaN). |
663 | 663 |
664 | 664 |
665 updateMediaController(); | 665 updateMediaController(); |
666 if (RuntimeEnabledFeatures::videoTrackEnabled()) | 666 if (RuntimeEnabledFeatures::videoTrackEnabled()) |
667 updateActiveTextTrackCues(0); | 667 updateActiveTextTrackCues(0); |
668 } | 668 } |
669 | 669 |
670 // 5 - Set the playbackRate attribute to the value of the defaultPlaybackRat
e attribute. | 670 // 5 - Set the playbackRate attribute to the value of the defaultPlaybackRat
e attribute. |
671 setPlaybackRate(defaultPlaybackRate()); | 671 setPlaybackRate(defaultPlaybackRate(), IGNORE_EXCEPTION); |
672 | 672 |
673 // 6 - Set the error attribute to null and the autoplaying flag to true. | 673 // 6 - Set the error attribute to null and the autoplaying flag to true. |
674 m_error = nullptr; | 674 m_error = nullptr; |
675 m_autoplaying = true; | 675 m_autoplaying = true; |
676 | 676 |
677 // 7 - Invoke the media element's resource selection algorithm. | 677 // 7 - Invoke the media element's resource selection algorithm. |
678 | 678 |
679 // 8 - Note: Playback of any previously playing media resource for this elem
ent stops. | 679 // 8 - Note: Playback of any previously playing media resource for this elem
ent stops. |
680 | 680 |
681 // The resource selection algorithm | 681 // The resource selection algorithm |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 return m_cachedTime; | 1863 return m_cachedTime; |
1864 } | 1864 } |
1865 | 1865 |
1866 refreshCachedTime(); | 1866 refreshCachedTime(); |
1867 | 1867 |
1868 return m_cachedTime; | 1868 return m_cachedTime; |
1869 } | 1869 } |
1870 | 1870 |
1871 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat
e) | 1871 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat
e) |
1872 { | 1872 { |
| 1873 // FIXME: generated bindings should check isfinite: http://crbug.com/354298 |
| 1874 if (!std::isfinite(time)) { |
| 1875 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(time))
; |
| 1876 return; |
| 1877 } |
1873 if (m_mediaController) { | 1878 if (m_mediaController) { |
1874 exceptionState.throwDOMException(InvalidStateError, "The element is slav
ed to a MediaController."); | 1879 exceptionState.throwDOMException(InvalidStateError, "The element is slav
ed to a MediaController."); |
1875 return; | 1880 return; |
1876 } | 1881 } |
1877 seek(time, exceptionState); | 1882 seek(time, exceptionState); |
1878 } | 1883 } |
1879 | 1884 |
1880 double HTMLMediaElement::duration() const | 1885 double HTMLMediaElement::duration() const |
1881 { | 1886 { |
1882 if (!m_player || m_readyState < HAVE_METADATA) | 1887 if (!m_player || m_readyState < HAVE_METADATA) |
(...skipping 18 matching lines...) Expand all Loading... |
1901 bool HTMLMediaElement::paused() const | 1906 bool HTMLMediaElement::paused() const |
1902 { | 1907 { |
1903 return m_paused; | 1908 return m_paused; |
1904 } | 1909 } |
1905 | 1910 |
1906 double HTMLMediaElement::defaultPlaybackRate() const | 1911 double HTMLMediaElement::defaultPlaybackRate() const |
1907 { | 1912 { |
1908 return m_defaultPlaybackRate; | 1913 return m_defaultPlaybackRate; |
1909 } | 1914 } |
1910 | 1915 |
1911 void HTMLMediaElement::setDefaultPlaybackRate(double rate) | 1916 void HTMLMediaElement::setDefaultPlaybackRate(double rate, ExceptionState& excep
tionState) |
1912 { | 1917 { |
| 1918 // FIXME: generated bindings should check isfinite: http://crbug.com/354298 |
| 1919 if (!std::isfinite(rate)) { |
| 1920 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate))
; |
| 1921 return; |
| 1922 } |
1913 if (m_defaultPlaybackRate != rate) { | 1923 if (m_defaultPlaybackRate != rate) { |
1914 m_defaultPlaybackRate = rate; | 1924 m_defaultPlaybackRate = rate; |
1915 scheduleEvent(EventTypeNames::ratechange); | 1925 scheduleEvent(EventTypeNames::ratechange); |
1916 } | 1926 } |
1917 } | 1927 } |
1918 | 1928 |
1919 double HTMLMediaElement::playbackRate() const | 1929 double HTMLMediaElement::playbackRate() const |
1920 { | 1930 { |
1921 return m_playbackRate; | 1931 return m_playbackRate; |
1922 } | 1932 } |
1923 | 1933 |
1924 void HTMLMediaElement::setPlaybackRate(double rate) | 1934 void HTMLMediaElement::setPlaybackRate(double rate, ExceptionState& exceptionSta
te) |
1925 { | 1935 { |
1926 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); | 1936 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); |
1927 | 1937 |
| 1938 // FIXME: generated bindings should check isfinite: http://crbug.com/354298 |
| 1939 if (!std::isfinite(rate)) { |
| 1940 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate))
; |
| 1941 return; |
| 1942 } |
| 1943 |
1928 if (m_playbackRate != rate) { | 1944 if (m_playbackRate != rate) { |
1929 m_playbackRate = rate; | 1945 m_playbackRate = rate; |
1930 invalidateCachedTime(); | 1946 invalidateCachedTime(); |
1931 scheduleEvent(EventTypeNames::ratechange); | 1947 scheduleEvent(EventTypeNames::ratechange); |
1932 } | 1948 } |
1933 | 1949 |
1934 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media
Controller) | 1950 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media
Controller) |
1935 m_player->setRate(rate); | 1951 m_player->setRate(rate); |
1936 } | 1952 } |
1937 | 1953 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2082 | 2098 |
2083 double HTMLMediaElement::volume() const | 2099 double HTMLMediaElement::volume() const |
2084 { | 2100 { |
2085 return m_volume; | 2101 return m_volume; |
2086 } | 2102 } |
2087 | 2103 |
2088 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) | 2104 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) |
2089 { | 2105 { |
2090 WTF_LOG(Media, "HTMLMediaElement::setVolume(%f)", vol); | 2106 WTF_LOG(Media, "HTMLMediaElement::setVolume(%f)", vol); |
2091 | 2107 |
| 2108 // FIXME: generated bindings should check isfinite: http://crbug.com/354298 |
| 2109 if (!std::isfinite(vol)) { |
| 2110 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(vol)); |
| 2111 return; |
| 2112 } |
| 2113 |
2092 if (vol < 0.0f || vol > 1.0f) { | 2114 if (vol < 0.0f || vol > 1.0f) { |
2093 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xOutsideRange("volume", vol, 0.0, ExceptionMessages::InclusiveBound, 1.0, Except
ionMessages::InclusiveBound)); | 2115 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xOutsideRange("volume", vol, 0.0, ExceptionMessages::InclusiveBound, 1.0, Except
ionMessages::InclusiveBound)); |
2094 return; | 2116 return; |
2095 } | 2117 } |
2096 | 2118 |
2097 if (m_volume != vol) { | 2119 if (m_volume != vol) { |
2098 m_volume = vol; | 2120 m_volume = vol; |
2099 updateVolume(); | 2121 updateVolume(); |
2100 scheduleEvent(EventTypeNames::volumechange); | 2122 scheduleEvent(EventTypeNames::volumechange); |
2101 } | 2123 } |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3649 { | 3671 { |
3650 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3672 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
3651 } | 3673 } |
3652 | 3674 |
3653 bool HTMLMediaElement::isInteractiveContent() const | 3675 bool HTMLMediaElement::isInteractiveContent() const |
3654 { | 3676 { |
3655 return fastHasAttribute(controlsAttr); | 3677 return fastHasAttribute(controlsAttr); |
3656 } | 3678 } |
3657 | 3679 |
3658 } | 3680 } |
OLD | NEW |