Bug 1843628 - Mutualise messageBody.css, and ignore CSS named pages when printing. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D185798

--HG--
extra : amend_source : dc6edaa53bf90af5c345419e06139acb7ed78721
extra : histedit_source : 41a2746f7de09bd0647c86f1e0851fe9b0498bb3
This commit is contained in:
Brendan Abolivier 2023-08-10 11:00:16 +01:00
Родитель 7322be9cd5
Коммит e212befa7e
7 изменённых файлов: 266 добавлений и 560 удалений

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

@ -19,10 +19,15 @@ var {
create_message,
mc,
select_click_row,
open_message_from_file,
} = ChromeUtils.import(
"resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
);
var { close_window } = ChromeUtils.import(
"resource://testing-common/mozmill/WindowHelpers.jsm"
);
var folder = null;
const SUBJECT0 = "How is the printing?";
@ -79,3 +84,31 @@ add_task(async function test_open_printpreview() {
() => !mc.window.document.querySelector(".printPreviewBrowser")
);
});
/**
* Test that the print preview generates correctly when the email use a CSS
* named page.
*/
add_task(async function test_named_page() {
const file = new FileUtils.File(
getTestFilePath(`data/bug1843628_named_page.eml`)
);
const msgc = await open_message_from_file(file);
EventUtils.synthesizeKey("P", { accelKey: true }, msgc.window);
let preview;
// Ensure we're showing the preview...
await BrowserTestUtils.waitForCondition(() => {
preview = msgc.window.document.querySelector(".printPreviewBrowser");
return preview && BrowserTestUtils.is_visible(preview);
});
Assert.equal(
preview.getAttribute("sheet-count"),
"1",
"preview should only include one page (and ignore the CSS named page)"
);
close_window(msgc);
});

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

@ -0,0 +1,28 @@
X-Identity-Key: id1
X-Account-Key: account2
Date: Tue, 18 Dec 2012 13:42:01 +0100
X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2
MIME-Version: 1.0
Subject: html test
X-Enigmail-Version: 1.5a1pre
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3DISO-8859-2">
<style>
@page mypage
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.mypage
{page:mypage;}
</style>
</head>
<body>
<div class=3D"mypage">
<p>Hello there!</p>
</div>
</body>
</html>

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

@ -2,200 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* ===== messageBody.css =================================================
== Styles for the body of a mail message.
======================================================================= */
@import url(chrome://messenger/skin/messageQuotes.css);
@namespace url("http://www.w3.org/1999/xhtml");
mailattachcount {
display: none;
}
/* :::: message header ::::: */
@media screen {
.moz-main-header,
.moz-main-header + br,
.moz-print-only {
display: none;
}
}
.moz-header-part1 {
background-color: #EFEFEF;
}
.moz-header-part2,
.moz-header-part3 {
background-color: #DEDEDE;
}
.moz-header-display-name {
display: inline;
font-weight: bold;
white-space: pre;
}
/* ::::: message text, incl. quotes ::::: */
.moz-text-flowed blockquote,
.moz-text-plain blockquote {
margin: 0;
}
.moz-text-plain pre {
margin: 0;
font-family: inherit;
}
.moz-text-plain[wrap="true"] {
white-space: pre-wrap;
}
.moz-text-plain[wrap="false"] {
white-space: pre;
}
.moz-text-plain[wrap="flow"] .moz-txt-sig {
white-space: pre-wrap;
}
.moz-text-plain[graphical-quote="false"] blockquote {
border-style: none;
padding: 0;
}
.moz-text-plain[graphical-quote="true"] .moz-txt-citetags {
display: none;
}
.moz-txt-underscore {
text-decoration: underline;
}
@import url("chrome://messenger/skin/shared/messageBody.css");
.moz-txt-formfeed {
display: block;
height: 100%;
}
/* ::::: images ::::: */
img[overflowing]:not([shrinktofit]) {
cursor: zoom-out;
width: auto !important;
}
img[overflowing][shrinktofit] {
cursor: zoom-in;
max-width: 100% !important;
height: auto !important;
}
@media print {
img[shrinktofit] {
max-width: 100% !important;
height: auto !important;
}
}
.moz-attached-image-container {
text-align: center;
}
/* ::::: vcard ::::: */
.moz-vcard-table {
margin-top: 10px;
border-radius: 3px;
box-shadow: 0 1px 3px hsla(0, 0%, 50%, 0.6);
}
.moz-vcard-property {
font-size: 80%;
color: gray;
}
.moz-vcard-badge {
margin-top: 2px;
height: 32px;
width: 32px;
background-image: url("chrome://messenger/skin/addressbook/icons/contact-generic.svg");
background-size: 100% 100%;
background-color: transparent;
display: block;
opacity: .7;
cursor: pointer;
}
.moz-vcard-badge:hover {
opacity: .8;
}
.moz-vcard-badge:active {
opacity: 1;
}
.moz-vcard-badge:focus {
outline: none;
}
/* Old style feeds, pre Tb3.0 */
#_mailrssiframe {
position: fixed;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
/* Attachment display styling (for inline attachments and printing) */
.moz-mime-attachment-header {
border-style: none;
border-top: 1px solid GrayText;
padding-block-start: 0.625em;
padding-block-end: 0.2em;
}
.moz-mime-attachment-header.moz-print-only {
margin-top: 1em;
}
.moz-mime-attachment-header-name {
color: GrayText;
font-size: 80%;
font-family: Arial, sans-serif;
}
.moz-mime-attachment-wrap {
padding: 0 1em;
}
.moz-mime-attachment-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.moz-mime-attachment-table tr + tr > td {
border-top: 1px solid GrayText;
padding-top: 0.25em;
}
.moz-mime-attachment-file {
word-wrap: break-word;
}
.moz-mime-attachment-size {
vertical-align: top;
width: 10ch;
text-align: right;
}
.moz-mime-attachment-file,
.moz-mime-attachment-size {
padding: 0 0 0.25em;
}

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

@ -2,66 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* ===== messageBody.css =================================================
== Styles for the body of a mail message.
======================================================================= */
@import url(chrome://messenger/skin/messageQuotes.css);
@namespace url("http://www.w3.org/1999/xhtml");
@import url("chrome://messenger/skin/shared/messageBody.css");
mailattachcount {
border: blue;
}
/* :::: message header ::::: */
@media screen {
.moz-main-header,
.moz-main-header + br,
.moz-print-only {
display: none;
}
}
.moz-header-part1 {
background-color: #EFEFEF;
}
.moz-header-part2,
.moz-header-part3 {
background-color: #DEDEDE;
}
.moz-header-display-name {
display: inline;
font-weight: bold;
white-space: pre;
}
/* ::::: message text, incl. quotes ::::: */
.moz-text-flowed blockquote,
.moz-text-plain blockquote {
margin: 0;
}
.moz-text-plain pre {
margin: inherit;
font-family: inherit;
}
.moz-text-plain[wrap="true"] {
white-space: pre-wrap;
}
.moz-text-plain[wrap="false"] {
white-space: pre;
}
.moz-text-plain[wrap="flow"] .moz-txt-sig {
white-space: pre-wrap;
}
.moz-text-plain[graphical-quote="false"] blockquote {
margin: inherit;
border-left: inherit;
@ -73,131 +26,3 @@ mailattachcount {
border-width: 2px;
border-color: gray;
}
.moz-text-plain[graphical-quote="true"] .moz-txt-citetags {
display: none;
}
.moz-txt-underscore {
text-decoration: underline;
}
/* ::::: images ::::: */
img[overflowing]:not([shrinktofit]) {
cursor: zoom-out;
width: auto !important;
}
img[overflowing][shrinktofit] {
cursor: zoom-in;
max-width: 100% !important;
height: auto !important;
}
@media print {
img[shrinktofit] {
max-width: 100% !important;
height: auto !important;
}
}
.moz-attached-image-container {
text-align: center;
}
/* ::::: vcard ::::: */
.moz-vcard-table {
margin-top: 10px;
border-radius: 3px;
box-shadow: 0 1px 3px hsla(0, 0%, 50%, 0.6);
}
.moz-vcard-property {
font-size: 80%;
color: gray;
}
.moz-vcard-badge {
margin-top: 2px;
height: 32px;
width: 32px;
background-image: url("chrome://messenger/skin/addressbook/icons/contact-generic.svg");
background-size: 100% 100%;
background-color: transparent;
display: block;
opacity: .7;
cursor: pointer;
}
.moz-vcard-badge:hover {
opacity: .8;
}
.moz-vcard-badge:active {
opacity: 1;
}
.moz-vcard-badge:focus {
outline: none;
}
/* Old style feeds, pre Tb3.0 */
#_mailrssiframe {
position: fixed;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
/* Attachment display styling (for inline attachments and printing) */
.moz-mime-attachment-header {
border-style: none;
border-top: 1px solid GrayText;
padding-block-start: 0.625em;
padding-block-end: 0.2em;
}
.moz-mime-attachment-header.moz-print-only {
margin-top: 1em;
}
.moz-mime-attachment-header-name {
color: GrayText;
font-size: 80%;
font-family: Arial, sans-serif;
}
.moz-mime-attachment-wrap {
padding: 0 1em;
}
.moz-mime-attachment-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.moz-mime-attachment-table tr + tr > td {
border-top: 1px solid GrayText;
padding-top: 0.25em;
}
.moz-mime-attachment-file {
word-wrap: break-word;
}
.moz-mime-attachment-size {
vertical-align: top;
width: 10ch;
text-align: right;
}
.moz-mime-attachment-file,
.moz-mime-attachment-size {
padding: 0 0 0.25em;
}

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

@ -385,6 +385,7 @@
skin/classic/messenger/shared/mailWindow1.css (../shared/mail/mailWindow1.css)
skin/classic/messenger/shared/menulist.css (../shared/mail/menulist.css)
skin/classic/messenger/shared/message-bar.css (../shared/mail/message-bar.css)
skin/classic/messenger/shared/messageBody.css (../shared/mail/messageBody.css)
skin/classic/messenger/shared/messageHeader.css (../shared/mail/messageHeader.css)
skin/classic/messenger/shared/messageIcons.css (../shared/mail/messageIcons.css)
skin/classic/messenger/shared/messenger.css (../shared/mail/messenger.css)

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

@ -0,0 +1,201 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* ===== messageBody.css =================================================
== Styles for the body of a mail message.
======================================================================= */
@import url(chrome://messenger/skin/messageQuotes.css);
@namespace url("http://www.w3.org/1999/xhtml");
mailattachcount {
display: none;
}
/* :::: message header ::::: */
@media screen {
.moz-main-header,
.moz-main-header + br,
.moz-print-only {
display: none;
}
}
.moz-header-part1 {
background-color: #EFEFEF;
}
.moz-header-part2,
.moz-header-part3 {
background-color: #DEDEDE;
}
.moz-header-display-name {
display: inline;
font-weight: bold;
white-space: pre;
}
/* ::::: message text, incl. quotes ::::: */
.moz-text-flowed blockquote,
.moz-text-plain blockquote {
margin: 0;
}
.moz-text-plain pre {
margin: 0;
font-family: inherit;
}
.moz-text-plain[wrap="true"] {
white-space: pre-wrap;
}
.moz-text-plain[wrap="false"] {
white-space: pre;
}
.moz-text-plain[wrap="flow"] .moz-txt-sig {
white-space: pre-wrap;
}
.moz-text-plain[graphical-quote="false"] blockquote {
border-style: none;
padding: 0;
}
.moz-text-plain[graphical-quote="true"] .moz-txt-citetags {
display: none;
}
.moz-txt-underscore {
text-decoration: underline;
}
/* Ignore named pages when printing. */
@media print {
* { page: auto !important; }
}
/* ::::: images ::::: */
img[overflowing]:not([shrinktofit]) {
cursor: zoom-out;
width: auto !important;
}
img[overflowing][shrinktofit] {
cursor: zoom-in;
max-width: 100% !important;
height: auto !important;
}
@media print {
img[shrinktofit] {
max-width: 100% !important;
height: auto !important;
}
}
.moz-attached-image-container {
text-align: center;
}
/* ::::: vcard ::::: */
.moz-vcard-table {
margin-top: 10px;
border-radius: 3px;
box-shadow: 0 1px 3px hsla(0, 0%, 50%, 0.6);
}
.moz-vcard-property {
font-size: 80%;
color: gray;
}
.moz-vcard-badge {
margin-top: 2px;
height: 32px;
width: 32px;
background-image: url("chrome://messenger/skin/addressbook/icons/contact-generic.svg");
background-size: 100% 100%;
background-color: transparent;
display: block;
opacity: .7;
cursor: pointer;
}
.moz-vcard-badge:hover {
opacity: .8;
}
.moz-vcard-badge:active {
opacity: 1;
}
.moz-vcard-badge:focus {
outline: none;
}
/* Old style feeds, pre Tb3.0 */
#_mailrssiframe {
position: fixed;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
/* Attachment display styling (for inline attachments and printing) */
.moz-mime-attachment-header {
border-style: none;
border-top: 1px solid GrayText;
padding-block-start: 0.625em;
padding-block-end: 0.2em;
}
.moz-mime-attachment-header.moz-print-only {
margin-top: 1em;
}
.moz-mime-attachment-header-name {
color: GrayText;
font-size: 80%;
font-family: Arial, sans-serif;
}
.moz-mime-attachment-wrap {
padding: 0 1em;
}
.moz-mime-attachment-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.moz-mime-attachment-table tr + tr > td {
border-top: 1px solid GrayText;
padding-top: 0.25em;
}
.moz-mime-attachment-file {
word-wrap: break-word;
}
.moz-mime-attachment-size {
vertical-align: top;
width: 10ch;
text-align: right;
}
.moz-mime-attachment-file,
.moz-mime-attachment-size {
padding: 0 0 0.25em;
}

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

@ -2,200 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* ===== messageBody.css =================================================
== Styles for the body of a mail message.
======================================================================= */
@import url(chrome://messenger/skin/messageQuotes.css);
@namespace url("http://www.w3.org/1999/xhtml");
mailattachcount {
display: none;
}
/* :::: message header ::::: */
@media screen {
.moz-main-header,
.moz-main-header + br,
.moz-print-only {
display: none;
}
}
.moz-header-part1 {
background-color: #EFEFEF;
}
.moz-header-part2,
.moz-header-part3 {
background-color: #DEDEDE;
}
.moz-header-display-name {
display: inline;
font-weight: bold;
white-space: pre;
}
/* ::::: message text, incl. quotes ::::: */
.moz-text-flowed blockquote,
.moz-text-plain blockquote {
margin: 0;
}
.moz-text-plain pre {
margin: 0;
font-family: inherit;
}
.moz-text-plain[wrap="true"] {
white-space: pre-wrap;
}
.moz-text-plain[wrap="false"] {
white-space: pre;
}
.moz-text-plain[wrap="flow"] .moz-txt-sig {
white-space: pre-wrap;
}
.moz-text-plain[graphical-quote="false"] blockquote {
border-style: none;
padding: 0;
}
.moz-text-plain[graphical-quote="true"] .moz-txt-citetags {
display: none;
}
.moz-txt-underscore {
text-decoration: underline;
}
@import url("chrome://messenger/skin/shared/messageBody.css");
.moz-txt-formfeed {
display: block;
height: 100%;
}
/* ::::: images ::::: */
img[overflowing]:not([shrinktofit]) {
cursor: zoom-out;
width: auto !important;
}
img[overflowing][shrinktofit] {
cursor: zoom-in;
max-width: 100% !important;
height: auto !important;
}
@media print {
img[shrinktofit] {
max-width: 100% !important;
height: auto !important;
}
}
.moz-attached-image-container {
text-align: center;
}
/* ::::: vcard ::::: */
.moz-vcard-table {
margin-top: 10px;
border-radius: 3px;
box-shadow: 0 1px 3px hsla(0, 0%, 50%, 0.6);
}
.moz-vcard-property {
font-size: 80%;
color: gray;
}
.moz-vcard-badge {
margin-top: 2px;
height: 32px;
width: 32px;
background-image: url("chrome://messenger/skin/addressbook/icons/contact-generic.svg");
background-size: 100% 100%;
background-color: transparent;
display: block;
opacity: .7;
cursor: pointer;
}
.moz-vcard-badge:hover {
opacity: .8;
}
.moz-vcard-badge:active {
opacity: 1;
}
.moz-vcard-badge:focus {
outline: none;
}
/* Old style feeds, pre Tb3.0 */
#_mailrssiframe {
position: fixed;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
/* Attachment display styling (for inline attachments and printing) */
.moz-mime-attachment-header {
border-style: none;
border-top: 1px solid GrayText;
padding-block-start: 0.625em;
padding-block-end: 0.2em;
}
.moz-mime-attachment-header.moz-print-only {
margin-top: 1em;
}
.moz-mime-attachment-header-name {
color: GrayText;
font-size: 80%;
font-family: Arial, sans-serif;
}
.moz-mime-attachment-wrap {
padding: 0 1em;
}
.moz-mime-attachment-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.moz-mime-attachment-table tr + tr > td {
border-top: 1px solid GrayText;
padding-top: 0.25em;
}
.moz-mime-attachment-file {
word-wrap: break-word;
}
.moz-mime-attachment-size {
vertical-align: top;
width: 10ch;
text-align: right;
}
.moz-mime-attachment-file,
.moz-mime-attachment-size {
padding: 0 0 0.25em;
}