Bug 1570165 - Port Bug 517902 "Reimplement image properties, using the existing "Media" panel" to SeaMonkey. r=frg
This commit is contained in:
Родитель
087ac7dbf7
Коммит
1d7ac3ac41
|
@ -207,6 +207,10 @@
|
|||
label="&setDesktopBackgroundCmd.label;"
|
||||
accesskey="&setDesktopBackgroundCmd.accesskey;"
|
||||
oncommand="gContextMenu.setDesktopBackground();"/>
|
||||
<menuitem id="context-viewimageinfo"
|
||||
label="&viewImageInfoCmd.label;"
|
||||
accesskey="&viewImageInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewImageInfo();"/>
|
||||
<menuitem id="context-savevideo"
|
||||
label="&saveVideoCmd.label;"
|
||||
accesskey="&saveVideoCmd.accesskey;"
|
||||
|
|
|
@ -289,6 +289,8 @@ nsContextMenu.prototype = {
|
|||
this.showItem("context-sep-viewbgimage", showView && !this.inSyntheticDoc);
|
||||
this.setItemAttr("context-viewbgimage", "disabled", this.hasBGImage ? null : "true");
|
||||
|
||||
this.showItem("context-viewimageinfo", this.onImage);
|
||||
|
||||
// Hide Block and Unblock menuitems.
|
||||
this.showItem("context-blockimage", false);
|
||||
this.showItem("context-unblockimage", false);
|
||||
|
@ -964,6 +966,11 @@ nsContextMenu.prototype = {
|
|||
BrowserPageInfo();
|
||||
},
|
||||
|
||||
viewImageInfo: function() {
|
||||
BrowserPageInfo(this.target.ownerDocument.defaultView.top.document,
|
||||
"mediaTab", this.target);
|
||||
},
|
||||
|
||||
viewFrameInfo: function() {
|
||||
BrowserPageInfo(this.target.ownerDocument);
|
||||
},
|
||||
|
|
|
@ -2454,12 +2454,13 @@ function BrowserViewSource(aBrowser) {
|
|||
|
||||
// doc - document to use for source, or null for the current tab
|
||||
// initialTab - id of the initial tab to display, or null for the first tab
|
||||
function BrowserPageInfo(doc, initialTab)
|
||||
{
|
||||
// imageElement - image to load in the Media Tab of the Page Info window;
|
||||
// can be null/omitted
|
||||
function BrowserPageInfo(doc, initialTab, imageElement) {
|
||||
if (!doc)
|
||||
doc = window.content.document;
|
||||
var relatedUrl = doc.location.toString();
|
||||
var args = {doc: doc, initialTab: initialTab};
|
||||
var args = {doc: doc, initialTab: initialTab, imageElement: imageElement};
|
||||
|
||||
var enumerator = Services.wm.getEnumerator("Browser:page-info");
|
||||
// Check for windows matching the url
|
||||
|
|
|
@ -55,6 +55,8 @@ pageInfoTreeView.prototype = {
|
|||
{
|
||||
this.rows = this.data.push(row);
|
||||
this.rowCountChanged(this.rows - 1, 1);
|
||||
if (this.selection.count == 0 && this.rowCount && !gImageElement)
|
||||
this.selection.select(0);
|
||||
},
|
||||
|
||||
rowCountChanged: function(index, count)
|
||||
|
@ -155,6 +157,7 @@ pageInfoTreeView.prototype = {
|
|||
// mmm, yummy. global variables.
|
||||
var gWindow = null;
|
||||
var gDocument = null;
|
||||
var gImageElement = null;
|
||||
|
||||
// column number to help using the data array
|
||||
const COL_IMAGE_ADDRESS = 0;
|
||||
|
@ -339,6 +342,11 @@ function onLoadPageInfo()
|
|||
initView("linktree", gLinkView);
|
||||
initPermission();
|
||||
|
||||
// set gImageElement if present
|
||||
if ("arguments" in window && window.arguments.length >= 1 &&
|
||||
window.arguments[0].imageElement)
|
||||
gImageElement = window.arguments[0].imageElement;
|
||||
|
||||
// build the content
|
||||
loadPageInfo();
|
||||
|
||||
|
@ -550,6 +558,7 @@ function processFrames()
|
|||
var iterator = doc.createTreeWalker(doc, NodeFilter.SHOW_ELEMENT, grabAll, true);
|
||||
gFrameList.shift();
|
||||
setTimeout(doGrab, 10, iterator);
|
||||
onFinished.push(selectImage);
|
||||
}
|
||||
else
|
||||
onFinished.forEach(function(func) { func(); });
|
||||
|
@ -621,6 +630,8 @@ function onCacheEntryAvailable(cacheEntryDescriptor) {
|
|||
else {
|
||||
var i = gImageHash[url][type][alt];
|
||||
gImageView.data[i][COL_IMAGE_COUNT]++;
|
||||
if (elem == gImageElement)
|
||||
gImageView.data[i][COL_IMAGE_NODE] = elem;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1397,6 +1408,21 @@ function doSelectAll()
|
|||
elem.view.selection.selectAll();
|
||||
}
|
||||
|
||||
function selectImage() {
|
||||
if (!gImageElement)
|
||||
return;
|
||||
|
||||
var tree = document.getElementById("imagetree");
|
||||
for (var i = 0; i < tree.view.rowCount; i++) {
|
||||
if (gImageElement == gImageView.data[i][COL_IMAGE_NODE]) {
|
||||
tree.view.selection.select(i);
|
||||
tree.treeBoxObject.ensureRowIsVisible(i);
|
||||
tree.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onOpenIn(mode)
|
||||
{
|
||||
var linkList = getSelectedItems(true);
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
<!ENTITY reloadImageCmd.accesskey "R">
|
||||
<!ENTITY viewImageCmd.label "View Image">
|
||||
<!ENTITY viewImageCmd.accesskey "I">
|
||||
<!ENTITY viewImageInfoCmd.label "View Image Info">
|
||||
<!ENTITY viewImageInfoCmd.accesskey "f">
|
||||
<!ENTITY viewVideoCmd.label "View Video">
|
||||
<!ENTITY viewVideoCmd.accesskey "i">
|
||||
<!ENTITY viewBGImageCmd.label "View Background Image">
|
||||
|
|
Загрузка…
Ссылка в новой задаче