mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 840745 - Default HTML5 audio/video player controls should facilitate changing playback rate. r=jaws ui-r=limi
--HG-- extra : rebase_source : 9cb821d5b4632dcfbe518504aa963b87b9a2c9f2
This commit is contained in:
parent
05a0bb6ef8
commit
9d0b8a594e
@ -66,6 +66,35 @@
|
||||
label="&mediaUnmute.label;"
|
||||
accesskey="&mediaUnmute.accesskey;"
|
||||
oncommand="gContextMenu.mediaCommand('unmute');"/>
|
||||
<menu id="context-media-playbackrate" label="&mediaPlaybackRate.label;" accesskey="&mediaPlaybackRate.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem id="context-media-playbackrate-050x"
|
||||
label="&mediaPlaybackRate050x.label;"
|
||||
accesskey="&mediaPlaybackRate050x.accesskey;"
|
||||
type="radio"
|
||||
name="playbackrate"
|
||||
oncommand="gContextMenu.mediaCommand('playbackRate', 0.5);"/>
|
||||
<menuitem id="context-media-playbackrate-100x"
|
||||
label="&mediaPlaybackRate100x.label;"
|
||||
accesskey="&mediaPlaybackRate100x.accesskey;"
|
||||
type="radio"
|
||||
name="playbackrate"
|
||||
checked="true"
|
||||
oncommand="gContextMenu.mediaCommand('playbackRate', 1.0);"/>
|
||||
<menuitem id="context-media-playbackrate-150x"
|
||||
label="&mediaPlaybackRate150x.label;"
|
||||
accesskey="&mediaPlaybackRate150x.accesskey;"
|
||||
type="radio"
|
||||
name="playbackrate"
|
||||
oncommand="gContextMenu.mediaCommand('playbackRate', 1.5);"/>
|
||||
<menuitem id="context-media-playbackrate-200x"
|
||||
label="&mediaPlaybackRate200x.label;"
|
||||
accesskey="&mediaPlaybackRate200x.accesskey;"
|
||||
type="radio"
|
||||
name="playbackrate"
|
||||
oncommand="gContextMenu.mediaCommand('playbackRate', 2.0);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="context-media-showcontrols"
|
||||
label="&mediaShowControls.label;"
|
||||
accesskey="&mediaShowControls.accesskey;"
|
||||
|
@ -392,6 +392,7 @@ nsContextMenu.prototype = {
|
||||
this.showItem("context-media-pause", onMedia && !this.target.paused && !this.target.ended);
|
||||
this.showItem("context-media-mute", onMedia && !this.target.muted);
|
||||
this.showItem("context-media-unmute", onMedia && this.target.muted);
|
||||
this.showItem("context-media-playbackrate", onMedia);
|
||||
this.showItem("context-media-showcontrols", onMedia && !this.target.controls);
|
||||
this.showItem("context-media-hidecontrols", onMedia && this.target.controls);
|
||||
this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.mozFullScreenElement == null);
|
||||
@ -401,12 +402,21 @@ nsContextMenu.prototype = {
|
||||
|
||||
// Disable them when there isn't a valid media source loaded.
|
||||
if (onMedia) {
|
||||
this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5);
|
||||
this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0);
|
||||
this.setItemAttr("context-media-playbackrate-150x", "checked", this.target.playbackRate == 1.5);
|
||||
this.setItemAttr("context-media-playbackrate-200x", "checked", this.target.playbackRate == 2.0);
|
||||
var hasError = this.target.error != null ||
|
||||
this.target.networkState == this.target.NETWORK_NO_SOURCE;
|
||||
this.setItemAttr("context-media-play", "disabled", hasError);
|
||||
this.setItemAttr("context-media-pause", "disabled", hasError);
|
||||
this.setItemAttr("context-media-mute", "disabled", hasError);
|
||||
this.setItemAttr("context-media-unmute", "disabled", hasError);
|
||||
this.setItemAttr("context-media-playbackrate", "disabled", hasError);
|
||||
this.setItemAttr("context-media-playbackrate-050x", "disabled", hasError);
|
||||
this.setItemAttr("context-media-playbackrate-100x", "disabled", hasError);
|
||||
this.setItemAttr("context-media-playbackrate-150x", "disabled", hasError);
|
||||
this.setItemAttr("context-media-playbackrate-200x", "disabled", hasError);
|
||||
this.setItemAttr("context-media-showcontrols", "disabled", hasError);
|
||||
this.setItemAttr("context-media-hidecontrols", "disabled", hasError);
|
||||
if (this.onVideo) {
|
||||
@ -1470,7 +1480,7 @@ nsContextMenu.prototype = {
|
||||
SwitchDocumentDirection(this.browser.contentWindow);
|
||||
},
|
||||
|
||||
mediaCommand : function CM_mediaCommand(command) {
|
||||
mediaCommand : function CM_mediaCommand(command, data) {
|
||||
var media = this.target;
|
||||
|
||||
switch (command) {
|
||||
@ -1486,6 +1496,9 @@ nsContextMenu.prototype = {
|
||||
case "unmute":
|
||||
media.muted = false;
|
||||
break;
|
||||
case "playbackRate":
|
||||
media.playbackRate = data;
|
||||
break;
|
||||
case "hidecontrols":
|
||||
media.removeAttribute("controls");
|
||||
break;
|
||||
|
@ -370,6 +370,11 @@ function runTest(testNum) {
|
||||
// Context menu for a video (with a VALID media source)
|
||||
checkContextMenu(["context-media-play", true,
|
||||
"context-media-mute", true,
|
||||
"context-media-playbackrate", null,
|
||||
["context-media-playbackrate-050x", true,
|
||||
"context-media-playbackrate-100x", true,
|
||||
"context-media-playbackrate-150x", true,
|
||||
"context-media-playbackrate-200x", true], null,
|
||||
"context-media-hidecontrols", true,
|
||||
"context-video-showstats", true,
|
||||
"context-video-fullscreen", true,
|
||||
@ -389,6 +394,11 @@ function runTest(testNum) {
|
||||
// Context menu for a video (with an audio-only file)
|
||||
checkContextMenu(["context-media-play", true,
|
||||
"context-media-mute", true,
|
||||
"context-media-playbackrate", null,
|
||||
["context-media-playbackrate-050x", true,
|
||||
"context-media-playbackrate-100x", true,
|
||||
"context-media-playbackrate-150x", true,
|
||||
"context-media-playbackrate-200x", true], null,
|
||||
"context-media-showcontrols", true,
|
||||
"---", null,
|
||||
"context-copyaudiourl", true,
|
||||
@ -404,6 +414,11 @@ function runTest(testNum) {
|
||||
// Context menu for a video (with an INVALID media source)
|
||||
checkContextMenu(["context-media-play", false,
|
||||
"context-media-mute", false,
|
||||
"context-media-playbackrate", null,
|
||||
["context-media-playbackrate-050x", false,
|
||||
"context-media-playbackrate-100x", false,
|
||||
"context-media-playbackrate-150x", false,
|
||||
"context-media-playbackrate-200x", false], null,
|
||||
"context-media-hidecontrols", false,
|
||||
"context-video-showstats", false,
|
||||
"context-video-fullscreen", false,
|
||||
@ -423,6 +438,11 @@ function runTest(testNum) {
|
||||
// Context menu for a video (with an INVALID media source)
|
||||
checkContextMenu(["context-media-play", false,
|
||||
"context-media-mute", false,
|
||||
"context-media-playbackrate", null,
|
||||
["context-media-playbackrate-050x", false,
|
||||
"context-media-playbackrate-100x", false,
|
||||
"context-media-playbackrate-150x", false,
|
||||
"context-media-playbackrate-200x", false], null,
|
||||
"context-media-hidecontrols", false,
|
||||
"context-video-showstats", false,
|
||||
"context-video-fullscreen", false,
|
||||
@ -475,6 +495,11 @@ function runTest(testNum) {
|
||||
// Context menu for a video in an iframe
|
||||
checkContextMenu(["context-media-play", true,
|
||||
"context-media-mute", true,
|
||||
"context-media-playbackrate", null,
|
||||
["context-media-playbackrate-050x", true,
|
||||
"context-media-playbackrate-100x", true,
|
||||
"context-media-playbackrate-150x", true,
|
||||
"context-media-playbackrate-200x", true], null,
|
||||
"context-media-hidecontrols", true,
|
||||
"context-video-showstats", true,
|
||||
"context-video-fullscreen", true,
|
||||
|
@ -456,6 +456,19 @@ items are mutually exclusive. -->
|
||||
<!ENTITY mediaMute.accesskey "M">
|
||||
<!ENTITY mediaUnmute.label "Unmute">
|
||||
<!ENTITY mediaUnmute.accesskey "m">
|
||||
<!ENTITY mediaPlaybackRate.label "Play Speed">
|
||||
<!ENTITY mediaPlaybackRate.accesskey "l">
|
||||
<!ENTITY mediaPlaybackRate050x.label "Slow Motion (0.5×)">
|
||||
<!ENTITY mediaPlaybackRate050x.accesskey "S">
|
||||
<!ENTITY mediaPlaybackRate100x.label "Normal Speed">
|
||||
<!ENTITY mediaPlaybackRate100x.accesskey "N">
|
||||
<!ENTITY mediaPlaybackRate150x.label "High Speed (1.5×)">
|
||||
<!ENTITY mediaPlaybackRate150x.accesskey "H">
|
||||
<!-- LOCALIZATION NOTE: "Ludicrous Speed" is a reference to the
|
||||
movie "Space Balls" and is meant to say that this speed is very
|
||||
fast. -->
|
||||
<!ENTITY mediaPlaybackRate200x.label "Ludicrous Speed (2×)">
|
||||
<!ENTITY mediaPlaybackRate200x.accesskey "L">
|
||||
<!-- LOCALIZATION NOTE: The access keys for "Show Controls" and
|
||||
"Hide Controls" are the same because the two context-menu
|
||||
items are mutually exclusive. -->
|
||||
|
Loading…
Reference in New Issue
Block a user