Commit ee7b8d78 authored by Fred Chasen's avatar Fred Chasen
Browse files

Bug 1798965 - Use classes for simplified print mode generated content. r=mstriemer, a=RyanVM

Updates to using the classes defined in CSS instead of Ids when generating the HTML content for the simplified print mode.

Sets padding to 0 for the body to allow customizing the margins in the print dialog.

Differential Revision: https://phabricator.services.mozilla.com/D162914
parent f63abdc9
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ class PrintingChild extends JSWindowActorChild {

      // Create container div (main element) and append it to body
      let containerElement = document.createElement("div");
      containerElement.setAttribute("id", "container");
      containerElement.setAttribute("class", "container");
      document.body.appendChild(containerElement);

      // Reader Mode might return null if there's a failure when parsing the document.
@@ -196,19 +196,18 @@ class PrintingChild extends JSWindowActorChild {

        // Create header div and append it to container
        let headerElement = document.createElement("div");
        headerElement.setAttribute("id", "reader-header");
        headerElement.setAttribute("class", "reader-header");
        headerElement.setAttribute("class", "header");
        containerElement.appendChild(headerElement);

        // Jam the article's title and byline into header div
        let titleElement = document.createElement("h1");
        titleElement.setAttribute("id", "reader-title");
        titleElement.setAttribute("class", "reader-title");
        titleElement.textContent = article.title;
        headerElement.appendChild(titleElement);

        let bylineElement = document.createElement("div");
        bylineElement.setAttribute("id", "reader-credits");
        bylineElement.setAttribute("class", "credits");
        bylineElement.setAttribute("class", "reader-credits credits");
        bylineElement.textContent = article.byline;
        headerElement.appendChild(bylineElement);

@@ -222,7 +221,7 @@ class PrintingChild extends JSWindowActorChild {

        // Jam the article's content into content div
        let readerContent = document.createElement("div");
        readerContent.setAttribute("id", "moz-reader-content");
        readerContent.setAttribute("class", "moz-reader-content");
        contentElement.appendChild(readerContent);

        let articleUri = Services.io.newURI(article.url);
+7 −3
Original line number Diff line number Diff line
@@ -7,13 +7,17 @@
 * already exist in aboutReader.css, however, we decoupled it from the original
 * file so we don't need to load a bunch of extra queries that will not take
 * effect when using the simplify page checkbox. */
:root {
  --font-size: 16px;
  --content-width: 30em;
  --line-height: 1.6em;
}

body {
  padding-top: 0px;
  padding-bottom: 0px;
  padding: 0px;
}

#container {
.container {
  max-width: 100%;
  font-family: Georgia, "Times New Roman", serif;
}