mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-01 03:47:20 +02:00
The chrome is now authored against Firefox design-token names with the shipped value as a fallback `var(--fx-token, <literal>)` so colors, borders and radii follow Firefox instead of having to be re-synced by hand. In MOZCENTRAL viewer.css imports chrome://global/skin/design-system/tokens-brand.css, gated on the new pdfjs.enableNova pref (default false, read straight from CSS via -moz-pref()). With the pref off the sheet isn't applied, every fallback resolves, and the viewer renders as before, as it also does in the GENERIC and components builds, which never see the chrome sheet. Consuming a token means never declaring its name in an unlayered rule, which would shadow Firefox's for the whole subtree; --focus-outline, --border-color and --text-color/--button-border-color are therefore renamed to --editor-selection-outline, --signature-border-color and --views-*. In forced colors each state reads a matching background/foreground/border triple so it can't collapse to a single system color. The dialog button styling also moves out of `.dialog .mainContainer button` into a shared .primaryButton/.secondaryButton primitive (buttons.css, imported from pdf_viewer.css so the components build gets it too). The password, document-properties, print and undo-bar buttons use it in place of .dialogButton, and the custom radio appearance gives way to native controls tinted with accent-color.
275 lines
5.5 KiB
CSS
275 lines
5.5 KiB
CSS
/* Copyright 2014 Mozilla Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
@import url(pdf_viewer.css);
|
|
|
|
:root {
|
|
--main-color: light-dark(rgb(12 12 13), rgb(249 249 250));
|
|
--body-bg-color: light-dark(rgb(212 212 215), rgb(42 42 46));
|
|
--scrollbar-color: light-dark(auto, rgb(121 121 123));
|
|
--scrollbar-bg-color: light-dark(auto, rgb(35 35 39));
|
|
--field-color: light-dark(rgb(6 6 6), rgb(250 250 250));
|
|
--field-bg-color: light-dark(rgb(255 255 255), rgb(64 64 68));
|
|
--field-border-color: light-dark(rgb(187 187 188), rgb(115 115 115));
|
|
--doorhanger-bg-color: light-dark(rgb(255 255 255), rgb(74 74 79));
|
|
|
|
--toolbar-bg-color: light-dark(#f9f9fb, #2b2a33);
|
|
--toolbar-divider-color: light-dark(#e0e0e6, #5b5b66);
|
|
--toolbar-fg-color: light-dark(#15141a, #fbfbfe);
|
|
--toolbar-height: 48px;
|
|
--toolbar-border-width: 1px;
|
|
|
|
--toolbarButton-download-icon: url(images/gv-toolbarButton-download.svg);
|
|
}
|
|
|
|
@media screen and (forced-colors: active) {
|
|
:root {
|
|
--field-border-color: ButtonText;
|
|
--main-color: CanvasText;
|
|
}
|
|
}
|
|
|
|
* {
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
|
|
body {
|
|
background-color: var(--body-bg-color);
|
|
scrollbar-color: var(--scrollbar-color) var(--scrollbar-bg-color);
|
|
}
|
|
|
|
.hidden,
|
|
[hidden] {
|
|
display: none !important;
|
|
}
|
|
|
|
#outerContainer {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: relative;
|
|
}
|
|
|
|
#mainContainer {
|
|
position: absolute;
|
|
inset: 0;
|
|
min-width: 350px;
|
|
}
|
|
|
|
#viewerContainer {
|
|
overflow: auto;
|
|
position: absolute;
|
|
inset: var(--toolbar-height) 0 0;
|
|
outline: none;
|
|
}
|
|
|
|
#viewerContainer.noToolbar {
|
|
inset-block-start: 0;
|
|
}
|
|
|
|
.toolbarField {
|
|
padding: 4px 7px;
|
|
margin: 3px 0;
|
|
border-radius: 2px;
|
|
background-color: var(--field-bg-color);
|
|
background-clip: padding-box;
|
|
border: 1px solid var(--field-border-color);
|
|
box-shadow: none;
|
|
color: var(--field-color);
|
|
font-size: 12px;
|
|
line-height: 16px;
|
|
outline: none;
|
|
}
|
|
|
|
.toolbarField:focus {
|
|
border-color: #0a84ff;
|
|
}
|
|
|
|
#floatingToolbar {
|
|
display: flex;
|
|
align-items: center;
|
|
position: absolute;
|
|
width: 100%;
|
|
height: calc(var(--toolbar-height) + var(--toolbar-border-width));
|
|
top: 0;
|
|
left: 0;
|
|
padding: 2px;
|
|
box-sizing: border-box;
|
|
border-block-end: solid var(--toolbar-border-width)
|
|
var(--toolbar-divider-color);
|
|
background-color: var(--toolbar-bg-color);
|
|
|
|
&.show {
|
|
z-index: 100000;
|
|
opacity: 1;
|
|
}
|
|
|
|
&:not(.show) {
|
|
z-index: -1;
|
|
opacity: 0;
|
|
}
|
|
|
|
.toolbarButton {
|
|
display: flex;
|
|
align-items: center;
|
|
border-style: none;
|
|
user-select: none;
|
|
box-sizing: border-box;
|
|
background-color: transparent;
|
|
width: auto;
|
|
height: 100%;
|
|
outline: none;
|
|
position: relative;
|
|
|
|
&::before {
|
|
width: 24px;
|
|
height: 24px;
|
|
content: "";
|
|
background-color: var(--toolbar-fg-color);
|
|
mask-size: cover;
|
|
margin-inline: 12px 8px;
|
|
}
|
|
|
|
> span {
|
|
color: var(--toolbar-fg-color);
|
|
width: auto;
|
|
height: auto;
|
|
overflow: hidden;
|
|
}
|
|
|
|
&#download::before {
|
|
mask-image: var(--toolbarButton-download-icon);
|
|
}
|
|
}
|
|
}
|
|
|
|
dialog {
|
|
margin: auto;
|
|
padding: 15px;
|
|
border-spacing: 4px;
|
|
color: var(--main-color);
|
|
font: message-box;
|
|
font-size: 12px;
|
|
line-height: 14px;
|
|
background-color: var(--doorhanger-bg-color);
|
|
border: 1px solid rgb(0 0 0 / 0.5);
|
|
border-radius: 4px;
|
|
box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
|
|
}
|
|
dialog::backdrop {
|
|
background-color: rgb(0 0 0 / 0.2);
|
|
}
|
|
|
|
dialog > .row {
|
|
display: table-row;
|
|
}
|
|
|
|
dialog > .row > * {
|
|
display: table-cell;
|
|
}
|
|
|
|
dialog .toolbarField {
|
|
margin: 5px 0;
|
|
}
|
|
|
|
dialog .separator {
|
|
display: block;
|
|
margin: 4px 0;
|
|
height: 0;
|
|
width: 100%;
|
|
border-top: 1px solid var(--separator-color);
|
|
border-bottom: none;
|
|
}
|
|
|
|
dialog .buttonRow {
|
|
text-align: center;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
dialog :link {
|
|
color: rgb(255 255 255);
|
|
}
|
|
|
|
#passwordDialog {
|
|
text-align: center;
|
|
}
|
|
#passwordDialog .toolbarField {
|
|
width: 200px;
|
|
}
|
|
|
|
@page {
|
|
margin: 0;
|
|
}
|
|
|
|
#printContainer {
|
|
display: none;
|
|
}
|
|
|
|
@media print {
|
|
body {
|
|
background: rgb(0 0 0 / 0) none;
|
|
}
|
|
body[data-pdfjsprinting] #outerContainer {
|
|
display: none;
|
|
}
|
|
body[data-pdfjsprinting] #printContainer {
|
|
display: block;
|
|
}
|
|
#printContainer {
|
|
height: 100%;
|
|
}
|
|
/* wrapper around (scaled) print canvas elements */
|
|
#printContainer > .printedPage {
|
|
page-break-after: always;
|
|
page-break-inside: avoid;
|
|
|
|
/* The wrapper always cover the whole page. */
|
|
height: 100%;
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
#printContainer > .xfaPrintedPage .xfaPage {
|
|
position: absolute;
|
|
}
|
|
|
|
#printContainer > .xfaPrintedPage {
|
|
page-break-after: always;
|
|
page-break-inside: avoid;
|
|
width: 100%;
|
|
height: 100%;
|
|
position: relative;
|
|
}
|
|
|
|
#printContainer > .printedPage :is(canvas, img) {
|
|
/* The intrinsic canvas / image size will make sure that we fit the page. */
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
|
|
direction: ltr;
|
|
display: block;
|
|
}
|
|
}
|