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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 function elementCoordinates(element) | 50 function elementCoordinates(element) |
51 { | 51 { |
52 var elementBoundingRect = element.getBoundingClientRect(); | 52 var elementBoundingRect = element.getBoundingClientRect(); |
53 var x = elementBoundingRect.left + elementBoundingRect.width / 2; | 53 var x = elementBoundingRect.left + elementBoundingRect.width / 2; |
54 var y = elementBoundingRect.top + elementBoundingRect.height / 2; | 54 var y = elementBoundingRect.top + elementBoundingRect.height / 2; |
55 return new Array(x, y); | 55 return new Array(x, y); |
56 } | 56 } |
57 | 57 |
| 58 function coordinatesOutsideElement(element) |
| 59 { |
| 60 var elementBoundingRect = element.getBoundingClientRect(); |
| 61 var x = elementBoundingRect.left - 1; |
| 62 var y = elementBoundingRect.top - 1; |
| 63 return new Array(x, y); |
| 64 } |
| 65 |
58 function mediaControlsButtonCoordinates(element, id) | 66 function mediaControlsButtonCoordinates(element, id) |
59 { | 67 { |
60 var button = mediaControlsButton(element, id); | 68 var button = mediaControlsButton(element, id); |
61 return elementCoordinates(button); | 69 return elementCoordinates(button); |
62 } | 70 } |
63 | 71 |
64 function mediaControlsButtonDimensions(element, id) | 72 function mediaControlsButtonDimensions(element, id) |
65 { | 73 { |
66 var button = mediaControlsButton(element, id); | 74 var button = mediaControlsButton(element, id); |
67 var buttonBoundingRect = button.getBoundingClientRect(); | 75 var buttonBoundingRect = button.getBoundingClientRect(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 throw "The media will end before the controls have been hidden"; | 173 throw "The media will end before the controls have been hidden"; |
166 | 174 |
167 setTimeout(func, hideTimeoutMs); | 175 setTimeout(func, hideTimeoutMs); |
168 } | 176 } |
169 | 177 |
170 function hasFullscreenButton(element) | 178 function hasFullscreenButton(element) |
171 { | 179 { |
172 var size = mediaControlsButtonDimensions(element, "fullscreen-button"); | 180 var size = mediaControlsButtonDimensions(element, "fullscreen-button"); |
173 return size[0] > 0 && size[1] > 0; | 181 return size[0] > 0 && size[1] > 0; |
174 } | 182 } |
OLD | NEW |