tor-browser

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

browser.css (9967B)


      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 @import url("chrome://browser/skin/browser-shared.css");
      6 @import url("chrome://browser/skin/contextmenu.css");
      7 
      8 /**
      9 * We still want to do some of the tweaks that browser-colors does, like
     10 * disabling the toolbar field border and backgrounds.
     11 */
     12 @media not (prefers-contrast) {
     13  :root:not([lwtheme]) {
     14    @media (-moz-gtk-theme-family) {
     15      --tabs-navbar-separator-style: none;
     16      @media (prefers-color-scheme: light) {
     17        --urlbar-box-bgcolor: #fafafa;
     18      }
     19    }
     20  }
     21 }
     22 
     23 #menubar-items {
     24  flex-direction: column; /* for flex hack */
     25  justify-content: normal; /* align the menubar to the top also in customize mode */
     26 }
     27 
     28 /**
     29 * Titlebar drawing. GTK windows have both a window radius (exposed via the
     30 * `-moz-gtk-csd-titlebar-radius`) environment variable, and a window shadow
     31 * (which we can't read back from GTK).
     32 */
     33 @media (-moz-gtk-csd-transparency-available) {
     34  :root[customtitlebar] {
     35    background-color: transparent;
     36 
     37    &[sizemode="normal"]:not([gtktiledwindow="true"]) {
     38      /* Firefox draws its contents to a child window, while GTK takes care of
     39       * drawing the toplevel (which in most cases is just the window
     40       * decorations).
     41       *
     42       * Due to how X11 child windows work, pixels painted by a child window will
     43       * never be drawn by its toplevel, even in compositing window managers.
     44       * That means that we need to draw the part of the decorations that fall
     45       * into our client area ourselves, which is what this does.
     46       *
     47       * Alternatives to this would be:
     48       *  * Using the XComposite extension
     49       *  * Drawing to the toplevel window buffer directly
     50       *  * Approximating the corners with gdk_window_shape_combine_region
     51       *
     52       * None of them being particularly appealing.
     53       *
     54       * On Wayland we render to a subsurface which gets properly composited
     55       * atop our toplevel, so there's no issue there (MozWindowDecorations
     56       * does nothing).
     57       */
     58      -moz-default-appearance: -moz-window-decorations;
     59      appearance: auto;
     60 
     61      #navigator-toolbox,
     62      dialog::backdrop {
     63        border-top-left-radius: env(-moz-gtk-csd-titlebar-radius);
     64        border-top-right-radius: env(-moz-gtk-csd-titlebar-radius);
     65      }
     66 
     67      /* stylelint-disable-next-line media-query-no-invalid */
     68      @media -moz-pref("widget.gtk.rounded-bottom-corners.enabled") {
     69        #navigator-toolbox {
     70          /* The body clip below covers this. */
     71          border-radius: 0;
     72        }
     73 
     74        body,
     75        dialog::backdrop {
     76          /* Use an uniform clip to allow WebRender to optimize it better */
     77          border-radius: env(-moz-gtk-csd-titlebar-radius);
     78        }
     79      }
     80    }
     81  }
     82 }
     83 
     84 /* Bookmark menus */
     85 .bookmark-item {
     86  &:is(menu, menuitem) {
     87    min-width: 0;
     88    max-width: 32em;
     89  }
     90 
     91  &:not(.subviewbutton) > .menu-icon {
     92    margin-block: 0;
     93  }
     94 
     95  /* Bookmark drag and drop styles */
     96  &[dragover-into="true"] {
     97    background: SelectedItem !important;
     98    color: SelectedItemText !important;
     99  }
    100 }
    101 
    102 /* Address bar */
    103 .urlbar,
    104 #searchbar {
    105  font-size: 1.05em;
    106 }
    107 
    108 /* AutoComplete */
    109 
    110 #PopupAutoComplete > richlistbox > richlistitem[originaltype~="datalist-first"] {
    111  border-top: 1px solid ThreeDShadow;
    112 }
    113 
    114 /* Tabstrip */
    115 
    116 #tabbrowser-tabs {
    117  /* override the native styling */
    118  border-bottom: 0;
    119 }
    120 
    121 #TabsToolbar {
    122  min-height: 0;
    123 }
    124 
    125 .browser-titlebar,
    126 #main-menubar {
    127  appearance: none;
    128  background-color: transparent;
    129  color: inherit;
    130 }
    131 
    132 /* All tabs menupopup */
    133 
    134 .alltabs-item[selected="true"] {
    135  font-weight: var(--font-weight-bold);
    136 }
    137 
    138 #UITourHighlight {
    139  /* Below are some fixes for people without an X compositor on Linux.
    140     This is why we can't have nice things: */
    141  /* Animations don't repaint properly without an X compositor. */
    142  animation-name: none !important;
    143  /* Opacity rounds to 0 or 1 on Linux without an X compositor, making the
    144     background color not visible. Anti-aliasing is not available either. Make a
    145     thicker outline and cancel border-radius for that case. */
    146  outline: 4px solid rgb(0, 200, 215);
    147  border-radius: 0 !important;
    148 }
    149 
    150 #UITourTooltipDescription {
    151  font-size: 1.05rem;
    152 }
    153 
    154 #UITourTooltipClose {
    155  margin-inline-end: -4px;
    156 }
    157 
    158 /**
    159 * Override the --arrowpanel-padding so the background extends
    160 * to the sides and bottom of the panel.
    161 */
    162 #UITourTooltipButtons {
    163  margin-inline-start: -10px;
    164  margin-bottom: -10px;
    165 }
    166 
    167 /* The button box must appear on top of the navigator-toolbox in order for
    168 * click and hover mouse events to work properly for the button in the restored
    169 * window state. Otherwise, elements in the navigator-toolbox, like the menubar,
    170 * can swallow those events. */
    171 .titlebar-buttonbox {
    172  z-index: 1;
    173  align-items: stretch;
    174  /* In libadwaita buttons are 24px big and spacing is
    175   * 3px of gap + 5px * 2 of padding = 13px / 2, see:
    176   * https://gitlab.gnome.org/GNOME/libadwaita/-/blob/fe21c3c823443a8f2333cf3cc09ba3d0fa753228/src/stylesheet/widgets/_header-bar.scss#L164
    177   * We want a contiguous hit region so we use 6.5px of padding instead. */
    178  --titlebar-button-size: 24px;
    179  --titlebar-button-spacing: 6.5px;
    180  --titlebar-button-end-spacing: 10px;
    181  @media (-moz-gtk-theme-family: breeze) {
    182    /* On breeze, titlebar button size and spacing depends on the font, see:
    183     *  * https://invent.kde.org/plasma/kdecoration/-/blob/28898c2492708f6a1603458baa535a8504e8d638/src/decorationsettings.cpp#L18-33
    184     *  * https://invent.kde.org/plasma/breeze/-/blob/156193c14942cbc836cf131e92e16fc3310513ed/kdecoration/breezedecoration.cpp#L734-750
    185     *  * https://invent.kde.org/plasma/breeze/-/blob/156193c14942cbc836cf131e92e16fc3310513ed/kdecoration/breeze.h#L34
    186     * Since we don't have the height of the "M" glyph, we approximate using
    187     * ems snapped to device pixels for crisp rendering. */
    188    /* The button size is also the grid unit */
    189    --titlebar-button-size: round(1.3em, 2 * env(hairline));
    190    /* The spacing is half the button size. Since we apply it to each side,
    191     * it's that divided by 2 */
    192    --titlebar-button-spacing: calc(var(--titlebar-button-size) / 4);
    193    /* End spacing is 2 * smallSpacing, which is max(2px, clamp(grid-unit / 4)). */
    194    --titlebar-button-end-spacing: calc(2 * max(2px, round(down, var(--titlebar-button-size) / 4, env(hairline))));
    195  }
    196  --max-titlebar-button-position: max(
    197    env(-moz-gtk-csd-maximize-button-position),
    198    env(-moz-gtk-csd-minimize-button-position),
    199    env(-moz-gtk-csd-close-button-position)
    200  );
    201 }
    202 
    203 @media (-moz-gtk-csd-reversed-placement) {
    204  .titlebar-buttonbox-container {
    205    order: -1;
    206  }
    207 }
    208 
    209 .titlebar-button {
    210  appearance: none;
    211  color: inherit;
    212  align-items: center;
    213  padding: 0;
    214  padding-inline: var(--titlebar-button-spacing);
    215  padding-inline-end: max(
    216    var(--titlebar-button-spacing),
    217    var(--titlebar-button-end-spacing) * (var(--titlebar-button-position) - var(--max-titlebar-button-position) + 1)
    218  );
    219  order: var(--titlebar-button-position);
    220  /* In GTK applications, you can drag the window by titlebar buttons */
    221  -moz-window-dragging: drag;
    222 
    223  > .toolbarbutton-icon {
    224    border-radius: var(--border-radius-circle);
    225    background-position: center center;
    226    background-size: min(16px, var(--titlebar-button-size) - 2 * env(hairline));
    227    background-repeat: no-repeat;
    228    -moz-context-properties: stroke;
    229    stroke: currentColor;
    230    width: var(--titlebar-button-size);
    231    height: var(--titlebar-button-size);
    232 
    233    @media not (-moz-gtk-theme-family: breeze) {
    234      /* Matches the libadwaita transition */
    235      transition: background-color 0.2s ease;
    236    }
    237 
    238    @media (-moz-gtk-theme-family: adwaita) or (-moz-gtk-theme-family: yaru) {
    239      /* On Adwaita / Yaru, the titlebar buttons have a background by default */
    240      background-color: color-mix(in srgb, currentColor 10%, transparent);
    241    }
    242  }
    243 
    244  &:hover > .toolbarbutton-icon {
    245    background-color: color-mix(in srgb, currentColor 15%, transparent);
    246  }
    247 
    248  &:hover:active > .toolbarbutton-icon {
    249    background-color: color-mix(in srgb, currentColor 30%, transparent);
    250  }
    251 
    252  &:focus-visible > .toolbarbutton-icon {
    253    outline: var(--focus-outline);
    254    outline-offset: var(--focus-outline-inset);
    255  }
    256 
    257  @media (-moz-gtk-theme-family: breeze) {
    258    &:hover > .toolbarbutton-icon {
    259      color: var(--toolbox-bgcolor);
    260      background-color: var(--toolbox-textcolor);
    261      &:-moz-window-inactive {
    262        color: var(--toolbox-bgcolor-inactive);
    263        background-color: var(--toolbox-textcolor-inactive);
    264      }
    265    }
    266    &:hover:active > .toolbarbutton-icon {
    267      background-color: color-mix(in srgb, var(--toolbox-textcolor) 50%, transparent);
    268    }
    269    &.titlebar-close:hover > .toolbarbutton-icon {
    270      background-color: #ff98a2;
    271    }
    272    &.titlebar-close:hover:active > .toolbarbutton-icon {
    273      background-color: #6d2229;
    274    }
    275  }
    276 }
    277 
    278 .titlebar-restore,
    279 .titlebar-max {
    280  --titlebar-button-position: env(-moz-gtk-csd-maximize-button-position);
    281 
    282  > .toolbarbutton-icon {
    283    background-image: -moz-symbolic-icon(window-maximize-symbolic);
    284  }
    285 
    286  @media not (-moz-gtk-csd-maximize-button) {
    287    display: none;
    288  }
    289 }
    290 
    291 .titlebar-restore > .toolbarbutton-icon {
    292  background-image: -moz-symbolic-icon(window-restore-symbolic);
    293 }
    294 
    295 .titlebar-close {
    296  --titlebar-button-position: env(-moz-gtk-csd-close-button-position);
    297 
    298  > .toolbarbutton-icon {
    299    background-image: -moz-symbolic-icon(window-close-symbolic);
    300  }
    301 
    302  @media not (-moz-gtk-csd-close-button) {
    303    display: none;
    304  }
    305 }
    306 
    307 .titlebar-min {
    308  --titlebar-button-position: env(-moz-gtk-csd-minimize-button-position);
    309 
    310  > .toolbarbutton-icon {
    311    background-image: -moz-symbolic-icon(window-minimize-symbolic);
    312  }
    313 
    314  @media not (-moz-gtk-csd-minimize-button) {
    315    display: none;
    316  }
    317 }