b=462953 Remove unimplemented media attributes/methods from media IDL r=doublec,sr=roc

This commit is contained in:
Chris Pearce 2008-11-06 11:53:29 +13:00
parent 58ea9f42df
commit cb992e4544
11 changed files with 7 additions and 273 deletions

View File

@ -210,18 +210,6 @@ protected:
// it changes. Defaults to a width and height of -1 if not set.
nsIntSize mMediaSize;
// The defaultPlaybackRate attribute gives the desired speed at
// which the media resource is to play, as a multiple of its
// intrinsic speed.
float mDefaultPlaybackRate;
// The playbackRate attribute gives the speed at which the media
// resource plays, as a multiple of its intrinsic speed. If it is
// not equal to the defaultPlaybackRate, then the implication is
// that the user is using a feature such as fast forward or slow
// motion playback.
float mPlaybackRate;
// If true then we have begun downloading the media content.
// Set to false when completed, or not yet started.
PRPackedBool mBegun;

View File

@ -100,10 +100,6 @@ public:
NS_IMPL_URI_ATTR(nsHTMLMediaElement, Src, src)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Controls, controls)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Autoplay, autoplay)
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, Start, start)
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, End, end)
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, LoopStart, loopstart)
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, LoopEnd, loopend)
/* readonly attribute nsIDOMHTMLMediaError error; */
NS_IMETHODIMP nsHTMLMediaElement::GetError(nsIDOMHTMLMediaError * *aError)
@ -121,7 +117,6 @@ NS_IMETHODIMP nsHTMLMediaElement::GetEnded(PRBool *aEnded)
return NS_OK;
}
/* readonly attribute DOMString currentSrc; */
NS_IMETHODIMP nsHTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc)
{
@ -140,48 +135,6 @@ NS_IMETHODIMP nsHTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc)
return NS_OK;
}
/* attribute float defaultPlaybackRate; */
NS_IMETHODIMP nsHTMLMediaElement::GetDefaultPlaybackRate(float *aDefaultPlaybackRate)
{
*aDefaultPlaybackRate = mDefaultPlaybackRate;
return NS_OK;
}
NS_IMETHODIMP nsHTMLMediaElement::SetDefaultPlaybackRate(float aDefaultPlaybackRate)
{
if (aDefaultPlaybackRate == 0.0) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
mDefaultPlaybackRate = aDefaultPlaybackRate;
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("ratechange"));
return NS_OK;
}
/* attribute float playbackRate; */
NS_IMETHODIMP nsHTMLMediaElement::GetPlaybackRate(float *aPlaybackRate)
{
*aPlaybackRate = mPlaybackRate;
return NS_OK;
}
NS_IMETHODIMP nsHTMLMediaElement::SetPlaybackRate(float aPlaybackRate)
{
if (aPlaybackRate == 0.0) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
mPlaybackRate = aPlaybackRate;
if (mDecoder) {
mDecoder->PlaybackRateChanged();
}
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("ratechange"));
return NS_OK;
}
/* readonly attribute unsigned short networkState; */
NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(PRUint16 *aNetworkState)
{
@ -190,30 +143,6 @@ NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(PRUint16 *aNetworkState)
return NS_OK;
}
/* readonly attribute float bufferingRate; */
NS_IMETHODIMP nsHTMLMediaElement::GetBufferingRate(float *aBufferingRate)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute boolean bufferingThrottled; */
NS_IMETHODIMP nsHTMLMediaElement::GetBufferingThrottled(PRBool *aBufferingRate)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMTimeRanges buffered; */
NS_IMETHODIMP nsHTMLMediaElement::GetBuffered(nsIDOMHTMLTimeRanges * *aBuffered)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMByteRanges bufferedBytes; */
NS_IMETHODIMP nsHTMLMediaElement::GetBufferedBytes(nsIDOMHTMLByteRanges * *aBufferedBytes)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long totalBytes; */
NS_IMETHODIMP nsHTMLMediaElement::GetTotalBytes(PRUint32 *aTotalBytes)
{
@ -249,9 +178,7 @@ nsresult nsHTMLMediaElement::LoadWithChannel(nsIChannel *aChannel,
mLoadedFirstFrame = PR_FALSE;
mAutoplaying = PR_TRUE;
float rate = 1.0;
GetDefaultPlaybackRate(&rate);
SetPlaybackRate(rate);
// TODO: The playback rate must be set to the default playback rate.
if (mNetworkState != nsIDOMHTMLMediaElement::EMPTY) {
mNetworkState = nsIDOMHTMLMediaElement::EMPTY;
@ -335,18 +262,6 @@ NS_IMETHODIMP nsHTMLMediaElement::GetPaused(PRBool *aPaused)
return NS_OK;
}
/* readonly attribute nsIDOMHTMLTimeRanges played; */
NS_IMETHODIMP nsHTMLMediaElement::GetPlayed(nsIDOMHTMLTimeRanges * *aPlayed)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMHTMLTimeRanges seekable; */
NS_IMETHODIMP nsHTMLMediaElement::GetSeekable(nsIDOMHTMLTimeRanges * *aSeekable)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void pause (); */
NS_IMETHODIMP nsHTMLMediaElement::Pause()
{
@ -373,40 +288,6 @@ NS_IMETHODIMP nsHTMLMediaElement::Pause()
return NS_OK;
}
/* attribute unsigned long playCount; */
NS_IMETHODIMP nsHTMLMediaElement::GetPlayCount(PRUint32 *aPlayCount)
{
return GetIntAttr(nsGkAtoms::playcount, 1, reinterpret_cast<PRInt32*>(aPlayCount));
}
NS_IMETHODIMP nsHTMLMediaElement::SetPlayCount(PRUint32 aPlayCount)
{
return SetIntAttr(nsGkAtoms::playcount, static_cast<PRInt32>(aPlayCount));
}
/* attribute unsigned long currentLoop; */
NS_IMETHODIMP nsHTMLMediaElement::GetCurrentLoop(PRUint32 *aCurrentLoop)
{
return GetIntAttr(nsGkAtoms::currentloop, 0, reinterpret_cast<PRInt32*>(aCurrentLoop));
}
NS_IMETHODIMP nsHTMLMediaElement::SetCurrentLoop(PRUint32 aCurrentLoop)
{
return SetIntAttr(nsGkAtoms::currentloop, static_cast<PRInt32>(aCurrentLoop));
}
/* void addCueRange (in DOMString className, in float start, in float end, in boolean pauseOnExit, in nsIDOMHTMLVoidCallback enterCallback, in nsIDOMHTMLVoidCallback exitCallback); */
NS_IMETHODIMP nsHTMLMediaElement::AddCueRange(const nsAString & className, float start, float end, PRBool pauseOnExit, nsIDOMHTMLVoidCallback *enterCallback, nsIDOMHTMLVoidCallback *exitCallback)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void removeCueRanges (in DOMString className); */
NS_IMETHODIMP nsHTMLMediaElement::RemoveCueRanges(const nsAString & className)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute float volume; */
NS_IMETHODIMP nsHTMLMediaElement::GetVolume(float *aVolume)
{
@ -468,8 +349,6 @@ nsHTMLMediaElement::nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParse
mReadyState(nsIDOMHTMLMediaElement::DATA_UNAVAILABLE),
mMutedVolume(0.0),
mMediaSize(-1,-1),
mDefaultPlaybackRate(1.0),
mPlaybackRate(1.0),
mBegun(PR_FALSE),
mEnded(PR_FALSE),
mLoadedFirstFrame(PR_FALSE),
@ -509,9 +388,7 @@ nsHTMLMediaElement::Play(void)
// TODO: If the playback has ended, then the user agent must set
// currentLoop to zero and seek to the effective start.
float rate = 1.0;
GetDefaultPlaybackRate(&rate);
SetPlaybackRate(rate);
// TODO: The playback rate must be set to the default playback rate.
rv = mDecoder->Play();
NS_ENSURE_SUCCESS(rv, rv);
@ -800,10 +677,8 @@ void nsHTMLMediaElement::MetadataLoaded()
mNetworkState = nsIDOMHTMLMediaElement::LOADED_METADATA;
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("durationchange"));
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("loadedmetadata"));
float start = 0.0;
nsresult rv = GetStart(&start);
if (NS_SUCCEEDED(rv) && start > 0.0 && mDecoder)
mDecoder->Seek(start);
// TODO: Seek to the start time, as set in the start attribute.
mDecoder->Seek(0.0);
}
void nsHTMLMediaElement::FirstFrameLoaded()

View File

@ -104,8 +104,6 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLSourceElement)
NS_IMPL_URI_ATTR(nsHTMLSourceElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLSourceElement, Type, type)
NS_IMPL_STRING_ATTR(nsHTMLSourceElement, Media, media)
NS_IMPL_FLOAT_ATTR(nsHTMLSourceElement, PixelRatio, pixelratio)
PRBool

View File

@ -84,7 +84,6 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLVideoElement)
// nsIDOMHTMLVideoElement
NS_IMPL_INT_ATTR(nsHTMLVideoElement, Width, width)
NS_IMPL_INT_ATTR(nsHTMLVideoElement, Height, height)
NS_IMPL_URI_ATTR(nsHTMLVideoElement, Poster, poster)
// nsIDOMHTMLVideoElement
/* readonly attribute unsigned long videoWidth; */

View File

@ -48,14 +48,11 @@ _TEST_FILES = test_autoplay.html \
test_constants.html \
test_controls.html \
test_currentTime.html \
test_defaultPlaybackRate.html \
test_ended1.html \
test_ended2.html \
test_networkState.html \
test_paused.html \
test_playbackRate.html \
test_readyState.html \
test_start.html \
test_seek1.html \
test_seek2.html \
test_seek3.html \

View File

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: defaultPlaybackRate</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<video id='v1'></video><audio id='a1'></audio>
<pre id="test">
<script class="testbody" type="text/javascript">
var v1 = document.getElementById('v1');
var a1 = document.getElementById('a1');
var passed = true;
is(v1.defaultPlaybackRate, 1);
is(a1.defaultPlaybackRate, 1);
v1.defaultPlaybackRate = 2.5;
a1.defaultPlaybackRate = 2.5;
is(v1.defaultPlaybackRate, 2.5);
is(a1.defaultPlaybackRate, 2.5);
try {
v1.defaultPlaybackRate = 0
a1.defaultPlaybackRate = 0
passed = false;
} catch(e) { }
ok(passed, "Should not be able to set defaultPlaybackRate to 0");
</script>
</pre>
</body>
</html>

View File

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: playbackRate</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<video id='v1'></video><audio id='a1'></audio>
<pre id="test">
<script class="testbody" type="text/javascript">
var v1 = document.getElementById('v1');
var a1 = document.getElementById('a1');
var passed = true;
is(v1.playbackRate, 1);
is(a1.playbackRate, 1);
v1.playbackRate = 2.5;
a1.playbackRate = 2.5;
is(v1.playbackRate, 2.5);
is(a1.playbackRate, 2.5);
try {
v1.playbackRate = 0
a1.playbackRate = 0
passed = false;
} catch(e) { }
ok(passed, "Should not be able to set playbackRate to 0");
</script>
</pre>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: start</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<video id='v1'></video><audio id='a1'></audio>
<pre id="test">
<script class="testbody" type="text/javascript">
var v1 = document.getElementById('v1');
var a1 = document.getElementById('a1');
is(v1.start, 0);
is(a1.start, 0);
v1.start = 2.5;
a1.start = 2.5;
is(v1.start, 2.5);
is(a1.start, 2.5);
</script>
</pre>
</body>
</html>

View File

@ -38,9 +38,6 @@
#include "nsIDOMHTMLElement.idl"
#include "nsIDOMHTMLMediaError.idl"
#include "nsIDOMHTMLTimeRanges.idl"
#include "nsIDOMHTMLByteRanges.idl"
#include "nsIDOMHTMLVoidCallback.idl"
/**
* The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML
@ -52,7 +49,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(c8ce31b9-d18b-48c4-8309-944f0ccb1435)]
[scriptable, uuid(d95c02ac-92dc-4fff-ad52-41e125340fab)]
interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
{
// error state
@ -67,10 +64,6 @@ interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
const unsigned short LOADED_FIRST_FRAME = 3;
const unsigned short LOADED = 4;
readonly attribute unsigned short networkState;
readonly attribute float bufferingRate;
readonly attribute boolean bufferingThrottled;
readonly attribute nsIDOMHTMLTimeRanges buffered;
readonly attribute nsIDOMHTMLByteRanges bufferedBytes;
readonly attribute unsigned long totalBytes;
void load();
@ -86,28 +79,11 @@ interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
attribute float currentTime;
readonly attribute float duration;
readonly attribute boolean paused;
attribute float defaultPlaybackRate;
attribute float playbackRate;
readonly attribute nsIDOMHTMLTimeRanges played;
readonly attribute nsIDOMHTMLTimeRanges seekable;
readonly attribute boolean ended;
attribute boolean autoplay;
void play();
void pause();
// looping
attribute float start;
attribute float end;
attribute float loopStart;
attribute float loopEnd;
attribute unsigned long playCount;
attribute unsigned long currentLoop;
// cue points
void addCueRange(in DOMString className, in float start, in float end, in boolean pauseOnExit, in nsIDOMHTMLVoidCallback enterCallback, in nsIDOMHTMLVoidCallback exitCallback);
void removeCueRanges(in DOMString className);
// controls
attribute boolean controls;
attribute float volume;

View File

@ -48,11 +48,9 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(BF80FED9-BDBA-4C5A-AD23-203FAA4C4892)]
[scriptable, uuid(be281029-7dd9-4268-963e-96f5196acc19)]
interface nsIDOMHTMLSourceElement : nsIDOMHTMLElement
{
attribute DOMString src;
attribute DOMString type;
attribute DOMString media;
attribute float pixelRatio;
};

View File

@ -48,13 +48,12 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(B08457F7-8709-4D70-AC19-90433C77CD1E)]
[scriptable, uuid(4e3f05a5-ca9b-4576-af7f-b1d4038e6eb3)]
interface nsIDOMHTMLVideoElement : nsIDOMHTMLMediaElement
{
attribute long width;
attribute long height;
readonly attribute unsigned long videoWidth;
readonly attribute unsigned long videoHeight;
attribute DOMString poster;
};