зеркало из https://github.com/mozilla/gecko-dev.git
Bug 877453 - Expose longdesc in image context menus. r=gavin ui-r=boriss
This commit is contained in:
Родитель
26642df969
Коммит
265844cb3d
|
@ -180,6 +180,11 @@
|
|||
label="&viewImageInfoCmd.label;"
|
||||
accesskey="&viewImageInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewImageInfo();"/>
|
||||
<menuitem id="context-viewimagedesc"
|
||||
label="&viewImageDescCmd.label;"
|
||||
accesskey="&viewImageDescCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewImageDesc(event);"
|
||||
onclick="checkForMiddleClick(this, event);"/>
|
||||
<menuitem id="context-savevideo"
|
||||
label="&saveVideoCmd.label;"
|
||||
accesskey="&saveVideoCmd.accesskey;"
|
||||
|
|
|
@ -261,6 +261,7 @@ nsContextMenu.prototype = {
|
|||
.disabled = !this.hasBGImage;
|
||||
|
||||
this.showItem("context-viewimageinfo", this.onImage);
|
||||
this.showItem("context-viewimagedesc", this.onImage && this.imageDescURL !== "");
|
||||
},
|
||||
|
||||
initMiscItems: function CM_initMiscItems() {
|
||||
|
@ -499,6 +500,7 @@ nsContextMenu.prototype = {
|
|||
this.onImage = false;
|
||||
this.onLoadedImage = false;
|
||||
this.onCompletedImage = false;
|
||||
this.imageDescURL = "";
|
||||
this.onCanvas = false;
|
||||
this.onVideo = false;
|
||||
this.onAudio = false;
|
||||
|
@ -548,6 +550,11 @@ nsContextMenu.prototype = {
|
|||
this.onCompletedImage = true;
|
||||
|
||||
this.mediaURL = this.target.currentURI.spec;
|
||||
|
||||
var descURL = this.target.getAttribute("longdesc");
|
||||
if (descURL) {
|
||||
this.imageDescURL = makeURLAbsolute(this.target.ownerDocument.body.baseURI, descURL);
|
||||
}
|
||||
}
|
||||
else if (this.target instanceof HTMLCanvasElement) {
|
||||
this.onCanvas = true;
|
||||
|
@ -874,6 +881,14 @@ nsContextMenu.prototype = {
|
|||
"mediaTab", this.target);
|
||||
},
|
||||
|
||||
viewImageDesc: function(e) {
|
||||
var doc = this.target.ownerDocument;
|
||||
urlSecurityCheck(this.imageDescURL, this.browser.contentPrincipal,
|
||||
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
||||
openUILink(this.imageDescURL, e, { disallowInheritPrincipal: true,
|
||||
referrerURI: doc.documentURIObject });
|
||||
},
|
||||
|
||||
viewFrameInfo: function() {
|
||||
BrowserPageInfo(this.target.ownerDocument);
|
||||
},
|
||||
|
|
|
@ -66,5 +66,6 @@ Browser context menu subtest.
|
|||
<input id="test-select-input-text" type="text" value="input">
|
||||
<input id="test-select-input-text-type-password" type="password" value="password">
|
||||
<embed id="test-plugin" style="width: 200px; height: 200px;" type="application/x-test"></embed>
|
||||
<img id="test-longdesc" src="ctxmenu-image.png" longdesc="http://www.mozilla.org"></embed>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -939,6 +939,22 @@ function runTest(testNum) {
|
|||
tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;
|
||||
}
|
||||
}
|
||||
openContextMenuFor(longdesc);
|
||||
return;
|
||||
|
||||
case 30:
|
||||
// Context menu for an image with longdesc
|
||||
checkContextMenu(["context-viewimage", true,
|
||||
"context-copyimage-contents", true,
|
||||
"context-copyimage", true,
|
||||
"---", null,
|
||||
"context-saveimage", true,
|
||||
"context-sendimage", true,
|
||||
"context-setDesktopBackground", true,
|
||||
"context-viewimageinfo", true,
|
||||
"context-viewimagedesc", true
|
||||
].concat(inspectItems));
|
||||
closeContextMenu();
|
||||
|
||||
// finish test
|
||||
subwindow.close();
|
||||
|
@ -968,7 +984,7 @@ var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2,
|
|||
iframe, video_in_iframe, image_in_iframe, textarea, contenteditable,
|
||||
inputspell, pagemenu, dom_full_screen, plainTextItems, audio_in_video,
|
||||
selecttext, selecttextlink, imagelink, select_inputtext, select_inputtext_password,
|
||||
plugin;
|
||||
plugin, longdesc;
|
||||
|
||||
function startTest() {
|
||||
chromeWin = SpecialPowers.wrap(subwindow)
|
||||
|
@ -1017,6 +1033,7 @@ function startTest() {
|
|||
select_inputtext = subwindow.document.getElementById("test-select-input-text");
|
||||
select_inputtext_password = subwindow.document.getElementById("test-select-input-text-type-password");
|
||||
plugin = subwindow.document.getElementById("test-plugin");
|
||||
longdesc = subwindow.document.getElementById("test-longdesc");
|
||||
|
||||
contextMenu.addEventListener("popupshown", function() { runTest(++testNum); }, false);
|
||||
runTest(1);
|
||||
|
|
|
@ -408,6 +408,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
|||
<!ENTITY viewImageCmd.accesskey "I">
|
||||
<!ENTITY viewImageInfoCmd.label "View Image Info">
|
||||
<!ENTITY viewImageInfoCmd.accesskey "f">
|
||||
<!ENTITY viewImageDescCmd.label "View Description">
|
||||
<!ENTITY viewImageDescCmd.accesskey "D">
|
||||
<!ENTITY viewVideoCmd.label "View Video">
|
||||
<!ENTITY viewVideoCmd.accesskey "I">
|
||||
<!ENTITY viewBGImageCmd.label "View Background Image">
|
||||
|
|
Загрузка…
Ссылка в новой задаче