tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

content-area.css (16998B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 @namespace html url("http://www.w3.org/1999/xhtml");
      6 
      7 :root {
      8  /* --tabpanel-background-color matches $in-content-page-background in newtab
      9     (browser/extensions/newtab/content-src/styles/_variables.scss) */
     10  --tabpanel-background-color: #f9f9fb;
     11  @media (-moz-content-prefers-color-scheme: dark) {
     12    --tabpanel-background-color: #2b2a33;
     13  }
     14  &[privatebrowsingmode="temporary"] {
     15    /* Value for --background-color-canvas in aboutPrivateBrowsing.css.
     16       !important overrides the direct setting of this variable in
     17       ThemeVariableMap.sys.mjs when the user has a theme that defines
     18       ntp_background. */
     19    --tabpanel-background-color: #25003e !important;
     20 
     21    /* stylelint-disable-next-line media-query-no-invalid */
     22    @media -moz-pref("browser.privatebrowsing.felt-privacy-v1") {
     23      --tabpanel-background-color: linear-gradient(45deg, #722291 0%, #45278d 50%, #393473 100%) !important;
     24    }
     25  }
     26 }
     27 
     28 #navigator-toolbox {
     29  border-bottom: 0.01px solid var(--chrome-content-separator-color);
     30 
     31  /* stylelint-disable-next-line media-query-no-invalid */
     32  @media -moz-pref("sidebar.revamp") {
     33    /* This reserves space for the content area outline */
     34    border-bottom-color: var(--toolbar-bgcolor);
     35  }
     36 
     37  /* stylelint-disable-next-line media-query-no-invalid */
     38  @media -moz-pref("sidebar.verticalTabs") {
     39    border-bottom-style: none;
     40  }
     41 }
     42 
     43 /* Needed to ensure #sidebar-wrapper is full height when vertical tabs are not enabled */
     44 #browser {
     45  position: relative;
     46 }
     47 
     48 #browser,
     49 #tabbrowser-tabbox,
     50 #tabbrowser-tabpanels,
     51 .browserSidebarContainer {
     52  /* Allow devtools with large specified width/height to shrink */
     53  min-width: 0;
     54  min-height: 0;
     55 }
     56 
     57 #browser:not(.browser-toolbox-background) {
     58  background-color: var(--toolbar-bgcolor);
     59  color: var(--toolbar-color);
     60 
     61  :root[lwtheme] & {
     62    /* Ensure toolbar color displays on top of the frame/toolbox color to
     63    * guarantee full opacity */
     64    background-color: var(--lwt-accent-color);
     65    background-image: linear-gradient(var(--toolbar-bgcolor), var(--toolbar-bgcolor));
     66  }
     67 }
     68 
     69 #tabbrowser-tabbox {
     70  position: relative;
     71  z-index: var(--browser-area-z-index-tabbox);
     72  margin: 0;
     73 }
     74 
     75 /* We set large flex on both containers to allow the devtools toolbox to
     76 * set a flex value itself. We don't want the toolbox to actually take up free
     77 * space, but we do want it to collapse when the window shrinks, and with
     78 * flex: 0 it can't.
     79 *
     80 * When the toolbox is on the bottom it's a sibling of browserStack, and when
     81 * it's on the side it's a sibling of browserContainer.
     82 */
     83 .browserContainer {
     84  flex: 10000 10000;
     85  /* To contain the status panel */
     86  position: relative;
     87 
     88  /* .browserContainer only contains the devtools when docked horizontally */
     89  min-height: 0;
     90 
     91  /* We want to be able to show the frame color behind the clipped radiused corner */
     92  background: var(--tabpanel-background-color);
     93 
     94  /* stylelint-disable-next-line media-query-no-invalid */
     95  @media -moz-pref("sidebar.revamp") {
     96    outline: 0.01px solid var(--chrome-content-separator-color);
     97    box-shadow: var(--content-area-shadow);
     98  }
     99 
    100  /* stylelint-disable-next-line media-query-no-invalid */
    101  @media -moz-pref("sidebar.revamp") and -moz-pref("sidebar.revamp.round-content-area") {
    102    overflow: clip;
    103 
    104    :root:not([inDOMFullscreen]) #tabbrowser-tabbox[sidebar-shown] & {
    105      /* stylelint-disable-next-line media-query-no-invalid */
    106      @media -moz-pref("sidebar.position_start") {
    107        border-start-start-radius: var(--border-radius-medium);
    108      }
    109      /* stylelint-disable-next-line media-query-no-invalid */
    110      @media not -moz-pref("sidebar.position_start") {
    111        border-start-end-radius: var(--border-radius-medium);
    112      }
    113    }
    114  }
    115 }
    116 
    117 .browserSidebarContainer {
    118  position: absolute;
    119  inset: 0;
    120 }
    121 
    122 .sidebar-browser-stack {
    123  flex: 1;
    124 }
    125 
    126 .browserStack {
    127  flex: 10000 10000;
    128  /* Prevent shrinking the page content to 0 height and width */
    129  min-height: 25px;
    130  min-width: 25px;
    131 }
    132 
    133 #tabbrowser-tabpanels {
    134  appearance: none;
    135  padding: 0;
    136  color-scheme: unset;
    137  display: flex;
    138 
    139  &[pendingpaint] {
    140    background-image: url("chrome://global/skin/icons/pendingpaint.png");
    141    background-repeat: no-repeat;
    142    background-position: center center;
    143    background-size: 30px;
    144  }
    145 
    146  browser:is([blank], [pendingpaint]) {
    147    opacity: 0;
    148  }
    149 
    150  browser[type="content"] {
    151    color-scheme: env(-moz-content-preferred-color-scheme);
    152  }
    153 
    154  browser[tabDialogShowing] {
    155    -moz-user-focus: none !important;
    156  }
    157 
    158  .split-view-panel {
    159    --panel-min-width: 140px;
    160    min-width: var(--panel-min-width);
    161    max-width: calc(100% - var(--panel-min-width));
    162    flex: 1;
    163    width: 49.4%;
    164  }
    165 
    166  &[splitview] {
    167    .split-view-panel.split-view-panel-active {
    168      margin: var(--space-xsmall);
    169      position: relative;
    170      width: unset;
    171    }
    172 
    173    /* Ensure any dialogs are clipped in an inactive/not-selected panel. */
    174    :root:not([inDOMFullscreen]) & > .split-view-panel:not(.deck-selected) {
    175      overflow: clip;
    176    }
    177 
    178    /* Ensure split view panels can display in fullscreen mode */
    179    :root[inDOMFullscreen] & > .split-view-panel-active:not(.deck-selected) {
    180      -moz-subtree-hidden-only-visually: 1;
    181    }
    182 
    183    :root[inDOMFullscreen] & > .split-view-splitter {
    184      display: none;
    185    }
    186 
    187    :root[inDOMFullscreen] & > .split-view-panel-active.deck-selected {
    188      margin: 0;
    189      position: absolute;
    190      max-width: none;
    191 
    192      & > .browserContainer {
    193        border-radius: 0;
    194      }
    195    }
    196 
    197    .browserContainer {
    198      border-radius: var(--border-radius-medium);
    199      overflow: clip;
    200      outline: var(--border-width) solid var(--border-color);
    201 
    202      /* The selected panel's dialogs need to sit above the non-selected tab panels. */
    203      .deck-selected > & {
    204        z-index: 1;
    205        outline: var(--focus-outline);
    206      }
    207    }
    208 
    209    .split-view-panel[column="0"] {
    210      order: 0;
    211      margin-inline-end: 0;
    212    }
    213 
    214    .split-view-splitter {
    215      order: 1;
    216      flex: none;
    217    }
    218 
    219    .split-view-panel[column="1"] {
    220      order: 2;
    221      margin-inline-start: 0;
    222    }
    223 
    224    /* Panels with a custom width shouldn't grow. */
    225    .split-view-panel[width] {
    226      flex: none;
    227    }
    228 
    229    /* Display split view footer within inactive panels. */
    230    .split-view-panel:not(.deck-selected) > .browserContainer > .browserStack > split-view-footer {
    231      display: flex;
    232 
    233      &[hidden] {
    234        display: none;
    235      }
    236    }
    237  }
    238 }
    239 
    240 /* Split view */
    241 
    242 split-view-footer {
    243  max-width: calc(100% - var(--space-xsmall));
    244  display: none;
    245  position: absolute;
    246  inset-block-end: 0;
    247  inset-inline-end: 0;
    248 
    249  border-block-start: 1px solid var(--border-color);
    250  border-inline-start: 1px solid var(--border-color);
    251  border-start-start-radius: var(--border-radius-medium);
    252  border-start-end-radius: 0;
    253  border-end-end-radius: var(--border-radius-medium);
    254  border-end-start-radius: 0;
    255 
    256  padding-block: var(--space-xxsmall);
    257  padding-inline: var(--space-small) var(--space-xsmall);
    258 
    259  -moz-context-properties: fill;
    260  fill: var(--button-icon-fill);
    261 }
    262 
    263 .split-view-icon {
    264  width: var(--icon-size);
    265  height: var(--icon-size);
    266 }
    267 
    268 .split-view-uri {
    269  overflow: hidden;
    270  text-overflow: ellipsis;
    271 }
    272 
    273 split-view-footer,
    274 .split-view-security-warning {
    275  align-items: center;
    276  gap: var(--space-small);
    277  white-space: nowrap;
    278 }
    279 
    280 /* Status panel */
    281 
    282 #statuspanel {
    283  &:not([hidden]) {
    284    max-width: calc(100% - 5px);
    285    pointer-events: none;
    286 
    287    /* Take a bit more space vertically for the mouse tracker to hit us more
    288     * easily */
    289    padding-top: 2em;
    290 
    291    position: absolute;
    292    bottom: 0;
    293    left: 0;
    294  }
    295 
    296  &:not([mirror]):-moz-locale-dir(rtl),
    297  &[mirror]:-moz-locale-dir(ltr) {
    298    left: auto;
    299    right: 0;
    300  }
    301 
    302  &[sizelimit] {
    303    max-width: 50%;
    304  }
    305 
    306  &[type="status"] {
    307    min-width: min(23em, 33%);
    308  }
    309 
    310  &[type="letterboxingStatus"],
    311  &[type="overLink"] {
    312    transition:
    313      opacity 120ms ease-out,
    314      visibility 120ms;
    315  }
    316 
    317  &:is([type="overLink"], [inactive][previoustype="overLink"]) {
    318    direction: ltr;
    319  }
    320 
    321  .browserStack:not(.letterboxingStatus) &[type="letterboxingStatus"],
    322  .exclude-letterboxing &[type="letterboxingStatus"],
    323  &[inactive],
    324  :root[inDOMFullscreen] &:not([type="overLink"]) {
    325    transition: none;
    326    opacity: 0;
    327    visibility: hidden;
    328 
    329    &[previoustype="letterboxingStatus"],
    330    &[previoustype="overLink"] {
    331      transition:
    332        opacity 200ms ease-out,
    333        visibility 200ms;
    334    }
    335  }
    336 
    337  /* stylelint-disable-next-line media-query-no-invalid */
    338  @media -moz-pref("browser.tabs.hideStatusPanel") {
    339    visibility: hidden;
    340  }
    341 
    342  /* Ensure that this appears on top of the split view footer. */
    343  .split-view-panel & {
    344    z-index: 1;
    345  }
    346 }
    347 
    348 #statuspanel-label,
    349 split-view-footer {
    350  color-scheme: env(-moz-content-preferred-color-scheme);
    351  background-color: -moz-dialog;
    352  border-color: ThreeDShadow;
    353  color: -moz-dialogText;
    354  text-shadow: none;
    355 
    356  @media (not (prefers-contrast)) and (not (-moz-platform: linux)) {
    357    background-color: light-dark(#f9f9fa, hsl(240, 1%, 20%));
    358    border-color: light-dark(#ddd, hsl(240, 1%, 40%));
    359    color: light-dark(#444, rgb(249, 249, 250));
    360  }
    361 }
    362 
    363 #statuspanel-label {
    364  margin: 0;
    365  padding: 2px 4px;
    366  border-width: 1px;
    367  border-style: none;
    368  border-top-style: solid;
    369 
    370  #statuspanel:not([mirror]) > &:-moz-locale-dir(ltr),
    371  #statuspanel[mirror] > &:-moz-locale-dir(rtl) {
    372    border-right-style: solid;
    373    /* disabled on Windows for triggering grayscale AA (bug 659213): */
    374    @media not (-moz-platform: windows) {
    375      border-top-right-radius: 0.3em;
    376    }
    377    margin-right: 1em;
    378  }
    379 
    380  #statuspanel:not([mirror]) > &:-moz-locale-dir(rtl),
    381  #statuspanel[mirror] > &:-moz-locale-dir(ltr) {
    382    border-left-style: solid;
    383    /* disabled on Windows for triggering grayscale AA (bug 659213): */
    384    @media not (-moz-platform: windows) {
    385      border-top-left-radius: 0.3em;
    386    }
    387    margin-left: 1em;
    388  }
    389 }
    390 
    391 #statuspanel:is([type="letterboxingStatus"], [previoustype="letterboxingStatus"][inactive]) > #statuspanel-label {
    392  background-image: url("chrome://browser/skin/window.svg");
    393  background-size: 1em;
    394  background-repeat: no-repeat;
    395  background-position-y: center;
    396  background-position-x: left 0.5em;
    397 
    398  &:-moz-locale-dir(rtl) {
    399    background-position-x: right 0.5em;
    400  }
    401 
    402  padding-inline-start: 2em;
    403  -moz-context-properties: fill;
    404  fill: var(--color-accent-primary);
    405  @media (forced-colors) {
    406    fill: var(--icon-color);
    407  }
    408 }
    409 
    410 /**
    411 * Shortcuts
    412 */
    413 #selection-shortcut-action-panel {
    414  --panel-subview-body-padding: 0;
    415 }
    416 
    417 #ai-action-button {
    418  --button-min-height: 34px;
    419  --button-size-icon: 34px;
    420  --button-border-radius: 7px;
    421  margin: 1px;
    422 }
    423 
    424 #ask-chat-shortcuts {
    425  font: menu;
    426  max-width: 345px;
    427 }
    428 
    429 .ask-chat-shortcut-warning {
    430  margin: var(--arrowpanel-menuitem-margin);
    431  margin-bottom: var(--space-xsmall);
    432 }
    433 
    434 .ask-chat-shortcuts-custom-prompt {
    435  margin: var(--arrowpanel-menuitem-margin);
    436  margin-top: var(--space-small);
    437 }
    438 
    439 /**
    440 * Dialogs
    441 */
    442 
    443 .dialogStack {
    444  z-index: var(--browser-stack-z-index-dialog-stack);
    445  position: absolute;
    446  inset: 0;
    447 
    448  /* Override the <stack> `grid-area: 1 / 1` rule with an `auto` placement.
    449   * Otherwise the .dialogStack start edges are placed relative to the
    450   * center-aligned grid items, rather than the grid's padding area. */
    451  grid-area: auto;
    452 
    453  /* Hide tab-modal dialogs when a window-modal one is up. */
    454  :root[window-modal-open] .browserStack > &,
    455  /* For some printing use cases we need to visually hide the dialog before
    456   * actually closing it / make it disappear from the frame tree. */
    457  &.temporarilyHidden {
    458    visibility: hidden;
    459  }
    460 }
    461 
    462 .dialogOverlay {
    463  align-items: center;
    464  visibility: hidden;
    465 
    466  &[topmost="true"] {
    467    z-index: 1;
    468  }
    469 
    470  .content-prompt-dialog > & {
    471    display: grid;
    472    align-items: unset;
    473    place-content: center;
    474    /* 90% for 5% top/bottom margins, the document height so that
    475     * smaller dialogs don't become too big. */
    476    grid-auto-rows: min(90%, var(--doc-height-px));
    477  }
    478 }
    479 
    480 .dialogBox {
    481  min-width: 0;
    482  background-clip: content-box;
    483  display: flex;
    484  padding: 0;
    485  overflow-x: auto;
    486  outline: 0.5px solid var(--border-color-card);
    487 
    488  /* Ensure that dialog boxes are pixel-snapped, to keep their internal layout
    489   * consistent, regardless of whether the surrounding layout places them at a
    490   * fractional position. (This helps prevent arbitrary 1px shifts that could
    491   * otherwise appear inside of a vertically-centered dialog when the
    492   * viewport-height changes from being odd to even.) */
    493  will-change: transform;
    494 
    495  &:not(.spotlightBox) {
    496    box-shadow: var(--box-shadow-popup);
    497    border-radius: var(--border-radius-medium);
    498  }
    499 
    500  /*
    501   * In High Contrast Mode, this prevents a dialog from visually bleeding into
    502   * the window behind it, which looks jarring.
    503   */
    504  @media (prefers-contrast) {
    505    outline-color: WindowText;
    506  }
    507 
    508  &[resizable="true"] {
    509    resize: both;
    510    overflow: hidden;
    511    min-height: 20em;
    512  }
    513 
    514  &[sizeto="available"] {
    515    width: 100%;
    516    height: 100%;
    517    margin: 0;
    518 
    519    /* NOTE(emilio): This is a bit tricky, but basically what we want to do is
    520     * guarantee a size between 80% (or 90% for height) and 100% of the
    521     * available space, with some variable spacing when the available space is
    522     * over 600px. The 2 controls the growth of the margin, with a larger
    523     * number reaching the 80% width later, effectively. */
    524    --box-max-width-default: clamp(80%, 100% + (600px - 100%) / 2, 100%);
    525    --box-max-height-default: clamp(90%, 100% + (600px - 100%) / 2, 100%);
    526    max-width: var(--box-max-width-requested, var(--box-max-width-default));
    527    max-height: var(--box-max-height-requested, var(--box-max-height-default));
    528  }
    529 
    530  :not(.content-prompt-dialog) > .dialogOverlay > &:not(.spotlightBox) {
    531    /* Make dialogs overlap with upper chrome UI. Not necessary for Spotlight
    532    dialogs that are intended to be centered above the window or content area. */
    533    margin-top: -5px;
    534 
    535    /* When the dialog is in a splitview, the offset is a little larger */
    536    .deck-selected.split-view-panel & {
    537      margin-top: -8px;
    538    }
    539  }
    540 
    541  /* Spotlight dialogs are full-size on the content or window area */
    542  &.spotlightBox {
    543    max-width: none;
    544    max-height: none;
    545  }
    546 
    547  /* For window-modal dialogs, we allow overlapping the urlbar if the window is
    548   * small enough. */
    549  #window-modal-dialog > .dialogOverlay > &:not(.spotlightBox) {
    550    /* Do not go below 3px (as otherwise the top of the dialog would be
    551     * adjacent to or clipped by the top of the window), or above the window
    552     * size. */
    553    margin-top: clamp(3px, var(--chrome-offset, 20px) - 5px, calc(100vh - var(--subdialog-inner-height) - 5px));
    554  }
    555 }
    556 
    557 #window-modal-dialog {
    558  overflow: visible;
    559  padding: 0;
    560  /* Override default <html:dialog> styles */
    561  border-width: 0;
    562  background-color: transparent;
    563  /* This makes the dialog top-aligned by default (the dialog box will move via
    564   * margin-top above) */
    565  bottom: auto;
    566  /* When showModal() is called on a <dialog>, the <dialog> itself will be
    567   * focused when there's no content, hence the focus ring. However, this
    568   * focus ring is not needed because we always setup the content of the dialog
    569   * after its opened and manually focus an element within it.
    570   */
    571  outline: none;
    572 
    573  &.spotlight {
    574    /* Spotlight window modal dialogs should be equal in size to the window. */
    575    inset: 0;
    576    height: auto;
    577    width: auto;
    578    max-height: none;
    579    max-width: none;
    580 
    581    > .dialogOverlay {
    582      width: 100%;
    583      height: 100%;
    584    }
    585  }
    586 }
    587 
    588 .dialogFrame {
    589  margin: 0;
    590  flex: 1;
    591  /* Default dialog dimensions */
    592  width: 34em;
    593 }
    594 
    595 /* Radius the backdrop so it doesnt occlude the radiused .browserContainer below it */
    596 :root:not([inDOMFullscreen]) #tabbrowser-tabbox[sidebar-shown] .dialogOverlay[topmost="true"] {
    597  /* stylelint-disable-next-line media-query-no-invalid */
    598  @media -moz-pref("sidebar.revamp.round-content-area") {
    599    border-start-end-radius: var(--border-radius-medium);
    600 
    601    /* stylelint-disable-next-line media-query-no-invalid */
    602    @media -moz-pref("sidebar.position_start") {
    603      border-start-start-radius: var(--border-radius-medium);
    604      border-start-end-radius: 0;
    605    }
    606  }
    607 }
    608 
    609 .dialogOverlay[topmost="true"],
    610 #window-modal-dialog::backdrop {
    611  background-color: var(--background-color-overlay);
    612 }
    613 
    614 .dialogOverlay[hideContent="true"][topmost="true"] {
    615  background-color: var(--tabpanel-background-color);
    616 }
    617 
    618 /* For the window-modal dialog, the background is supplied by the HTML dialog
    619 * backdrop, so the dialogOverlay background above "double backgrounds" - so
    620 * we remove it here: */
    621 #window-modal-dialog > .dialogOverlay[topmost="true"] {
    622  background-color: transparent;
    623 }