Render text tracks
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Dec 2011 17:25:37 +0000 (17:25 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Dec 2011 17:25:37 +0000 (17:25 +0000)
commitd8d2440acc4235d78341c1f7abaf3c38bec7266e
tree571913d4eef50d918a746f8f2d04e51008e00423
parent10c7ccbb4c85301ffd0ac1321bce6355bc901640
Render text tracks
https://bugs.webkit.org/show_bug.cgi?id=62886

Reviewed by Sam Weinig.

Source/WebCore:

Test: media/track/track-cue-rendering.html

* css/mediaControls.css:
(video::-webkit-media-text-track-container):
(video::-webkit-media-text-track-display):

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_haveVisibleTextTrack.
(WebCore::HTMLMediaElement::updateActiveTextTrackCues): Trigger an update of the text
    track display.
(WebCore::HTMLMediaElement::textTrackModeChanged): call configureTextTrackDisplay() so
    the text track display is hidden or shown when necessary.
(WebCore::HTMLMediaElement::userIsInterestedInThisTrack): Minor cleanup.
(WebCore::HTMLMediaElement::createMediaControls): configureMediaControls() always called
    reset after creating the controls, do it here instead.
(WebCore::HTMLMediaElement::configureMediaControls): Simplify and cleanup.
(WebCore::HTMLMediaElement::configureTextTrackDisplay): Show and hide text track display.
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::currentlyVisibleCues):

* html/shadow/MediaControlElements.cpp:
(WebCore::RenderTextTrackContainerElement::RenderTextTrackContainerElement): New.
(WebCore::RenderTextTrackContainerElement::layout): New. Call the display element so it can
    update the position and font size.
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): New.
(WebCore::MediaControlTextTrackContainerElement::create): Ditto.
(WebCore::MediaControlTextTrackContainerElement::createRenderer): Ditto.
(WebCore::MediaControlTextTrackContainerElement::shadowPseudoId): Ditto.
(WebCore::MediaControlTextTrackContainerElement::updateSizes): Keep the cue display element
    positioned above the bottom of the video box, and size the font according to the video height.
(WebCore::MediaControlTextTrackDisplayElement::MediaControlTextTrackDisplayElement): New.
(WebCore::MediaControlTextTrackDisplayElement::create): Ditto.
(WebCore::MediaControlTextTrackDisplayElement::shadowPseudoId): Ditto.
* html/shadow/MediaControlElements.h:
(WebCore::MediaControlTextTrackContainerElement::displayType):
(WebCore::MediaControlTextTrackDisplayElement::displayType):

* html/shadow/MediaControlRootElement.cpp:
(WebCore::MediaControlRootElement::MediaControlRootElement): New.
(WebCore::MediaControlRootElement::setMediaController): Ditto.
(WebCore::MediaControlRootElement::createTextTrackDisplay): Ditto.
(WebCore::MediaControlRootElement::showTextTrackDisplay): Ditto.
(WebCore::MediaControlRootElement::hideTextTrackDisplay): Ditto.
(WebCore::MediaControlRootElement::updateTextTrackDisplay): Ditto.
* html/shadow/MediaControlRootElement.h:

* html/shadow/MediaControlRootElementChromium.cpp:
(WebCore::MediaControlRootElementChromium::MediaControlRootElementChromium): New.
(WebCore::MediaControlRootElement::createTextTrackDisplay): Ditto.
(WebCore::MediaControlRootElement::showTextTrackDisplay): Ditto.
(WebCore::MediaControlRootElement::hideTextTrackDisplay): Ditto.
(WebCore::MediaControlRootElement::updateTextTrackDisplay): Ditto.
* html/shadow/MediaControlRootElementChromium.h:
* html/shadow/MediaControls.h:

LayoutTests:

* media/media-controls.js:
(mediaControlsElement): Don't always look for a controller element.
(mediaControlsButtonCoordinates):
(textTrackDisplayElement): Find the cue display element.

* media/track/track-cue-rendering-expected.txt: Added.
* media/track/track-cue-rendering.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/media/media-controls.js
LayoutTests/media/track/captions-webvtt/captions.vtt [new file with mode: 0644]
LayoutTests/media/track/track-cue-rendering-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-cue-rendering.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/mediaControls.css
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControlElements.h
Source/WebCore/html/shadow/MediaControlRootElement.cpp
Source/WebCore/html/shadow/MediaControlRootElement.h
Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp
Source/WebCore/html/shadow/MediaControlRootElementChromium.h
Source/WebCore/html/shadow/MediaControls.h
Source/WebCore/rendering/RenderMediaControls.cpp
Source/WebCore/rendering/RenderMediaControlsChromium.cpp