Skip to content
Permalink
Browse files
Add support for specced event handlers to HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=128292

Reviewed by Andreas Kling.

Source/WebCore:

Test: media/media-event-listeners.html

Add explicit event listener IDL attributes to HTMLMediaElement.

* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:

LayoutTests:

* media/media-event-listeners-expected.txt: Added.
* media/media-event-listeners.html: Added.

Canonical link: https://commits.webkit.org/146874@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Feb 15, 2014
1 parent f4ac7e1 commit 7c83f100517379a3b0064a835f8aefe41fe08e60
@@ -1,3 +1,13 @@
2014-02-14 Jer Noble <jer.noble@apple.com>

Add support for specced event handlers to HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=128292

Reviewed by Andreas Kling.

* media/media-event-listeners-expected.txt: Added.
* media/media-event-listeners.html: Added.

2014-02-14 Ryosuke Niwa <rniwa@webkit.org>

Mac rebaseline after r164127.
@@ -0,0 +1,15 @@

LISTENER(durationchange)
LISTENER(loadedmetadata)
LISTENER(loadeddata)
LISTENER(canplay)
LISTENER(canplaythrough)
LISTENER(play)
LISTENER(playing)
LISTENER(ratechange)
LISTENER(timeupdate)
LISTENER(pause)
LISTENER(ended)
LISTENER(volumechange)
END OF TEST

@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>

<script>
function start() {
findMediaElement();

video.onloadedmetadata = eventListenerFired;
video.onloadeddata = eventListenerFired;
video.oncanplay = eventListenerFired;
video.oncanplaythrough = eventListenerFired;
video.onplaying = eventListenerFired;
video.onended = eventListenerFired;
video.ondurationchange = eventListenerFired;
video.ontimeupdate = eventListenerFired;
video.onplay = eventListenerFired;
video.onpause = eventListenerFired;
video.onratechange = eventListenerFired;
video.onvolumechange = eventListenerFired;

video.addEventListener('playing', playing);
video.src = findMediaFile('video', 'content/test');
}

function eventListenerFired(event) {
consoleWrite('LISTENER(' + event.type + ')');
event.target['on' + event.type] = null;
}

function playing() {
video.addEventListener('ratechange', rateChange)
video.playbackRate = 2;
}

function rateChange() {
video.addEventListener('ended', ended);
video.currentTime = video.duration - .1;
}

function ended() {
video.addEventListener('volumechange', volumeChange);
video.volume = 0;
}

function volumeChange() {
endTest();
}

</script>
</head>
<body onload="start()">
<video controls autoplay></video>
</body>
</html>
@@ -1,3 +1,17 @@
2014-02-14 Jer Noble <jer.noble@apple.com>

Add support for specced event handlers to HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=128292

Reviewed by Andreas Kling.

Test: media/media-event-listeners.html

Add explicit event listener IDL attributes to HTMLMediaElement.

* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:

2014-02-14 Oliver Hunt <oliver@apple.com>

Implement a few more Array prototype functions in JS
@@ -252,6 +252,21 @@ class HTMLMediaElement

double percentLoaded() const;

DEFINE_ATTRIBUTE_EVENT_LISTENER(emptied);
DEFINE_ATTRIBUTE_EVENT_LISTENER(loadedmetadata);
DEFINE_ATTRIBUTE_EVENT_LISTENER(loadeddata);
DEFINE_ATTRIBUTE_EVENT_LISTENER(canplay);
DEFINE_ATTRIBUTE_EVENT_LISTENER(canplaythrough);
DEFINE_ATTRIBUTE_EVENT_LISTENER(playing);
DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
DEFINE_ATTRIBUTE_EVENT_LISTENER(waiting);
DEFINE_ATTRIBUTE_EVENT_LISTENER(durationchange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(timeupdate);
DEFINE_ATTRIBUTE_EVENT_LISTENER(play);
DEFINE_ATTRIBUTE_EVENT_LISTENER(pause);
DEFINE_ATTRIBUTE_EVENT_LISTENER(ratechange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(volumechange);

#if ENABLE(VIDEO_TRACK)
PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, const String& language, ExceptionCode&);
PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, ExceptionCode& ec) { return addTextTrack(kind, label, emptyString(), ec); }
@@ -83,6 +83,21 @@
attribute boolean muted;
[Reflect=muted] attribute boolean defaultMuted;

attribute EventListener onemptied;
attribute EventListener onloadedmetadata;
attribute EventListener onloadeddata;
attribute EventListener oncanplay;
attribute EventListener oncanplaythrough;
attribute EventListener onplaying;
attribute EventListener onended;
attribute EventListener onwaiting;
attribute EventListener ondurationchange;
attribute EventListener ontimeupdate;
attribute EventListener onplay;
attribute EventListener onpause;
attribute EventListener onratechange;
attribute EventListener onvolumechange;

// WebKit extensions
attribute boolean webkitPreservesPitch;

0 comments on commit 7c83f10

Please sign in to comment.