| 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 if (!std::isfinite(time)) { |
| 1874 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(time))
; |
| 1875 return; |
| 1876 } |
| 1873 if (m_mediaController) { | 1877 if (m_mediaController) { |
| 1874 exceptionState.throwDOMException(InvalidStateError, "The element is slav
ed to a MediaController."); | 1878 exceptionState.throwDOMException(InvalidStateError, "The element is slav
ed to a MediaController."); |
| 1875 return; | 1879 return; |
| 1876 } | 1880 } |
| 1877 seek(time, exceptionState); | 1881 seek(time, exceptionState); |
| 1878 } | 1882 } |
| 1879 | 1883 |
| 1880 double HTMLMediaElement::duration() const | 1884 double HTMLMediaElement::duration() const |
| 1881 { | 1885 { |
| 1882 if (!m_player || m_readyState < HAVE_METADATA) | 1886 if (!m_player || m_readyState < HAVE_METADATA) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1901 bool HTMLMediaElement::paused() const | 1905 bool HTMLMediaElement::paused() const |
| 1902 { | 1906 { |
| 1903 return m_paused; | 1907 return m_paused; |
| 1904 } | 1908 } |
| 1905 | 1909 |
| 1906 double HTMLMediaElement::defaultPlaybackRate() const | 1910 double HTMLMediaElement::defaultPlaybackRate() const |
| 1907 { | 1911 { |
| 1908 return m_defaultPlaybackRate; | 1912 return m_defaultPlaybackRate; |
| 1909 } | 1913 } |
| 1910 | 1914 |
| 1911 void HTMLMediaElement::setDefaultPlaybackRate(double rate) | 1915 void HTMLMediaElement::setDefaultPlaybackRate(double rate, ExceptionState& excep
tionState) |
| 1912 { | 1916 { |
| 1917 if (!std::isfinite(rate)) { |
| 1918 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate))
; |
| 1919 return; |
| 1920 } |
| 1913 if (m_defaultPlaybackRate != rate) { | 1921 if (m_defaultPlaybackRate != rate) { |
| 1914 m_defaultPlaybackRate = rate; | 1922 m_defaultPlaybackRate = rate; |
| 1915 scheduleEvent(EventTypeNames::ratechange); | 1923 scheduleEvent(EventTypeNames::ratechange); |
| 1916 } | 1924 } |
| 1917 } | 1925 } |
| 1918 | 1926 |
| 1919 double HTMLMediaElement::playbackRate() const | 1927 double HTMLMediaElement::playbackRate() const |
| 1920 { | 1928 { |
| 1921 return m_playbackRate; | 1929 return m_playbackRate; |
| 1922 } | 1930 } |
| 1923 | 1931 |
| 1924 void HTMLMediaElement::setPlaybackRate(double rate) | 1932 void HTMLMediaElement::setPlaybackRate(double rate, ExceptionState& exceptionSta
te) |
| 1925 { | 1933 { |
| 1926 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); | 1934 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); |
| 1927 | 1935 |
| 1936 if (!std::isfinite(rate)) { |
| 1937 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate))
; |
| 1938 return; |
| 1939 } |
| 1940 |
| 1928 if (m_playbackRate != rate) { | 1941 if (m_playbackRate != rate) { |
| 1929 m_playbackRate = rate; | 1942 m_playbackRate = rate; |
| 1930 invalidateCachedTime(); | 1943 invalidateCachedTime(); |
| 1931 scheduleEvent(EventTypeNames::ratechange); | 1944 scheduleEvent(EventTypeNames::ratechange); |
| 1932 } | 1945 } |
| 1933 | 1946 |
| 1934 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media
Controller) | 1947 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media
Controller) |
| 1935 m_player->setRate(rate); | 1948 m_player->setRate(rate); |
| 1936 } | 1949 } |
| 1937 | 1950 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 | 2095 |
| 2083 double HTMLMediaElement::volume() const | 2096 double HTMLMediaElement::volume() const |
| 2084 { | 2097 { |
| 2085 return m_volume; | 2098 return m_volume; |
| 2086 } | 2099 } |
| 2087 | 2100 |
| 2088 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) | 2101 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) |
| 2089 { | 2102 { |
| 2090 WTF_LOG(Media, "HTMLMediaElement::setVolume(%f)", vol); | 2103 WTF_LOG(Media, "HTMLMediaElement::setVolume(%f)", vol); |
| 2091 | 2104 |
| 2105 if (!std::isfinite(vol)) { |
| 2106 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(vol)); |
| 2107 return; |
| 2108 } |
| 2109 |
| 2092 if (vol < 0.0f || vol > 1.0f) { | 2110 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)); | 2111 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xOutsideRange("volume", vol, 0.0, ExceptionMessages::InclusiveBound, 1.0, Except
ionMessages::InclusiveBound)); |
| 2094 return; | 2112 return; |
| 2095 } | 2113 } |
| 2096 | 2114 |
| 2097 if (m_volume != vol) { | 2115 if (m_volume != vol) { |
| 2098 m_volume = vol; | 2116 m_volume = vol; |
| 2099 updateVolume(); | 2117 updateVolume(); |
| 2100 scheduleEvent(EventTypeNames::volumechange); | 2118 scheduleEvent(EventTypeNames::volumechange); |
| 2101 } | 2119 } |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3649 { | 3667 { |
| 3650 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3668 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
| 3651 } | 3669 } |
| 3652 | 3670 |
| 3653 bool HTMLMediaElement::isInteractiveContent() const | 3671 bool HTMLMediaElement::isInteractiveContent() const |
| 3654 { | 3672 { |
| 3655 return fastHasAttribute(controlsAttr); | 3673 return fastHasAttribute(controlsAttr); |
| 3656 } | 3674 } |
| 3657 | 3675 |
| 3658 } | 3676 } |
| OLD | NEW |