Source/WebCore/ChangeLog

 12013-01-11 Victor Carbune <victor@rosedu.org>
 2
 3 [Chromium] CC Button doesn't show up always
 4 https://bugs.webkit.org/show_bug.cgi?id=106653
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Added extra checks to existing test.
 9
 10 * html/shadow/MediaControlsChromium.cpp:
 11 (WebCore):
 12 (WebCore::MediaControlsChromium::closedCaptionTracksChanged):
 13 Enforce visibility of captions button whenever the track list changes.
 14 * html/shadow/MediaControlsChromium.h:
 15 (MediaControlsChromium):
 16
1172013-01-11 Alexander Pavlov <apavlov@chromium.org>
218
319 Web Inspector: [Elements] Search in the DOM tree does not scroll horizontally

Source/WebCore/html/shadow/MediaControlsChromium.cpp

@@void MediaControlsChromium::createTextTrackDisplay()
218218 textDisplayContainer->createSubtrees(document());
219219 textDisplayContainer.release();
220220}
 221
 222void MediaControlsChromium::closedCaptionTracksChanged()
 223{
 224 if (!m_toggleClosedCaptionsButton)
 225 return;
 226
 227 if (m_mediaController->hasClosedCaptions())
 228 m_toggleClosedCaptionsButton->show();
 229 else
 230 m_toggleClosedCaptionsButton->hide();
 231}
221232#endif
222233
223234}

Source/WebCore/html/shadow/MediaControlsChromium.h

@@public:
5050
5151#if ENABLE(VIDEO_TRACK)
5252 void createTextTrackDisplay() OVERRIDE;
 53 virtual void closedCaptionTracksChanged() OVERRIDE;
5354#endif
5455
5556protected:

LayoutTests/ChangeLog

 12013-01-11 Victor Carbune <victor@rosedu.org>
 2
 3 [Chromium] CC Button doesn't show up always
 4 https://bugs.webkit.org/show_bug.cgi?id=106653
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * media/video-controls-captions-expected.txt: Updated.
 9 * media/video-controls-captions.html: Added extra checks that fail
 10 without the code changes.
 11
1122013-01-11 Noel Gordon <noel.gordon@gmail.com>
213
314 [chromium] Add ImageOnlyFailure for fast/css/font-face-unicode-range.html on win

LayoutTests/media/video-controls-captions-expected.txt

@@EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem') OK
2121** Captions should not be visible after button is clicked again **
2222*** Click the CC button.
2323No text track cue with display id '-webkit-media-text-track-display' is currently visible
 24
 25** Remove DOM node representing the track element **
 26
 27** Caption button should not be visible as there are no captions track.
 28EXPECTED (captionsButtonCoordinates[0] <= '0') OK
 29EXPECTED (captionsButtonCoordinates[1] <= '0') OK
 30
 31** Add a text track through JS to the video element **
 32
 33** Caption button should be visible and enabled because we have a captions track.
 34EXPECTED (captionsButtonCoordinates[0] > '0') OK
 35EXPECTED (captionsButtonCoordinates[1] > '0') OK
 36EXPECTED (captionsButtonElement.disabled == 'false') OK
2437END OF TEST
2538

LayoutTests/media/video-controls-captions.html

1010 var captionsButtonElement;
1111 var captionsButtonCoordinates;
1212
13  function startTest()
 13 function addTextTrackThroughJS()
1414 {
15  if (!window.eventSender) {
16  consoleWrite("No eventSender found.");
17  failTest();
18  }
 15 consoleWrite("");
 16 consoleWrite("** Add a text track through JS to the video element **");
 17 var t = video.addTextTrack('captions', 'English', 'en');
 18 t.addCue(new TextTrackCue(0.0, 10.0, 'Some random caption text'));
 19 }
1920
 21 function removeHTMLTrackElement()
 22 {
 23 consoleWrite("");
 24 consoleWrite("** Remove DOM node representing the track element **");
 25 var htmlTrack = video.children[0];
 26 video.removeChild(htmlTrack);
 27 }
 28
 29 function testClosedCaptionsButtonVisibility(expected)
 30 {
2031 try {
2132 captionsButtonElement = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-toggle-closed-captions-button");
2233 captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
2334 } catch (exception) {
2435 consoleWrite("Failed to find a closed captions button or its coordinates: " + exception);
25  failTest();
 36 if (expected)
 37 failTest();
2638 return;
2739 }
2840
2941 consoleWrite("");
30  consoleWrite("** Caption button should be visible and enabled because we have a captions track.");
31  testExpected("captionsButtonCoordinates[0]", 0, ">");
32  testExpected("captionsButtonCoordinates[1]", 0, ">");
33  testExpected("captionsButtonElement.disabled", false);
 42 if (expected == true) {
 43 consoleWrite("** Caption button should be visible and enabled because we have a captions track.");
 44 testExpected("captionsButtonCoordinates[0]", 0, ">");
 45 testExpected("captionsButtonCoordinates[1]", 0, ">");
 46 testExpected("captionsButtonElement.disabled", false);
 47 } else {
 48 consoleWrite("** Caption button should not be visible as there are no captions track.");
 49 testExpected("captionsButtonCoordinates[0]", 0, "<=");
 50 testExpected("captionsButtonCoordinates[1]", 0, "<=");
 51 }
 52 }
 53
 54 function startTest()
 55 {
 56 if (!window.eventSender) {
 57 consoleWrite("No eventSender found.");
 58 failTest();
 59 }
 60
 61 findMediaElement();
 62 testClosedCaptionsButtonVisibility(true);
3463
3564 consoleWrite("");
3665 consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **");

6897 clickCCButton();
6998 checkCaptionsDisplay();
7099
 100 removeHTMLTrackElement();
 101 testClosedCaptionsButtonVisibility(false);
 102
 103 addTextTrackThroughJS();
 104 testClosedCaptionsButtonVisibility(true);
 105
71106 endTest();
72107 }
73108