henry pushed to branch tor-browser-149.0a1-16.0-2 at The Tor Project / Applications / Tor Browser

Commits:

3 changed files:

Changes:

  • browser/components/torconnect/content/aboutTorConnect.css
    1 1
     /* Copyright (c) 2021, The Tor Project, Inc. */
    
    2 2
     
    
    3
    -@import url("chrome://global/skin/error-pages.css");
    
    4 3
     @import url("chrome://global/skin/onion-pattern.css");
    
    5 4
     
    
    6 5
     body:not(.loaded) {
    
    ... ... @@ -8,7 +7,23 @@ body:not(.loaded) {
    8 7
       display: none;
    
    9 8
     }
    
    10 9
     
    
    10
    +body {
    
    11
    +  margin: 0;
    
    12
    +  min-height: 100vh;
    
    13
    +  --progress-shadow-height: 66px;
    
    14
    +  display: grid;
    
    15
    +  grid-template:
    
    16
    +    "progress progress progress progress progress" minmax(calc(var(--progress-shadow-height) + var(--space-large)), 10vh)
    
    17
    +    ". . breadcrumbs . ." auto
    
    18
    +    ". icon heading . ." auto
    
    19
    +    ". icon text-container . ." auto
    
    20
    +    ". . controls-container . ." auto
    
    21
    +    ". . . . ." minmax(var(--onion-pattern-height), 1fr)
    
    22
    +    / var(--space-large) minmax(max-content, 1fr) minmax(350px, 700px) 1fr var(--space-large);
    
    23
    +}
    
    24
    +
    
    11 25
     #breadcrumbs {
    
    26
    +  grid-area: breadcrumbs;
    
    12 27
       display: flex;
    
    13 28
       align-items: center;
    
    14 29
       margin: 0 0 var(--space-xlarge) 0;
    
    ... ... @@ -78,11 +93,6 @@ body:not(.loaded) {
    78 93
       display: none;
    
    79 94
     }
    
    80 95
     
    
    81
    -#tor-connect-heading {
    
    82
    -  /* Do not show the focus outline. */
    
    83
    -  outline: none;
    
    84
    -}
    
    85
    -
    
    86 96
     #connect-to-tor {
    
    87 97
       margin-inline-start: 0;
    
    88 98
     }
    
    ... ... @@ -95,10 +105,6 @@ body:not(.loaded) {
    95 105
       list-style-image: url("chrome://browser/content/torconnect/tor-connect-broken.svg");
    
    96 106
     }
    
    97 107
     
    
    98
    -#location-settings-icon {
    
    99
    -  list-style-image: url("chrome://browser/content/torconnect/globe.svg");
    
    100
    -}
    
    101
    -
    
    102 108
     #try-bridge {
    
    103 109
       cursor: default;
    
    104 110
     }
    
    ... ... @@ -107,38 +113,17 @@ body:not(.loaded) {
    107 113
       list-style-image: url("chrome://browser/content/torconnect/bridge.svg");
    
    108 114
     }
    
    109 115
     
    
    110
    -#locationDropdownLabel {
    
    111
    -  margin-block: auto;
    
    112
    -  margin-inline: var(--space-xsmall);
    
    113
    -}
    
    114
    -
    
    115 116
     #locationDropdownLabel.error {
    
    116 117
       color: var(--text-color-error);
    
    117 118
     }
    
    118 119
     
    
    119
    -/* this follows similar css in error-pages.css for buttons */
    
    120
    -@media only screen and (min-width: 480px) {
    
    121
    -  form#locationDropdown {
    
    122
    -    margin-inline: var(--space-xsmall);
    
    123
    -    /* subtracting out the margin is needeed because by
    
    124
    -       default forms have different margins than buttons */
    
    125
    -    max-width: calc(100% - 2 * var(--space-xsmall));
    
    126
    -  }
    
    127
    -}
    
    128
    -
    
    129
    -@media only screen and (max-width: 480px) {
    
    130
    -  #tryAgainButton {
    
    131
    -    margin-top: var(--space-xsmall);
    
    132
    -  }
    
    133
    -}
    
    134
    -
    
    135 120
     form#locationDropdown {
    
    136 121
       width: 240px;
    
    137 122
     }
    
    138 123
     
    
    139 124
     form#locationDropdown select {
    
    140
    -  max-width: 100%;
    
    141
    -  margin-inline: 0;
    
    125
    +  width: 100%;
    
    126
    +  margin: 0;
    
    142 127
       font-weight: var(--font-weight-bold);
    
    143 128
     }
    
    144 129
     
    
    ... ... @@ -154,9 +139,7 @@ form#locationDropdown select {
    154 139
     }
    
    155 140
     
    
    156 141
     #progressBar:not([hidden]) {
    
    157
    -  position: fixed;
    
    158
    -  inset-block-start: 0;
    
    159
    -  inset-inline: 0;
    
    142
    +  grid-area: progress;
    
    160 143
       display: grid;
    
    161 144
       --progress-percent: 0%;
    
    162 145
       --progress-animation: progressAnimation 5s ease infinite;
    
    ... ... @@ -176,7 +159,7 @@ form#locationDropdown select {
    176 159
     #progressBackground {
    
    177 160
       z-index: 1;
    
    178 161
       width: var(--progress-percent);
    
    179
    -  height: 66px;
    
    162
    +  height: var(--progress-shadow-height);
    
    180 163
       margin-block-start: -26px;
    
    181 164
       background-image: linear-gradient(var(--progressbar-shadow-start), var(--background-color-canvas) 100%), var(--progressbar-gradient);
    
    182 165
       animation: var(--progress-animation);
    
    ... ... @@ -223,46 +206,94 @@ form#locationDropdown select {
    223 206
       }
    
    224 207
     }
    
    225 208
     
    
    226
    -#connectPageContainer {
    
    227
    -  margin-top: 10vh;
    
    228
    -  width: 100%;
    
    229
    -  max-width: 45em;
    
    230
    -}
    
    231
    -
    
    232 209
     #quickstartToggle {
    
    233 210
       width: max-content;
    
    234 211
     }
    
    235 212
     
    
    236
    -/* mirrors p element spacing */
    
    237 213
     #viewLogButton {
    
    238
    -  margin: var(--space-large) 0;
    
    214
    +  margin-inline: 0;
    
    215
    +  margin-block-start: var(--space-large);
    
    239 216
     }
    
    240 217
     
    
    241
    -body.aboutTorConnect {
    
    242
    -  justify-content: space-between;
    
    243
    -  /* Always reserve 150px for the background, plus padding with content. */
    
    244
    -  padding-block-end: calc(var(--onion-pattern-height) + var(--space-large));
    
    218
    +.torconnect-stage-content:not(.show-stage) {
    
    219
    +  display: none;
    
    245 220
     }
    
    246 221
     
    
    247
    -body.aboutTorConnect .title {
    
    248
    -  background-image: url("chrome://browser/content/torconnect/tor-connect.svg");
    
    222
    +.torconnect-stage-content {
    
    223
    +  display: contents;
    
    224
    +}
    
    225
    +
    
    226
    +.torconnect-icon {
    
    227
    +  grid-area: icon;
    
    228
    +  justify-self: end;
    
    229
    +  width: 52px;
    
    230
    +  height: 52px;
    
    231
    +  margin-inline-end: var(--space-xlarge);
    
    232
    +  content: url("chrome://browser/content/torconnect/tor-connect.svg");
    
    249 233
       -moz-context-properties: stroke, fill, fill-opacity;
    
    250 234
       fill-opacity: 1;
    
    251 235
       fill: var(--icon-color);
    
    252 236
       stroke: var(--icon-color);
    
    253
    -  /* Make sure there is no padding between the title and #breadcrumbs. */
    
    254
    -  padding-block-start: 0;
    
    237
    +  /* Make non-interactive (non-draggable). */
    
    238
    +  pointer-events: none;
    
    255 239
     }
    
    256 240
     
    
    257
    -body.aboutTorConnect .title.offline {
    
    258
    -  background-image: url("chrome://browser/content/torconnect/connection-failure.svg");
    
    241
    +.torconnect-icon.offline-icon {
    
    242
    +  content: url("chrome://browser/content/torconnect/connection-failure.svg");
    
    259 243
     }
    
    260 244
     
    
    261
    -body.aboutTorConnect .title:is(.assist, .final) {
    
    262
    -  background-image: url("chrome://browser/content/torconnect/tor-connect-broken.svg");
    
    245
    +.torconnect-icon.assist-icon {
    
    246
    +  content: url("chrome://browser/content/torconnect/tor-connect-broken.svg");
    
    263 247
     }
    
    264 248
     
    
    265
    -body.aboutTorConnect .title.location {
    
    266
    -  background-image: url("chrome://browser/content/torconnect/connection-location.svg");
    
    249
    +.torconnect-icon.location-icon {
    
    250
    +  content: url("chrome://browser/content/torconnect/connection-location.svg");
    
    267 251
       stroke: var(--icon-color-warning);
    
    268 252
     }
    
    253
    +
    
    254
    +.torconnect-heading {
    
    255
    +  grid-area: heading;
    
    256
    +  /* Do not show the focus outline. */
    
    257
    +  outline: none;
    
    258
    +  font-size: var(--font-size-xxxlarge);
    
    259
    +  margin: 0;
    
    260
    +  margin-block-end: var(--space-xxlarge);
    
    261
    +}
    
    262
    +
    
    263
    +.torconnect-text-container {
    
    264
    +  grid-area: text-container;
    
    265
    +}
    
    266
    +
    
    267
    +.torconnect-text-container p {
    
    268
    +  margin: 0;
    
    269
    +}
    
    270
    +
    
    271
    +.torconnect-text-container > *:not(:last-child) {
    
    272
    +  margin-block-end: var(--space-large);
    
    273
    +}
    
    274
    +
    
    275
    +.torconnect-controls-container {
    
    276
    +  grid-area: controls-container;
    
    277
    +  margin-block: var(--space-xlarge) var(--space-large);
    
    278
    +  display: flex;
    
    279
    +  flex-wrap: wrap;
    
    280
    +  flex-direction: row;
    
    281
    +  justify-content: end;
    
    282
    +  align-items: center;
    
    283
    +  /* Gap between children and rows. */
    
    284
    +  gap: var(--space-small) var(--space-small);
    
    285
    +}
    
    286
    +
    
    287
    +.torconnect-controls-container > * {
    
    288
    +  flex: 0 0 max-content;
    
    289
    +  margin: 0;
    
    290
    +}
    
    291
    +
    
    292
    +/* Temporary hacks for the connectPageContainer. */
    
    293
    +#connectPageContainer .torconnect-text-container > *:last-child {
    
    294
    +  margin-block-end: var(--space-large);
    
    295
    +}
    
    296
    +
    
    297
    +#connectPageContainer .torconnect-controls-container {
    
    298
    +  margin-block-start: calc(var(--space-xlarge) - var(--space-large));
    
    299
    +}

  • browser/components/torconnect/content/aboutTorConnect.html
    ... ... @@ -8,12 +8,11 @@
    8 8
         />
    
    9 9
         <title data-l10n-id="tor-connect-page-title"></title>
    
    10 10
     
    
    11
    +    <link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />
    
    11 12
         <link rel="stylesheet" href="chrome://global/skin/tor-common.css" />
    
    12 13
         <link
    
    13 14
           rel="stylesheet"
    
    14 15
           href="chrome://browser/content/torconnect/aboutTorConnect.css"
    
    15
    -      type="text/css"
    
    16
    -      media="all"
    
    17 16
         />
    
    18 17
     
    
    19 18
         <link rel="localization" href="toolkit/global/tor-browser.ftl" />
    
    ... ... @@ -23,39 +22,42 @@
    23 22
           src="chrome://global/content/elements/moz-toggle.mjs"
    
    24 23
         ></script>
    
    25 24
       </head>
    
    26
    -  <body class="aboutTorConnect onion-pattern-background">
    
    25
    +  <body class="onion-pattern-background">
    
    27 26
         <div id="progressBar" hidden="hidden">
    
    28 27
           <div id="progressSolid"></div>
    
    29 28
           <div id="progressBackground"></div>
    
    30 29
           <div id="progressBarBackground"></div>
    
    31 30
         </div>
    
    32
    -    <div id="connectPageContainer" class="container">
    
    33
    -      <div id="breadcrumbs" class="hidden">
    
    34
    -        <span id="connect-to-tor" class="breadcrumb-item">
    
    35
    -          <span id="connect-to-tor-icon" class="breadcrumb-icon"></span>
    
    36
    -          <span class="breadcrumb-label"></span>
    
    37
    -        </span>
    
    38
    -        <span
    
    39
    -          id="connection-assist-separator"
    
    40
    -          class="breadcrumb-separator breadcrumb-icon"
    
    41
    -        ></span>
    
    42
    -        <span id="connection-assist" class="breadcrumb-item">
    
    43
    -          <span id="connection-assist-icon" class="breadcrumb-icon"></span>
    
    44
    -          <span class="breadcrumb-label"></span>
    
    45
    -        </span>
    
    46
    -        <span
    
    47
    -          id="try-bridge-separator"
    
    48
    -          class="breadcrumb-separator breadcrumb-icon"
    
    49
    -        ></span>
    
    50
    -        <span id="try-bridge" class="breadcrumb-item">
    
    51
    -          <span id="try-bridge-icon" class="breadcrumb-icon"></span>
    
    52
    -          <span class="breadcrumb-label"></span>
    
    53
    -        </span>
    
    54
    -      </div>
    
    55
    -      <div id="text-container">
    
    56
    -        <div class="title">
    
    57
    -          <h1 id="tor-connect-heading" class="title-text" tabindex="-1"></h1>
    
    58
    -        </div>
    
    31
    +    <div id="breadcrumbs" class="hidden">
    
    32
    +      <span id="connect-to-tor" class="breadcrumb-item">
    
    33
    +        <span id="connect-to-tor-icon" class="breadcrumb-icon"></span>
    
    34
    +        <span class="breadcrumb-label"></span>
    
    35
    +      </span>
    
    36
    +      <span
    
    37
    +        id="connection-assist-separator"
    
    38
    +        class="breadcrumb-separator breadcrumb-icon"
    
    39
    +      ></span>
    
    40
    +      <span id="connection-assist" class="breadcrumb-item">
    
    41
    +        <span id="connection-assist-icon" class="breadcrumb-icon"></span>
    
    42
    +        <span class="breadcrumb-label"></span>
    
    43
    +      </span>
    
    44
    +      <span
    
    45
    +        id="try-bridge-separator"
    
    46
    +        class="breadcrumb-separator breadcrumb-icon"
    
    47
    +      ></span>
    
    48
    +      <span id="try-bridge" class="breadcrumb-item">
    
    49
    +        <span id="try-bridge-icon" class="breadcrumb-icon"></span>
    
    50
    +        <span class="breadcrumb-label"></span>
    
    51
    +      </span>
    
    52
    +    </div>
    
    53
    +    <div id="connectPageContainer" class="torconnect-stage-content">
    
    54
    +      <img id="tor-connect-icon" class="torconnect-icon" alt="" />
    
    55
    +      <h1
    
    56
    +        id="tor-connect-heading"
    
    57
    +        class="torconnect-heading"
    
    58
    +        tabindex="-1"
    
    59
    +      ></h1>
    
    60
    +      <div class="torconnect-text-container">
    
    59 61
             <div id="connectLongContent">
    
    60 62
               <p id="connectLongContentText"></p>
    
    61 63
             </div>
    
    ... ... @@ -68,26 +70,21 @@
    68 70
             <div id="quickstartContainer">
    
    69 71
               <moz-toggle id="quickstartToggle"></moz-toggle>
    
    70 72
             </div>
    
    71
    -
    
    72
    -        <div id="connectButtonContainer" class="button-container">
    
    73
    -          <button id="restartButton" hidden="true"></button>
    
    74
    -          <button id="configureButton" hidden="true"></button>
    
    75
    -          <button id="cancelButton" hidden="true"></button>
    
    76
    -          <button id="connectButton" hidden="true" class="tor-button"></button>
    
    77
    -          <label id="locationDropdownLabel" for="countries"></label>
    
    78
    -          <form id="locationDropdown" hidden="true">
    
    79
    -            <select id="regions-select">
    
    80
    -              <option id="first-region-option"></option>
    
    81
    -              <optgroup id="frequent-regions-option-group"></optgroup>
    
    82
    -              <optgroup id="full-regions-option-group"></optgroup>
    
    83
    -            </select>
    
    84
    -          </form>
    
    85
    -          <button
    
    86
    -            id="tryBridgeButton"
    
    87
    -            hidden="true"
    
    88
    -            class="tor-button"
    
    89
    -          ></button>
    
    90
    -        </div>
    
    73
    +      </div>
    
    74
    +      <div class="torconnect-controls-container">
    
    75
    +        <button id="restartButton" hidden="true"></button>
    
    76
    +        <button id="configureButton" hidden="true"></button>
    
    77
    +        <button id="cancelButton" hidden="true"></button>
    
    78
    +        <button id="connectButton" hidden="true" class="tor-button"></button>
    
    79
    +        <label id="locationDropdownLabel" for="countries"></label>
    
    80
    +        <form id="locationDropdown" hidden="true">
    
    81
    +          <select id="regions-select">
    
    82
    +            <option id="first-region-option"></option>
    
    83
    +            <optgroup id="frequent-regions-option-group"></optgroup>
    
    84
    +            <optgroup id="full-regions-option-group"></optgroup>
    
    85
    +          </select>
    
    86
    +        </form>
    
    87
    +        <button id="tryBridgeButton" hidden="true" class="tor-button"></button>
    
    91 88
           </div>
    
    92 89
         </div>
    
    93 90
         <script src="chrome://browser/content/torconnect/aboutTorConnect.js"></script>
    

  • browser/components/torconnect/content/aboutTorConnect.js
    ... ... @@ -28,7 +28,7 @@ const BreadcrumbStatus = Object.freeze({
    28 28
     class AboutTorConnect {
    
    29 29
       selectors = Object.freeze({
    
    30 30
         textContainer: {
    
    31
    -      title: "div.title",
    
    31
    +      icon: "#tor-connect-icon",
    
    32 32
           longContentText: "#connectLongContentText",
    
    33 33
         },
    
    34 34
         progress: {
    
    ... ... @@ -72,7 +72,7 @@ class AboutTorConnect {
    72 72
       });
    
    73 73
     
    
    74 74
       elements = Object.freeze({
    
    75
    -    title: document.querySelector(this.selectors.textContainer.title),
    
    75
    +    icon: document.querySelector(this.selectors.textContainer.icon),
    
    76 76
         heading: document.getElementById("tor-connect-heading"),
    
    77 77
         longContentText: document.querySelector(
    
    78 78
           this.selectors.textContainer.longContentText
    
    ... ... @@ -225,9 +225,9 @@ class AboutTorConnect {
    225 225
     
    
    226 226
       setTitle(title, className) {
    
    227 227
         this.elements.heading.textContent = title;
    
    228
    -    this.elements.title.className = "title";
    
    228
    +    this.elements.icon.className = "torconnect-icon";
    
    229 229
         if (className) {
    
    230
    -      this.elements.title.classList.add(className);
    
    230
    +      this.elements.icon.classList.add(className);
    
    231 231
         }
    
    232 232
       }
    
    233 233
     
    
    ... ... @@ -348,10 +348,22 @@ class AboutTorConnect {
    348 348
         // selectRegionOption.
    
    349 349
         this.selectedRegion = stage.defaultRegion;
    
    350 350
     
    
    351
    +    let prevPageEl = document.querySelector(
    
    352
    +      ".torconnect-stage-content.show-stage"
    
    353
    +    );
    
    354
    +    let pageEl = document.getElementById("connectPageContainer");
    
    355
    +    for (const maybePageEl of document.querySelectorAll(
    
    356
    +      ".torconnect-stage-content"
    
    357
    +    )) {
    
    358
    +      if (maybePageEl.dataset.stageName === stage.name) {
    
    359
    +        pageEl = maybePageEl;
    
    360
    +        break;
    
    361
    +      }
    
    362
    +    }
    
    351 363
         // By default we want to reset the focus to the top of the page when
    
    352 364
         // changing the displayed page since we want a user to read the new page
    
    353 365
         // before activating a control.
    
    354
    -    let moveFocus = this.elements.heading;
    
    366
    +    let moveFocus = pageEl.querySelector(".torconnect-heading");
    
    355 367
     
    
    356 368
         if (stage.name === "Bootstrapping") {
    
    357 369
           this.preBootstrappingStage = prevStage;
    
    ... ... @@ -461,6 +473,8 @@ class AboutTorConnect {
    461 473
           this.hide(this.elements.viewLogButton);
    
    462 474
         }
    
    463 475
     
    
    476
    +    prevPageEl?.classList.remove("show-stage");
    
    477
    +    pageEl.classList.add("show-stage");
    
    464 478
         document.body.classList.toggle("loaded", isLoaded);
    
    465 479
         moveFocus.focus();
    
    466 480
       }
    
    ... ... @@ -557,7 +571,7 @@ class AboutTorConnect {
    557 571
       }
    
    558 572
     
    
    559 573
       showOffline() {
    
    560
    -    this.setTitle(TorStrings.torConnect.noInternet, "offline");
    
    574
    +    this.setTitle(TorStrings.torConnect.noInternet, "offline-icon");
    
    561 575
         this.setLongText(TorStrings.torConnect.noInternetDescription);
    
    562 576
         this.elements.progressDescription.textContent =
    
    563 577
           TorStrings.torConnect.offline;
    
    ... ... @@ -573,7 +587,7 @@ class AboutTorConnect {
    573 587
       }
    
    574 588
     
    
    575 589
       showChooseRegion(error) {
    
    576
    -    this.setTitle(TorStrings.torConnect.couldNotConnect, "assist");
    
    590
    +    this.setTitle(TorStrings.torConnect.couldNotConnect, "assist-icon");
    
    577 591
         this.showConfigureConnectionLink(TorStrings.torConnect.assistDescription);
    
    578 592
         this.elements.progressDescription.textContent =
    
    579 593
           this.getMaybeLocalizedError(error);
    
    ... ... @@ -586,7 +600,7 @@ class AboutTorConnect {
    586 600
       }
    
    587 601
     
    
    588 602
       showRegionNotFound() {
    
    589
    -    this.setTitle(TorStrings.torConnect.errorLocation, "location");
    
    603
    +    this.setTitle(TorStrings.torConnect.errorLocation, "location-icon");
    
    590 604
         this.showConfigureConnectionLink(
    
    591 605
           TorStrings.torConnect.errorLocationDescription
    
    592 606
         );
    
    ... ... @@ -601,7 +615,7 @@ class AboutTorConnect {
    601 615
       }
    
    602 616
     
    
    603 617
       showConfirmRegion(error) {
    
    604
    -    this.setTitle(TorStrings.torConnect.isLocationCorrect, "location");
    
    618
    +    this.setTitle(TorStrings.torConnect.isLocationCorrect, "location-icon");
    
    605 619
         this.showConfigureConnectionLink(
    
    606 620
           TorStrings.torConnect.isLocationCorrectDescription
    
    607 621
         );
    
    ... ... @@ -616,7 +630,7 @@ class AboutTorConnect {
    616 630
       }
    
    617 631
     
    
    618 632
       showFinalError(error) {
    
    619
    -    this.setTitle(TorStrings.torConnect.finalError, "final");
    
    633
    +    this.setTitle(TorStrings.torConnect.finalError, "assist-icon");
    
    620 634
         this.setLongText(TorStrings.torConnect.finalErrorDescription);
    
    621 635
         this.elements.progressDescription.textContent =
    
    622 636
           this.getMaybeLocalizedError(error);