Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: third_party/WebKit/LayoutTests/media/media-controls.js

Issue 2269883002: Refactor textTractDisplayElement utility function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 function textTrackCueElementByIndex(parentElement, cueIndex) { 81 function textTrackCueElementByIndex(parentElement, cueIndex) {
82 var displayElement = textTrackCueDisplayElement(parentElement); 82 var displayElement = textTrackCueDisplayElement(parentElement);
83 if (displayElement) { 83 if (displayElement) {
84 for (i = 0; i < cueIndex; i++) 84 for (i = 0; i < cueIndex; i++)
85 displayElement = displayElement.nextSibling; 85 displayElement = displayElement.nextSibling;
86 } 86 }
87 87
88 return displayElement; 88 return displayElement;
89 } 89 }
90 90
91 function textTrackRegionElement(parentElement)
92 {
93 var containerElement = textTrackContainerElement(parentElement);
94 return mediaControlsElement(containerElement.firstChild, "-webkit-media-text -track-region");
95 }
96
97 function textTrackRegionContainerElement(parentElement)
98 {
99 var containerElement = textTrackContainerElement(parentElement);
100 return mediaControlsElement(containerElement.firstChild, "-webkit-media-text -track-region-container");
101 }
102
91 // TODO(srirama.m): Phase out the uses of this function and 103 // TODO(srirama.m): Phase out the uses of this function and
92 // replace with more specific functions at each call site. 104 // replace with more specific functions at each call site.
93 // For ex: textTrackDisplayElement(video, 'region') => textTrackRegionElement(vi deo) and
94 // textTrackDisplayElement(video, 'region-container') => textTrackRegionContaine rElement(video).
95 function textTrackDisplayElement(parentElement, id, cueNumber) 105 function textTrackDisplayElement(parentElement, id, cueNumber)
96 { 106 {
97 var containerElement = textTrackContainerElement(parentElement); 107 var containerElement = textTrackContainerElement(parentElement);
98 108
99 if (!containerElement) 109 if (!containerElement)
100 throw "Failed to find text track container element"; 110 throw "Failed to find text track container element";
101 111
102 if (!id) 112 if (!id)
103 return containerElement; 113 return containerElement;
104 114
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 throw "The media will end before the controls have been hidden"; 195 throw "The media will end before the controls have been hidden";
186 196
187 setTimeout(func, hideTimeoutMs); 197 setTimeout(func, hideTimeoutMs);
188 } 198 }
189 199
190 function hasFullscreenButton(element) 200 function hasFullscreenButton(element)
191 { 201 {
192 var size = mediaControlsButtonDimensions(element, "fullscreen-button"); 202 var size = mediaControlsButtonDimensions(element, "fullscreen-button");
193 return size[0] > 0 && size[1] > 0; 203 return size[0] > 0 && size[1] > 0;
194 } 204 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-display.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698