Bug 1610180 - set max-height on #attachmentList to make it scrollable. r=mkmelin

This commit is contained in:
Ping Chen 2020-04-01 13:52:25 +03:00
Родитель f6b943b159
Коммит d1ea2739a9
1 изменённых файлов: 8 добавлений и 12 удалений

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

@ -2915,21 +2915,18 @@ function toggleAttachmentList(expanded, updateFocus) {
attachmentList.setOptimumWidth();
var attachmentHeight =
let attachmentBarHeight =
attachmentView.getBoundingClientRect().height -
attachmentList.getBoundingClientRect().height +
attachmentList.preferredHeight;
attachmentList.getBoundingClientRect().height;
// If the attachments box takes up too much of the message pane, downsize:
var maxAttachmentHeight =
// By design, attachmentView should not take up more than 1/4 of the message
// pane space
let maxAttachmentHeight =
document.getElementById("messagepanebox").getBoundingClientRect().height /
4;
attachmentView.setAttribute(
"height",
Math.min(attachmentHeight, maxAttachmentHeight)
);
attachmentView.setAttribute("maxheight", attachmentHeight);
attachmentList.style.maxHeight =
maxAttachmentHeight - attachmentBarHeight + "px";
if (updateFocus) {
attachmentList.focus();
@ -2941,8 +2938,7 @@ function toggleAttachmentList(expanded, updateFocus) {
"tooltiptext",
bundle.getString("expandAttachmentPaneTooltip")
);
attachmentView.removeAttribute("height");
attachmentView.removeAttribute("maxheight");
attachmentList.style.maxHeight = "";
if (updateFocus && document.activeElement == attachmentList) {
SetFocusMessagePane();