| OLD | NEW | 
|---|
| 1 var captionsButtonElement; | 1 var captionsButtonElement; | 
| 2 var captionsButtonCoordinates; | 2 var captionsButtonCoordinates; | 
| 3 | 3 | 
| 4 function mediaControlsElement(first, id) | 4 function mediaControlsElement(first, id) | 
| 5 { | 5 { | 
| 6     for (var element = first; element; element = element.nextSibling) { | 6     for (var element = first; element; element = element.nextSibling) { | 
| 7         // Not every element in the media controls has a shadow pseudo ID, eg. t
     he | 7         // Not every element in the media controls has a shadow pseudo ID, eg. t
     he | 
| 8         // text nodes for the time values, so guard against exceptions. | 8         // text nodes for the time values, so guard against exceptions. | 
| 9         try { | 9         try { | 
| 10             if (internals.shadowPseudoId(element) == id) | 10             if (internals.shadowPseudoId(element) == id) | 
| 11                 return element; | 11                 return element; | 
| 12         } catch (exception) { } | 12         } catch (exception) { } | 
| 13 | 13 | 
| 14         if (element.firstChild) { | 14         if (element.firstChild) { | 
| 15             var childElement = mediaControlsElement(element.firstChild, id); | 15             var childElement = mediaControlsElement(element.firstChild, id); | 
| 16             if (childElement) | 16             if (childElement) | 
| 17                 return childElement; | 17                 return childElement; | 
| 18         } | 18         } | 
| 19     } | 19     } | 
| 20 | 20 | 
| 21     return null; | 21     return null; | 
| 22 } | 22 } | 
| 23 | 23 | 
| 24 function mediaControlsButtonCoordinates(element, id) | 24 function mediaControlsButton(element, id) | 
| 25 { | 25 { | 
| 26     var controlID = "-webkit-media-controls-" + id; | 26     var controlID = "-webkit-media-controls-" + id; | 
| 27     var button = mediaControlsElement(internals.shadowRoot(element).firstChild, 
     controlID); | 27     var button = mediaControlsElement(internals.shadowRoot(element).firstChild, 
     controlID); | 
| 28     if (!button) | 28     if (!button) | 
| 29         throw "Failed to find media control element ID '" + id + "'"; | 29         throw "Failed to find media control element ID '" + id + "'"; | 
|  | 30     return button; | 
|  | 31 } | 
| 30 | 32 | 
|  | 33 function mediaControlsButtonCoordinates(element, id) | 
|  | 34 { | 
|  | 35     var button = mediaControlsButton(element, id); | 
| 31     var buttonBoundingRect = button.getBoundingClientRect(); | 36     var buttonBoundingRect = button.getBoundingClientRect(); | 
| 32     var x = buttonBoundingRect.left + buttonBoundingRect.width / 2; | 37     var x = buttonBoundingRect.left + buttonBoundingRect.width / 2; | 
| 33     var y = buttonBoundingRect.top + buttonBoundingRect.height / 2; | 38     var y = buttonBoundingRect.top + buttonBoundingRect.height / 2; | 
| 34     return new Array(x, y); | 39     return new Array(x, y); | 
| 35 } | 40 } | 
| 36 | 41 | 
| 37 function mediaControlsButtonDimensions(element, id) | 42 function mediaControlsButtonDimensions(element, id) | 
| 38 { | 43 { | 
| 39     var controlID = "-webkit-media-controls-" + id; | 44     var button = mediaControlsButton(element, id); | 
| 40     var button = mediaControlsElement(internals.shadowRoot(element).firstChild, 
     controlID); |  | 
| 41     if (!button) |  | 
| 42         throw "Failed to find media control element ID '" + id + "'"; |  | 
| 43 |  | 
| 44     var buttonBoundingRect = button.getBoundingClientRect(); | 45     var buttonBoundingRect = button.getBoundingClientRect(); | 
| 45     return new Array(buttonBoundingRect.width, buttonBoundingRect.height); | 46     return new Array(buttonBoundingRect.width, buttonBoundingRect.height); | 
| 46 } | 47 } | 
| 47 | 48 | 
| 48 function textTrackDisplayElement(parentElement, id, cueNumber) | 49 function textTrackDisplayElement(parentElement, id, cueNumber) | 
| 49 { | 50 { | 
| 50     var textTrackContainerID = "-webkit-media-text-track-container"; | 51     var textTrackContainerID = "-webkit-media-text-track-container"; | 
| 51     var containerElement = mediaControlsElement(internals.shadowRoot(parentEleme
     nt).firstChild, textTrackContainerID); | 52     var containerElement = mediaControlsElement(internals.shadowRoot(parentEleme
     nt).firstChild, textTrackContainerID); | 
| 52 | 53 | 
| 53     if (!containerElement) | 54     if (!containerElement) | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 101     } | 102     } | 
| 102 } | 103 } | 
| 103 | 104 | 
| 104 function clickCCButton() | 105 function clickCCButton() | 
| 105 { | 106 { | 
| 106     consoleWrite("*** Click the CC button."); | 107     consoleWrite("*** Click the CC button."); | 
| 107     eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina
     tes[1]); | 108     eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina
     tes[1]); | 
| 108     eventSender.mouseDown(); | 109     eventSender.mouseDown(); | 
| 109     eventSender.mouseUp(); | 110     eventSender.mouseUp(); | 
| 110 } | 111 } | 
| OLD | NEW | 
|---|