Diff
Modified: trunk/LayoutTests/ChangeLog (139546 => 139547)
--- trunk/LayoutTests/ChangeLog 2013-01-12 09:33:01 UTC (rev 139546)
+++ trunk/LayoutTests/ChangeLog 2013-01-12 12:04:56 UTC (rev 139547)
@@ -1,3 +1,14 @@
+2013-01-12 Victor Carbune <[email protected]>
+
+ CC Button doesn't always show up
+ https://bugs.webkit.org/show_bug.cgi?id=106653
+
+ Reviewed by Eric Carlson.
+
+ * media/video-controls-captions-expected.txt: Updated.
+ * media/video-controls-captions.html: Added extra checks that fail
+ without the code changes.
+
2013-01-11 Noel Gordon <[email protected]>
[chromium] Update platform/chromium/virtual/softwarecompositing/geometry/video-fixed-scrolling.html on win
Modified: trunk/LayoutTests/media/video-controls-captions-expected.txt (139546 => 139547)
--- trunk/LayoutTests/media/video-controls-captions-expected.txt 2013-01-12 09:33:01 UTC (rev 139546)
+++ trunk/LayoutTests/media/video-controls-captions-expected.txt 2013-01-12 12:04:56 UTC (rev 139547)
@@ -21,5 +21,18 @@
** Captions should not be visible after button is clicked again **
*** Click the CC button.
No text track cue with display id '-webkit-media-text-track-display' is currently visible
+
+** Remove DOM node representing the track element **
+
+** Caption button should not be visible as there are no caption tracks.
+EXPECTED (captionsButtonCoordinates[0] <= '0') OK
+EXPECTED (captionsButtonCoordinates[1] <= '0') OK
+
+** Add a text track through JS to the video element **
+
+** Caption button should be visible and enabled because we have a captions track.
+EXPECTED (captionsButtonCoordinates[0] > '0') OK
+EXPECTED (captionsButtonCoordinates[1] > '0') OK
+EXPECTED (captionsButtonElement.disabled == 'false') OK
END OF TEST
Modified: trunk/LayoutTests/media/video-controls-captions.html (139546 => 139547)
--- trunk/LayoutTests/media/video-controls-captions.html 2013-01-12 09:33:01 UTC (rev 139546)
+++ trunk/LayoutTests/media/video-controls-captions.html 2013-01-12 12:04:56 UTC (rev 139547)
@@ -10,28 +10,57 @@
var captionsButtonElement;
var captionsButtonCoordinates;
- function startTest()
+ function addTextTrackThroughJS()
{
- if (!window.eventSender) {
- consoleWrite("No eventSender found.");
- failTest();
- }
+ consoleWrite("");
+ consoleWrite("** Add a text track through JS to the video element **");
+ var t = video.addTextTrack('captions', 'English', 'en');
+ t.addCue(new TextTrackCue(0.0, 10.0, 'Some random caption text'));
+ }
+ function removeHTMLTrackElement()
+ {
+ consoleWrite("");
+ consoleWrite("** Remove DOM node representing the track element **");
+ var htmlTrack = video.children[0];
+ video.removeChild(htmlTrack);
+ }
+
+ function testClosedCaptionsButtonVisibility(expected)
+ {
try {
captionsButtonElement = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-toggle-closed-captions-button");
captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
} catch (exception) {
consoleWrite("Failed to find a closed captions button or its coordinates: " + exception);
- failTest();
+ if (expected)
+ failTest();
return;
}
consoleWrite("");
- consoleWrite("** Caption button should be visible and enabled because we have a captions track.");
- testExpected("captionsButtonCoordinates[0]", 0, ">");
- testExpected("captionsButtonCoordinates[1]", 0, ">");
- testExpected("captionsButtonElement.disabled", false);
+ if (expected == true) {
+ consoleWrite("** Caption button should be visible and enabled because we have a captions track.");
+ testExpected("captionsButtonCoordinates[0]", 0, ">");
+ testExpected("captionsButtonCoordinates[1]", 0, ">");
+ testExpected("captionsButtonElement.disabled", false);
+ } else {
+ consoleWrite("** Caption button should not be visible as there are no caption tracks.");
+ testExpected("captionsButtonCoordinates[0]", 0, "<=");
+ testExpected("captionsButtonCoordinates[1]", 0, "<=");
+ }
+ }
+ function startTest()
+ {
+ if (!window.eventSender) {
+ consoleWrite("No eventSender found.");
+ failTest();
+ }
+
+ findMediaElement();
+ testClosedCaptionsButtonVisibility(true);
+
consoleWrite("");
consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **");
testExpected("video.textTracks.length", 1);
@@ -68,6 +97,12 @@
clickCCButton();
checkCaptionsDisplay();
+ removeHTMLTrackElement();
+ testClosedCaptionsButtonVisibility(false);
+
+ addTextTrackThroughJS();
+ testClosedCaptionsButtonVisibility(true);
+
endTest();
}
Modified: trunk/Source/WebCore/ChangeLog (139546 => 139547)
--- trunk/Source/WebCore/ChangeLog 2013-01-12 09:33:01 UTC (rev 139546)
+++ trunk/Source/WebCore/ChangeLog 2013-01-12 12:04:56 UTC (rev 139547)
@@ -1,3 +1,19 @@
+2013-01-12 Victor Carbune <[email protected]>
+
+ CC Button doesn't always show up
+ https://bugs.webkit.org/show_bug.cgi?id=106653
+
+ Reviewed by Eric Carlson.
+
+ Added extra checks to existing test.
+
+ * html/shadow/MediaControls.cpp:
+ (WebCore::MediaControls::closedCaptionTracksChanged):
+ Enforced visibility of captions button whenever the track list changes.
+ (WebCore):
+ * html/shadow/MediaControls.h:
+ (MediaControls):
+
2013-01-11 Dan Beam <[email protected]>
[clean up] Remove HTMLFormElement::AutocompleteResultError in favor of more specific Error reasons
Modified: trunk/Source/WebCore/html/shadow/MediaControls.cpp (139546 => 139547)
--- trunk/Source/WebCore/html/shadow/MediaControls.cpp 2013-01-12 09:33:01 UTC (rev 139546)
+++ trunk/Source/WebCore/html/shadow/MediaControls.cpp 2013-01-12 12:04:56 UTC (rev 139547)
@@ -252,6 +252,17 @@
m_toggleClosedCaptionsButton->updateDisplayType();
}
+void MediaControls::closedCaptionTracksChanged()
+{
+ if (!m_toggleClosedCaptionsButton)
+ return;
+
+ if (m_mediaController->hasClosedCaptions())
+ m_toggleClosedCaptionsButton->show();
+ else
+ m_toggleClosedCaptionsButton->hide();
+}
+
void MediaControls::enteredFullscreen()
{
m_isFullscreen = true;
Modified: trunk/Source/WebCore/html/shadow/MediaControls.h (139546 => 139547)
--- trunk/Source/WebCore/html/shadow/MediaControls.h 2013-01-12 09:33:01 UTC (rev 139546)
+++ trunk/Source/WebCore/html/shadow/MediaControls.h 2013-01-12 12:04:56 UTC (rev 139547)
@@ -89,7 +89,7 @@
virtual void changedClosedCaptionsVisibility();
virtual void toggleClosedCaptionTrackList() { }
- virtual void closedCaptionTracksChanged() { }
+ virtual void closedCaptionTracksChanged();
virtual void enteredFullscreen();
virtual void exitedFullscreen();