OLD | NEW |
1 var captionsButtonElement; | 1 var captionsButtonElement; |
2 var captionsButtonCoordinates; | 2 var captionsButtonCoordinates; |
3 | 3 |
4 // As specified in mediaControls.css, this is how long it takes to fade out cont
rols | 4 // As specified in mediaControls.css, this is how long it takes to fade out cont
rols |
5 const controlsFadeOutDurationMs = 300; | 5 const controlsFadeOutDurationMs = 300; |
6 | 6 |
7 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and | 7 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and |
8 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' | 8 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' |
9 // in MediaControls.cpp. | 9 // in MediaControls.cpp. |
10 const controlsMouseMovementTimeoutMs = 3000; | 10 const controlsMouseMovementTimeoutMs = 3000; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 for (i = 0; i < cueNumber; i++) | 92 for (i = 0; i < cueNumber; i++) |
93 displayElement = displayElement.nextSibling; | 93 displayElement = displayElement.nextSibling; |
94 | 94 |
95 if (!displayElement) | 95 if (!displayElement) |
96 throw "There are not " + cueNumber + " text track cues visible"; | 96 throw "There are not " + cueNumber + " text track cues visible"; |
97 } | 97 } |
98 | 98 |
99 return displayElement; | 99 return displayElement; |
100 } | 100 } |
101 | 101 |
| 102 function isClosedCaptionsButtonVisible(currentMediaElement) |
| 103 { |
| 104 var captionsButtonElement = mediaControlsButton(currentMediaElement, "toggle
-closed-captions-button"); |
| 105 var captionsButtonCoordinates = mediaControlsButtonCoordinates(currentMediaE
lement, "toggle-closed-captions-button"); |
| 106 |
| 107 if (!captionsButtonElement.disabled |
| 108 && captionsButtonCoordinates[0] > 0 |
| 109 && captionsButtonCoordinates[1] > 0) { |
| 110 return true; |
| 111 } |
| 112 |
| 113 return false; |
| 114 } |
| 115 |
102 function testClosedCaptionsButtonVisibility(expected) | 116 function testClosedCaptionsButtonVisibility(expected) |
103 { | 117 { |
104 try { | 118 try { |
105 captionsButtonElement = mediaControlsButton(mediaElement, "toggle-closed
-captions-button"); | 119 captionsButtonElement = mediaControlsButton(mediaElement, "toggle-closed
-captions-button"); |
106 captionsButtonCoordinates = mediaControlsButtonCoordinates(mediaElement,
"toggle-closed-captions-button"); | 120 captionsButtonCoordinates = mediaControlsButtonCoordinates(mediaElement,
"toggle-closed-captions-button"); |
107 } catch (exception) { | 121 } catch (exception) { |
108 consoleWrite("Failed to find a closed captions button or its coordinates
: " + exception); | 122 consoleWrite("Failed to find a closed captions button or its coordinates
: " + exception); |
109 if (expected) | 123 if (expected) |
110 failTest(); | 124 failTest(); |
111 return; | 125 return; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Compute the time it'll take until the controls will be invisible - | 187 // Compute the time it'll take until the controls will be invisible - |
174 // assuming playback has been started prior to invoking this | 188 // assuming playback has been started prior to invoking this |
175 // function. Allow 500ms slack. | 189 // function. Allow 500ms slack. |
176 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration
Ms + 500; | 190 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration
Ms + 500; |
177 | 191 |
178 if (!mediaElement.loop && hideTimeoutMs >= 1000 * (mediaElement.duration - m
ediaElement.currentTime)) | 192 if (!mediaElement.loop && hideTimeoutMs >= 1000 * (mediaElement.duration - m
ediaElement.currentTime)) |
179 throw "The media will end before the controls have been hidden"; | 193 throw "The media will end before the controls have been hidden"; |
180 | 194 |
181 setTimeout(func, hideTimeoutMs); | 195 setTimeout(func, hideTimeoutMs); |
182 } | 196 } |
OLD | NEW |