commit a982c54cf9162509a9f4093884caeeb8d0d94f0c
parent 9c0b467506bc78c626f71c3d9fb2e7330d09ed6a
Author: Mason <31372737+Ovaculos@users.noreply.github.com>
Date: Wed, 22 Oct 2025 21:02:44 +0000
Bug 1958780 - <pre>s use monospace without effecting plain text documents. r=desktop-theme-reviewers,Gijs,emilio
Differential Revision: https://phabricator.services.mozilla.com/D259318
Diffstat:
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/toolkit/components/reader/AboutReader.sys.mjs b/toolkit/components/reader/AboutReader.sys.mjs
@@ -1505,6 +1505,9 @@ AboutReader.prototype = {
this._maybeSetTextDirection(article);
this._languageDeferred.resolve(article.detectedLanguage);
+ if (article.textPlainDoc) {
+ this._contentElement.classList.add("plain-text-doc");
+ }
this._contentElement.classList.add("reader-show-element");
this._updateImageMargins();
this._updateWideTables();
diff --git a/toolkit/components/reader/ReaderMode.sys.mjs b/toolkit/components/reader/ReaderMode.sys.mjs
@@ -248,6 +248,7 @@ export var ReaderMode = {
}
let article = await this._readerParse(doc);
+ article.textPlainDoc = result.textPlainDoc;
// If we have to redirect, reject to the caller with the parsed article,
// so we can update the URL before displaying it.
if (newURL) {
@@ -328,6 +329,9 @@ export var ReaderMode = {
);
let result = { doc };
+ if (xhr.responseType != "document") {
+ result.textPlainDoc = true;
+ }
if (responseURL != givenURL) {
result.newURL = xhr.responseURL;
}
diff --git a/toolkit/themes/shared/aboutReader.css b/toolkit/themes/shared/aboutReader.css
@@ -980,7 +980,11 @@ div[name="customtheme"] {
}
pre {
- font-family: inherit;
+ font-family: monospace;
+
+ .plain-text-doc & {
+ font-family: inherit;
+ }
}
.moz-reader-content {