Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 261783009: Use [TypeChecking=Unrestricted] for HTMLMediaElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 677
678 // 4.9 - Set the timeline offset to Not-a-Number (NaN). 678 // 4.9 - Set the timeline offset to Not-a-Number (NaN).
679 // 4.10 - Update the duration attribute to Not-a-Number (NaN). 679 // 4.10 - Update the duration attribute to Not-a-Number (NaN).
680 680
681 681
682 updateMediaController(); 682 updateMediaController();
683 updateActiveTextTrackCues(0); 683 updateActiveTextTrackCues(0);
684 } 684 }
685 685
686 // 5 - Set the playbackRate attribute to the value of the defaultPlaybackRat e attribute. 686 // 5 - Set the playbackRate attribute to the value of the defaultPlaybackRat e attribute.
687 setPlaybackRate(defaultPlaybackRate(), IGNORE_EXCEPTION); 687 setPlaybackRate(defaultPlaybackRate());
688 688
689 // 6 - Set the error attribute to null and the autoplaying flag to true. 689 // 6 - Set the error attribute to null and the autoplaying flag to true.
690 m_error = nullptr; 690 m_error = nullptr;
691 m_autoplaying = true; 691 m_autoplaying = true;
692 692
693 // 7 - Invoke the media element's resource selection algorithm. 693 // 7 - Invoke the media element's resource selection algorithm.
694 694
695 // 8 - Note: Playback of any previously playing media resource for this elem ent stops. 695 // 8 - Note: Playback of any previously playing media resource for this elem ent stops.
696 696
697 // The resource selection algorithm 697 // The resource selection algorithm
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 return m_cachedTime; 1879 return m_cachedTime;
1880 } 1880 }
1881 1881
1882 refreshCachedTime(); 1882 refreshCachedTime();
1883 1883
1884 return m_cachedTime; 1884 return m_cachedTime;
1885 } 1885 }
1886 1886
1887 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat e) 1887 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat e)
1888 { 1888 {
1889 // FIXME: generated bindings should check isfinite: http://crbug.com/354298
1890 if (!std::isfinite(time)) {
1891 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(time)) ;
1892 return;
1893 }
1894 if (m_mediaController) { 1889 if (m_mediaController) {
1895 exceptionState.throwDOMException(InvalidStateError, "The element is slav ed to a MediaController."); 1890 exceptionState.throwDOMException(InvalidStateError, "The element is slav ed to a MediaController.");
1896 return; 1891 return;
1897 } 1892 }
1898 seek(time, exceptionState); 1893 seek(time, exceptionState);
1899 } 1894 }
1900 1895
1901 double HTMLMediaElement::duration() const 1896 double HTMLMediaElement::duration() const
1902 { 1897 {
1903 if (!m_player || m_readyState < HAVE_METADATA) 1898 if (!m_player || m_readyState < HAVE_METADATA)
(...skipping 18 matching lines...) Expand all
1922 bool HTMLMediaElement::paused() const 1917 bool HTMLMediaElement::paused() const
1923 { 1918 {
1924 return m_paused; 1919 return m_paused;
1925 } 1920 }
1926 1921
1927 double HTMLMediaElement::defaultPlaybackRate() const 1922 double HTMLMediaElement::defaultPlaybackRate() const
1928 { 1923 {
1929 return m_defaultPlaybackRate; 1924 return m_defaultPlaybackRate;
1930 } 1925 }
1931 1926
1932 void HTMLMediaElement::setDefaultPlaybackRate(double rate, ExceptionState& excep tionState) 1927 void HTMLMediaElement::setDefaultPlaybackRate(double rate)
1933 { 1928 {
1934 // FIXME: generated bindings should check isfinite: http://crbug.com/354298
1935 if (!std::isfinite(rate)) {
1936 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate)) ;
1937 return;
1938 }
1939 if (m_defaultPlaybackRate != rate) { 1929 if (m_defaultPlaybackRate != rate) {
1940 m_defaultPlaybackRate = rate; 1930 m_defaultPlaybackRate = rate;
1941 scheduleEvent(EventTypeNames::ratechange); 1931 scheduleEvent(EventTypeNames::ratechange);
1942 } 1932 }
1943 } 1933 }
1944 1934
1945 double HTMLMediaElement::playbackRate() const 1935 double HTMLMediaElement::playbackRate() const
1946 { 1936 {
1947 return m_playbackRate; 1937 return m_playbackRate;
1948 } 1938 }
1949 1939
1950 void HTMLMediaElement::setPlaybackRate(double rate, ExceptionState& exceptionSta te) 1940 void HTMLMediaElement::setPlaybackRate(double rate)
1951 { 1941 {
1952 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); 1942 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate);
1953 1943
1954 // FIXME: generated bindings should check isfinite: http://crbug.com/354298
1955 if (!std::isfinite(rate)) {
1956 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate)) ;
1957 return;
1958 }
1959
1960 if (m_playbackRate != rate) { 1944 if (m_playbackRate != rate) {
1961 m_playbackRate = rate; 1945 m_playbackRate = rate;
1962 invalidateCachedTime(); 1946 invalidateCachedTime();
1963 scheduleEvent(EventTypeNames::ratechange); 1947 scheduleEvent(EventTypeNames::ratechange);
1964 } 1948 }
1965 1949
1966 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media Controller) 1950 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media Controller)
1967 m_player->setRate(rate); 1951 m_player->setRate(rate);
1968 } 1952 }
1969 1953
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 2098
2115 double HTMLMediaElement::volume() const 2099 double HTMLMediaElement::volume() const
2116 { 2100 {
2117 return m_volume; 2101 return m_volume;
2118 } 2102 }
2119 2103
2120 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) 2104 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState)
2121 { 2105 {
2122 WTF_LOG(Media, "HTMLMediaElement::setVolume(%f)", vol); 2106 WTF_LOG(Media, "HTMLMediaElement::setVolume(%f)", vol);
2123 2107
2124 // FIXME: generated bindings should check isfinite: http://crbug.com/354298
2125 if (!std::isfinite(vol)) {
2126 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(vol));
2127 return;
2128 }
2129
2130 if (vol < 0.0f || vol > 1.0f) { 2108 if (vol < 0.0f || vol > 1.0f) {
2131 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xOutsideRange("volume", vol, 0.0, ExceptionMessages::InclusiveBound, 1.0, Except ionMessages::InclusiveBound)); 2109 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xOutsideRange("volume", vol, 0.0, ExceptionMessages::InclusiveBound, 1.0, Except ionMessages::InclusiveBound));
2132 return; 2110 return;
2133 } 2111 }
2134 2112
2135 if (m_volume != vol) { 2113 if (m_volume != vol) {
2136 m_volume = vol; 2114 m_volume = vol;
2137 updateVolume(); 2115 updateVolume();
2138 scheduleEvent(EventTypeNames::volumechange); 2116 scheduleEvent(EventTypeNames::volumechange);
2139 } 2117 }
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 3610
3633 void HTMLMediaElement::trace(Visitor* visitor) 3611 void HTMLMediaElement::trace(Visitor* visitor)
3634 { 3612 {
3635 visitor->trace(m_textTracks); 3613 visitor->trace(m_textTracks);
3636 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3614 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3637 Supplementable<HTMLMediaElement>::trace(visitor); 3615 Supplementable<HTMLMediaElement>::trace(visitor);
3638 HTMLElement::trace(visitor); 3616 HTMLElement::trace(visitor);
3639 } 3617 }
3640 3618
3641 } 3619 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698