Bug 377364 - Page Info: Suppress the jumping in the bottom half of the Media tab. Improve consistency with the Element Properties Window. r=Mano, ui-r=beltzner, a1.9=beltzner

This commit is contained in:
florian@queze.net 2008-01-23 17:22:37 -08:00
Родитель 2ff0cec3e8
Коммит 7b278f2ce2
7 изменённых файлов: 106 добавлений и 116 удалений

Просмотреть файл

@ -823,97 +823,87 @@ function makePreview(row)
{
var imageTree = document.getElementById("imagetree");
var item = getSelectedImage(imageTree);
var col = imageTree.columns["image-address"];
var url = gImageView.getCellText(row, col);
// image-bg
var url = gImageView.data[row][COL_IMAGE_ADDRESS];
var isBG = gImageView.data[row][COL_IMAGE_BG];
setItemValue("imageurltext", url);
if (item.hasAttribute("title"))
setItemValue("imagetitletext", item.title);
else
setItemValue("imagetitletext", null);
if (item.hasAttribute("longDesc"))
setItemValue("imagelongdesctext", item.longDesc);
else
setItemValue("imagelongdesctext", null);
if (item.hasAttribute("alt"))
setItemValue("imagealttext", item.alt);
else if (item instanceof HTMLImageElement || isBG)
setItemValue("imagealttext", null);
else
setItemValue("imagealttext", getValueText(item));
var imageText;
if (!isBG &&
#ifdef MOZ_SVG
if (item instanceof SVGImageElement) {
setItemValue("imagetitletext", null);
setItemValue("imagelongdesctext", null);
setItemValue("imagealttext", null);
}
!(item instanceof SVGImageElement) &&
#endif
!(gDocument instanceof ImageDocument)) {
imageText = item.title || item.alt;
if (!imageText && !(item instanceof HTMLImageElement))
imageText = getValueText(item);
}
setItemValue("imagetext", imageText);
setItemValue("imagelongdesctext", item.longDesc);
// get cache info
var sourceText = gBundle.getString("generalNotCached");
var cacheKey = url.replace(/#.*$/, "");
try {
// open for READ, in non-blocking mode
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, ACCESS_READ, false);
if (cacheEntryDescriptor)
switch (cacheEntryDescriptor.deviceID) {
case "disk":
sourceText = gBundle.getString("generalDiskCache");
break;
case "memory":
sourceText = gBundle.getString("generalMemoryCache");
break;
default:
sourceText = cacheEntryDescriptor.deviceID;
break;
}
}
catch(ex) {
try {
// open for READ, in non-blocking mode
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(cacheKey, ACCESS_READ, false);
if (cacheEntryDescriptor)
switch (cacheEntryDescriptor.deviceID) {
case "disk":
sourceText = gBundle.getString("generalDiskCache");
break;
case "memory":
sourceText = gBundle.getString("generalMemoryCache");
break;
default:
sourceText = cacheEntryDescriptor.deviceID;
break;
}
}
catch(ex2) { }
}
setItemValue("imagesourcetext", sourceText);
// find out the file size
var sizeText;
if (cacheEntryDescriptor) {
var pageSize = cacheEntryDescriptor.dataSize;
var kbSize = Math.round(pageSize / 1024 * 100) / 100;
var imageSize = cacheEntryDescriptor.dataSize;
var kbSize = Math.round(imageSize / 1024 * 100) / 100;
sizeText = gBundle.getFormattedString("generalSize",
[formatNumber(kbSize), formatNumber(pageSize)]);
[formatNumber(kbSize), formatNumber(imageSize)]);
}
else
sizeText = gBundle.getString("mediaUnknownNotCached");
setItemValue("imagesizetext", sizeText);
var mimeType;
var numFrames = 1;
if (item instanceof HTMLObjectElement ||
item instanceof HTMLEmbedElement ||
item instanceof HTMLLinkElement)
mimeType = item.type;
if (!mimeType)
mimeType = getContentTypeFromImgRequest(item) ||
getContentTypeFromHeaders(cacheEntryDescriptor);
if (!mimeType && item instanceof nsIImageLoadingContent) {
var imageRequest = item.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
if (imageRequest) {
mimeType = imageRequest.mimeType;
var image = imageRequest.image;
if (image)
numFrames = image.numFrames;
}
}
if (!mimeType)
mimeType = getContentTypeFromHeaders(cacheEntryDescriptor);
if (mimeType) {
// We found the type, try to display it nicely
var imageMimeType = /^image\/(.*)/.exec(mimeType);
if (imageMimeType) {
mimeType = imageMimeType[1].toUpperCase();
if (numFrames > 1)
mimeType = gBundle.getFormattedString("mediaAnimatedImageType",
[mimeType, numFrames]);
else
mimeType = gBundle.getFormattedString("mediaImageType", [mimeType]);
}
}
else {
// We couldn't find the type, fall back to the value in the treeview
mimeType = gImageView.data[row][COL_IMAGE_TYPE];
}
setItemValue("imagetypetext", mimeType);
var imageContainer = document.getElementById("theimagecontainer");
@ -974,18 +964,21 @@ function makePreview(row)
}
var imageSize = "";
if (url)
imageSize = gBundle.getFormattedString("mediaSize",
[formatNumber(width),
formatNumber(height)]);
setItemValue("imageSize", imageSize);
var physSize = "";
if (width != physWidth || height != physHeight)
physSize = gBundle.getFormattedString("mediaSize",
[formatNumber(physWidth),
formatNumber(physHeight)]);
setItemValue("physSize", physSize);
if (url) {
if (width != physWidth || height != physHeight) {
imageSize = gBundle.getFormattedString("mediaDimensionsScaled",
[formatNumber(physWidth),
formatNumber(physHeight),
formatNumber(width),
formatNumber(height)]);
}
else {
imageSize = gBundle.getFormattedString("mediaDimensions",
[formatNumber(width),
formatNumber(height)]);
}
}
setItemValue("imagedimensiontext", imageSize);
makeBlockImage(url);
@ -1047,21 +1040,6 @@ function getContentTypeFromHeaders(cacheEntryDescriptor)
.exec(cacheEntryDescriptor.getMetaDataElement("response-head")))[1];
}
function getContentTypeFromImgRequest(item)
{
var httpRequest;
try {
var imageItem = item.QueryInterface(nsIImageLoadingContent);
var imageRequest = imageItem.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
if (imageRequest)
httpRequest = imageRequest.mimeType;
}
catch (ex) { } // This never happened. ;)
return httpRequest;
}
//******** Other Misc Stuff
// Modified from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
// parse a node to extract the contents of the node

Просмотреть файл

@ -232,57 +232,42 @@
</tree>
<splitter orient="vertical" id="mediaSplitter"/>
<vbox flex="1" id="mediaPreviewBox" collapsed="true">
<grid>
<grid id="mediaGrid">
<columns>
<column/>
<column id="mediaLabelColumn"/>
<column class="gridSeparator"/>
<column flex="1"/>
</columns>
<rows>
<row>
<label control="imageurltext" value="&mediaURL;"/>
<label control="imageurltext" value="&mediaLocation;"/>
<separator/>
<textbox readonly="true" id="imageurltext"/>
</row>
<row>
<label control="imagetitletext" value="&mediaTitle;"/>
<separator/>
<textbox readonly="true" id="imagetitletext"/>
</row>
<row>
<label control="imagealttext" value="&mediaAlt;"/>
<separator/>
<textbox readonly="true" id="imagealttext"/>
</row>
<row>
<label control="imagelongdesctext" value="&mediaLongdesc;"/>
<separator/>
<textbox readonly="true" id="imagelongdesctext"/>
</row>
<row>
<label control="imagetypetext" value="&generalType;"/>
<separator/>
<textbox readonly="true" id="imagetypetext"/>
</row>
<row>
<label control="imagesourcetext" value="&generalSource;"/>
<separator/>
<textbox readonly="true" id="imagesourcetext"/>
</row>
<row>
<label control="imagesizetext" value="&generalSize;"/>
<separator/>
<textbox readonly="true" id="imagesizetext"/>
</row>
<row>
<label control="imageSize" value="&mediaDimensions;"/>
<label control="imagedimensiontext" value="&mediaDimension;"/>
<separator/>
<textbox readonly="true" id="imageSize"/>
<textbox readonly="true" id="imagedimensiontext"/>
</row>
<row>
<label control="physSize" value="&mediaPhysDimensions;"/>
<label control="imagetext" value="&mediaText;"/>
<separator/>
<textbox readonly="true" id="physSize"/>
<textbox readonly="true" id="imagetext"/>
</row>
<row>
<label control="imagelongdesctext" value="&mediaLongdesc;"/>
<separator/>
<textbox readonly="true" id="imagelongdesctext"/>
</row>
</rows>
</grid>

Просмотреть файл

@ -65,16 +65,14 @@
<!ENTITY mediaTab "Media">
<!ENTITY mediaTab.accesskey "M">
<!ENTITY mediaURL "Address:">
<!ENTITY mediaAlt "Alternate Text:">
<!ENTITY mediaLocation "Location:">
<!ENTITY mediaText "Associated Text:">
<!ENTITY mediaAltHeader "Alternate Text">
<!ENTITY mediaAddress "Address">
<!ENTITY mediaType "Type">
<!ENTITY mediaSize "Size">
<!ENTITY mediaCount "Count">
<!ENTITY mediaDimensions "Specified Dimensions:">
<!ENTITY mediaPhysDimensions "Actual Dimensions:">
<!ENTITY mediaTitle "Title:">
<!ENTITY mediaDimension "Dimensions:">
<!ENTITY mediaLongdesc "Long Description:">
<!ENTITY mediaBlockImage.accesskey "B">
<!ENTITY mediaSaveAs "Save As…">

Просмотреть файл

@ -57,6 +57,11 @@ mediaFileSize=%S KB
mediaSize=%Spx \u00D7 %Spx
mediaSelectFolder=Select a Folder to Save the Images
mediaBlockImage=Block Images from %S
mediaUnknownNotCached=Unknown (not cached)
mediaImageType=%S Image
mediaAnimatedImageType=%S Image (animated, %S frames)
mediaDimensions=%Spx \u00D7 %Spx
mediaDimensionsScaled=%Spx \u00D7 %Spx (scaled to %Spx \u00D7 %Spx)
generalQuirksMode=Quirks mode
generalStrictMode=Standards compliance mode

Просмотреть файл

@ -179,6 +179,14 @@ groupbox.treebox .groupbox-body {
min-height: 10em;
}
#mediaGrid {
min-height: 9em;
}
#mediaLabelColumn {
min-width: 10em;
}
#thepreviewimage {
margin: 1em;
}

Просмотреть файл

@ -170,6 +170,14 @@ groupbox.treebox .groupbox-body {
min-height: 10em;
}
#mediaGrid {
min-height: 9em;
}
#mediaLabelColumn {
min-width: 10em;
}
#thepreviewimage {
margin: 1em;
}

Просмотреть файл

@ -177,6 +177,14 @@ groupbox.treebox .groupbox-body {
min-height: 10em;
}
#mediaGrid {
min-height: 9em;
}
#mediaLabelColumn {
min-width: 10em;
}
#thepreviewimage {
margin: 1em;
}