urlbar-searchbar.css (37908B)
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 --urlbar-container-min-width: 310px; 9 /* Usually we wouldn't need snapping border widths manually, but we use this 10 * for other layout calculations too */ 11 --urlbar-container-border-width: max(env(hairline), round(down, 1px, env(hairline))); 12 --urlbar-container-padding: round(up, 1px, env(hairline)); 13 --urlbar-container-border-padding: calc(var(--urlbar-container-border-width) + var(--urlbar-container-padding)); 14 --urlbar-margin-inline: 5px; 15 --urlbar-padding-block: 4px; 16 17 @media (max-width: 770px) { 18 --urlbar-container-min-width: 240px; 19 } 20 @media (max-width: 550px) { 21 --urlbar-container-min-width: 176px; 22 } 23 &[taskbartab] { 24 /* Taskbar tab windows are more size-constrained due to window controls 25 being in the nav bar, so we use the smaller not-yet-default value from 26 below as if the trust panel was enabled. */ 27 --urlbar-container-min-width: 275px; 28 } 29 /* Enabling the trust panel saves up to two icons in the front part of the 30 address bar. 31 Vertical tab mode is more size-constrained due to window controls being in 32 the nav bar, so we use the smaller not-yet-default value as if the trust 33 panel was enabled. */ 34 /* stylelint-disable-next-line media-query-no-invalid */ 35 @media -moz-pref("sidebar.verticalTabs") or -moz-pref("browser.urlbar.trustPanel.featureGate") { 36 --urlbar-container-min-width: 275px; 37 @media (max-width: 770px) { 38 --urlbar-container-min-width: 205px; 39 } 40 @media (max-width: 550px) { 41 --urlbar-container-min-width: 140px; 42 } 43 } 44 } 45 46 toolbar[inactive="true"] .urlbar, 47 #urlbar[actiontype="switchtab"][action-override] > .urlbar-input-container > #urlbar-label-box, 48 #urlbar:not([actiontype="switchtab"], [actiontype="extension"]) > .urlbar-input-container > #urlbar-label-box, 49 #urlbar:not([actiontype="switchtab"]) > .urlbar-input-container > #urlbar-label-box > #urlbar-label-switchtab, 50 #urlbar:not([actiontype="extension"]) > .urlbar-input-container > #urlbar-label-box > #urlbar-label-extension, 51 .urlbar-input-container[pageproxystate="invalid"] > #page-action-buttons > .urlbar-page-action, 52 #identity-box.chromeUI ~ #page-action-buttons > .urlbar-page-action:not(#star-button-box, #split-view-button), 53 #urlbar[usertyping] > .urlbar-input-container > #page-action-buttons > #urlbar-zoom-button, 54 .urlbar:not([usertyping]) > .urlbar-input-container > .urlbar-go-button, 55 .urlbar:not(#searchbar-new, [focused]) > .urlbar-input-container > .urlbar-go-button, 56 #urlbar-revert-button-container { 57 display: none; 58 } 59 60 /* When rich suggestions are enabled the urlbar identity icon is given extra padding to 61 * align the results and urlbar text */ 62 /* stylelint-disable-next-line media-query-no-invalid */ 63 @media -moz-pref("browser.urlbar.richSuggestions.featureGate") { 64 #identity-box[pageproxystate="invalid"] > .identity-box-button { 65 padding-inline: calc(6px + var(--urlbar-icon-padding)); 66 } 67 } 68 69 .urlbar-container { 70 padding-block: var(--urlbar-padding-block); 71 margin-inline: var(--urlbar-margin-inline); 72 73 :root[uidensity="touch"] & { 74 padding-block: 5px; 75 } 76 } 77 78 .urlbar { 79 display: flex; 80 flex-direction: row; 81 flex: 1; 82 box-sizing: border-box; 83 will-change: translate; 84 85 /* Reset UA popover rules */ 86 width: initial; 87 height: initial; 88 inset: auto; 89 border: none; 90 padding: initial; 91 overflow: initial; 92 color: initial; 93 background-color: initial; 94 } 95 96 .urlbar, 97 #searchbar { 98 /* Setting a min-width to let the location & search bars maintain a constant 99 * width in case they haven't been resized manually. (bug 965772) */ 100 min-width: 1px; 101 min-height: var(--urlbar-min-height); 102 text-shadow: none; 103 color: var(--toolbar-field-color); 104 105 /** 106 * System colors and widgets are set based on toolbar color. Since toolbar 107 * fields can be styled differently from the toolbar, we need to use the 108 * correct color scheme in toolbar fields. 109 */ 110 :root[lwt-toolbar-field="light"] & { 111 color-scheme: light; 112 } 113 :root[lwt-toolbar-field="dark"] & { 114 color-scheme: dark; 115 } 116 } 117 118 .urlbar[focused], 119 #searchbar:focus-within { 120 :root[lwt-toolbar-field-focus="light"] & { 121 color-scheme: light; 122 } 123 :root[lwt-toolbar-field-focus="dark"] & { 124 color-scheme: dark; 125 } 126 } 127 128 .urlbar-background, 129 #searchbar { 130 background-color: var(--toolbar-field-background-color); 131 background-clip: border-box; 132 border: var(--urlbar-container-border-width) solid var(--toolbar-field-border-color); 133 border-radius: var(--toolbarbutton-border-radius); 134 } 135 136 .urlbar-input-container, 137 #searchbar { 138 border-radius: var(--toolbarbutton-border-radius); 139 overflow: clip; 140 } 141 142 .urlbar-input, 143 #urlbar-scheme, 144 .searchbar-textbox { 145 flex: 1; 146 background-color: transparent; 147 color: inherit; 148 border: none; 149 border-radius: 0; 150 margin: 0; 151 padding: 0; 152 outline: none; 153 } 154 155 .urlbar-input { 156 mask-repeat: no-repeat; 157 unicode-bidi: plaintext; 158 text-align: match-parent; 159 160 /* Align URLs to the right in RTL mode. */ 161 &:-moz-locale-dir(rtl) { 162 text-align: right !important; 163 } 164 165 /* Make sure that the location bar's alignment changes according 166 to the input box direction if the user switches the text direction using 167 cmd_switchTextDirection (which applies a dir attribute to the <input>). */ 168 &[dir="ltr"]:-moz-locale-dir(rtl) { 169 text-align: left !important; 170 } 171 172 &[dir="rtl"]:-moz-locale-dir(ltr) { 173 text-align: right !important; 174 } 175 176 .urlbar:not([focused])[domaindir="ltr"] > .urlbar-input-container > .urlbar-input-box > & { 177 direction: ltr; 178 unicode-bidi: embed; 179 } 180 181 /* The following rules apply overflow masks to the unfocused urlbar 182 This mask may be overriden when a Contextual Feature Recommendation is shown. */ 183 .urlbar:not([focused])[textoverflow="both"] > .urlbar-input-container > .urlbar-input-box > & { 184 mask-image: linear-gradient(to right, transparent, black 3ch, black calc(100% - 3ch), transparent); 185 } 186 .urlbar:not([focused])[textoverflow="right"] > .urlbar-input-container > .urlbar-input-box > & { 187 mask-image: linear-gradient(to left, transparent, black 3ch); 188 } 189 .urlbar:not([focused])[textoverflow="left"] > .urlbar-input-container > .urlbar-input-box > & { 190 mask-image: linear-gradient(to right, transparent, black 3ch); 191 } 192 .urlbar:not([focused])[textoverflow="left"][domaindir="rtl"] > .urlbar-input-container > .urlbar-input-box > & { 193 mask-image: linear-gradient(to right, transparent var(--urlbar-scheme-size), black calc(var(--urlbar-scheme-size) + 3ch)); 194 } 195 } 196 197 #urlbar-scheme { 198 position: absolute; 199 height: 100%; 200 visibility: hidden; 201 direction: ltr; 202 pointer-events: none; 203 204 /* The protocol is visible if there is an RTL domain and we overflow to the left. 205 Uses the required-valid trick to check if it contains a value */ 206 #urlbar:not([focused])[textoverflow="left"][domaindir="rtl"] > .urlbar-input-container > .urlbar-input-box > &:valid { 207 visibility: visible; 208 } 209 } 210 211 [focused]:not([suppress-focus-border]) > .urlbar-background, 212 #searchbar:focus-within { 213 outline: var(--focus-outline); 214 215 /* We used --focus-outline above to inherit its width and style properties, 216 but we still want to use the theme's border-color. 217 --toolbar-field-focus-border-color is set equal to --focus-outline-color 218 on :root, but LWT themes can override this value. */ 219 outline-color: var(--toolbar-field-focus-border-color); 220 border-color: transparent; 221 } 222 223 [open] > .urlbar-background { 224 border-color: var(--arrowpanel-border-color); 225 box-shadow: 0 2px 14px rgba(0, 0, 0, 0.13); 226 227 /* The border moves outwards in the open state, so increase the radius 228 accordingly. */ 229 border-radius: calc(var(--toolbarbutton-border-radius) + 2px); 230 231 @media (-moz-platform: macos) and (prefers-contrast) { 232 /* The "increase contrast" preference on macOS draws a 1px black line around 233 panels, including the separate search bar. Since the Urlbar is not 234 implemented as a panel, it does not get this outline. This outline rule 235 resembles the system outline, bringing the Urlbar in line with panels and 236 other Mac apps. */ 237 outline: 1px solid var(--focus-outline-color); 238 } 239 } 240 241 .urlbar:is([focused], [open]), 242 #searchbar:focus-within { 243 color: var(--toolbar-field-focus-color); 244 } 245 246 .urlbar:is([focused], [open]) > .urlbar-background, 247 #searchbar:focus-within { 248 background-color: var(--toolbar-field-focus-background-color); 249 } 250 251 .urlbar-input::placeholder, 252 .searchbar-textbox::placeholder { 253 opacity: 0.69; 254 } 255 256 #TabsToolbar #searchbar:not(:focus-within) { 257 /* The tabs toolbar is usually a different color than the other toolbars, and 258 we can't predict it, to avoid a transparent field we enforce a border. */ 259 border-color: color-mix(in srgb, currentColor 20%, transparent); 260 } 261 262 :root[lwtheme] { 263 .urlbar-input::selection, 264 .searchbar-textbox::selection { 265 background-color: var(--lwt-toolbar-field-highlight, Highlight); 266 color: var(--lwt-toolbar-field-highlight-text, HighlightText); 267 } 268 269 .urlbar-input:not(:focus)::selection, 270 .searchbar-textbox:not(:focus-within)::selection { 271 background-color: var(--lwt-toolbar-field-highlight, text-select-disabled-background); 272 } 273 } 274 275 .urlbar:not([focused]) { 276 caret-color: transparent; 277 } 278 279 /** 280 * The urlbar background is a separate element so we can animate it 281 * independently from the content. It's positioned absolutely and stretched to 282 * the bounds of the urlbar. 283 */ 284 285 .urlbar, 286 .urlbar-input-container, 287 .urlbarView { 288 position: relative; 289 } 290 291 .urlbar-background { 292 display: block; 293 position: absolute; 294 inset: 0; 295 } 296 297 .urlbar-input-container { 298 border: var(--urlbar-container-border-width) solid transparent; 299 padding: var(--urlbar-container-padding); 300 min-width: 0; 301 } 302 303 .urlbar-container[breakout] { 304 min-height: var(--urlbar-container-height); 305 } 306 307 .urlbar[breakout] { 308 display: block; 309 /* This is technically not needed, because popover takes care of it, but 310 * helps for clarity. */ 311 position: absolute; 312 height: var(--urlbar-height); 313 width: var(--urlbar-width); 314 315 > .urlbar-input-container { 316 width: 100%; 317 height: 100%; 318 } 319 } 320 321 .urlbar:not([open]) > .urlbarView, 322 .urlbar:not([breakout]) > .urlbarView { 323 display: none; 324 } 325 326 .urlbar[breakout][breakout-extend] { 327 height: auto; 328 margin-left: calc(-1 * var(--urlbar-margin-inline)); 329 width: calc(var(--urlbar-width) + 2 * var(--urlbar-margin-inline)); 330 331 > .urlbar-input-container { 332 height: var(--urlbar-container-height); 333 padding-block: calc((var(--urlbar-container-height) - var(--urlbar-height)) / 2 + var(--urlbar-container-padding)); 334 padding-inline: calc(var(--urlbar-margin-inline) + var(--urlbar-container-padding)); 335 } 336 } 337 338 @keyframes urlbar-grow { 339 0% { 340 transform: scaleX(0.99) scaleY(0.98); 341 } 342 100% { 343 transform: scale(1); 344 } 345 } 346 347 [breakout][breakout-extend] > .urlbar-background { 348 animation-name: urlbar-grow; 349 animation-duration: 0s; 350 animation-timing-function: var(--animation-easing-function); 351 352 @media (prefers-reduced-motion: no-preference) { 353 [breakout-extend-animate] > & { 354 animation-duration: 150ms; 355 } 356 } 357 } 358 359 :root[chromehidden~="toolbar"] #urlbar-container { 360 /* Remove excess space between the address bar and the menu button in popups. */ 361 padding-inline-end: 0; 362 } 363 364 .urlbar-input-box { 365 /* Show the url scheme in a static box when overflowing to the left */ 366 position: relative; 367 direction: ltr; 368 369 :root[customizing] & { 370 visibility: hidden; 371 } 372 } 373 374 #urlbar-container { 375 align-items: center; 376 /* We leave a base width plus whatever space the download and unified extensions 377 * buttons will need when they *both* appear. Normally, for each button, this 378 * should be 16px for the icon, plus 2 * 2px padding plus the 379 * toolbarbutton-inner-padding. We're adding 4px to ensure things like rounding 380 * on hidpi don't accidentally result in the buttons going into overflow. 381 */ 382 width: calc(var(--urlbar-container-min-width) + 2 * (24px + 2 * var(--toolbarbutton-inner-padding))); 383 384 /* When the download button OR the unified extensions button is shown, we leave 385 * the base width plus the space needed for a single button as described above. */ 386 #nav-bar:is([downloadsbuttonshown], [unifiedextensionsbuttonshown]) & { 387 width: calc(var(--urlbar-container-min-width) + 24px + 2 * var(--toolbarbutton-inner-padding)); 388 } 389 390 /* When both the download and unified extensions buttons are visible, we use 391 * the base min-width value. */ 392 #nav-bar[downloadsbuttonshown][unifiedextensionsbuttonshown] & { 393 width: var(--urlbar-container-min-width); 394 } 395 396 /* Customize mode is difficult to use at moderate window width if the Urlbar 397 * remains as wide. */ 398 :root[customizing] & { 399 width: calc(var(--urlbar-container-min-width) - 30px); 400 } 401 } 402 403 #urlbar-container, 404 #wrapper-urlbar-container { 405 flex: 400 0 auto; 406 } 407 408 #nav-bar:not([keyNav="true"]) #identity-box, 409 #nav-bar:not([keyNav="true"]) #tracking-protection-icon-container { 410 -moz-user-focus: normal; 411 } 412 413 #identity-icon-box { 414 max-width: calc(30px + 13em); 415 } 416 417 @media (max-width: 770px) { 418 #identity-icon-box { 419 max-width: 80px; 420 } 421 /* This label expresses the non secure status. However, as the padlock icon is 422 enough to tell the status to user, hide the label when window gets small. 423 Except this usage, #identity-icon-label is used to show additional 424 information that could not tell by only icons. */ 425 #identity-box[pageproxystate="valid"].notSecureText #identity-icon-label { 426 display: none; 427 } 428 /* Contenxtual identity labels are user-customizable and can be very long, 429 so we only show the colored icon when the window gets small. */ 430 #userContext-label { 431 display: none; 432 } 433 } 434 435 /* The page actions menu is hidden by default, it is only shown in small 436 windows as the overflow target of multiple page action buttons */ 437 #pageActionButton { 438 /* TODO: display: none fixes browser_startup_images.js but breaks some tests. */ 439 display: none; 440 } 441 442 /* 680px is just below half of popular 1366px wide screens, so when putting two 443 browser windows next to each other on such a screen, they'll be above this 444 threshold. */ 445 @media (max-width: 680px) { 446 /* Page action buttons are duplicated in the page action menu so we can 447 safely hide them in small windows. */ 448 #pageActionSeparator, 449 #pageActionButton[multiple-children] ~ .urlbar-page-action { 450 display: none; 451 } 452 #pageActionButton[multiple-children] { 453 display: revert; 454 } 455 } 456 457 @media (max-width: 550px) { 458 #identity-icon-box { 459 max-width: 70px; 460 } 461 #urlbar-zoom-button { 462 display: none; 463 } 464 } 465 466 /* Allow shrinking the urlbar on popup windows */ 467 :root[chromehidden~="toolbar"] :is(#urlbar-container, #wrapper-urlbar-container) { 468 flex-shrink: 1; 469 min-width: 0; 470 } 471 472 #urlbar-search-splitter { 473 /* The splitter width should equal the location and search bars' combined 474 neighboring margin and border width. */ 475 min-width: 12px; 476 margin: 0 -6px; 477 position: relative; 478 border: none; 479 background: transparent; 480 appearance: none; 481 } 482 483 /* Urlbar search mode indicator */ 484 #urlbar-search-mode-indicator { 485 display: none; 486 background-color: var(--urlbar-box-bgcolor); 487 color: var(--urlbar-box-text-color); 488 margin-inline-end: 8px; 489 align-items: center; 490 border-radius: var(--urlbar-inner-border-radius); 491 padding-inline: 8px 6px; 492 493 #urlbar[focused] > .urlbar-input-container > & { 494 background-color: var(--urlbar-box-focus-bgcolor); 495 } 496 497 #urlbar[searchmode] > .urlbar-input-container > & { 498 display: inline-flex; 499 } 500 } 501 502 #urlbar-search-mode-indicator-close, 503 .searchmode-switcher-close { 504 background: url(chrome://global/skin/icons/close.svg) no-repeat center; 505 background-size: round(62.5%, 2px); 506 width: round(max(16px, 1em), 2px); 507 height: round(max(16px, 1em), 2px); 508 -moz-context-properties: fill, fill-opacity; 509 fill-opacity: 0.6; 510 fill: currentColor; 511 border-radius: var(--urlbar-inner-border-radius); 512 flex-shrink: 0; 513 514 @media (prefers-contrast) { 515 fill-opacity: 1; 516 } 517 518 &:hover { 519 background-color: var(--urlbar-box-hover-bgcolor); 520 color: var(--urlbar-box-hover-text-color); 521 522 &:active { 523 background-color: var(--urlbar-box-active-bgcolor); 524 color: var(--urlbar-box-hover-text-color); 525 } 526 } 527 } 528 529 #urlbar-search-mode-indicator-title { 530 padding-inline: 0 3px; 531 } 532 533 /* Page action panel */ 534 .pageAction-panel-button > .toolbarbutton-icon { 535 list-style-image: var(--pageAction-image, inherit); 536 width: 16px; 537 height: 16px; 538 } 539 540 #split-view-button { 541 &[data-active-index="0"] > #split-view-button-icon { 542 list-style-image: url("chrome://browser/skin/split-view-left-16.svg"); 543 } 544 &[data-active-index="1"] > #split-view-button-icon { 545 list-style-image: url("chrome://browser/skin/split-view-right-16.svg"); 546 } 547 548 &:dir(rtl) { 549 &[data-active-index="0"] > #split-view-button-icon { 550 list-style-image: url("chrome://browser/skin/split-view-right-16.svg"); 551 } 552 &[data-active-index="1"] > #split-view-button-icon { 553 list-style-image: url("chrome://browser/skin/split-view-left-16.svg"); 554 } 555 } 556 } 557 558 #pageAction-panel-bookmark, 559 #star-button { 560 list-style-image: url("chrome://browser/skin/bookmark-hollow.svg"); 561 562 &[starred] { 563 list-style-image: url("chrome://browser/skin/bookmark.svg"); 564 } 565 } 566 567 #star-button[starred] { 568 fill-opacity: 1; 569 fill: var(--toolbarbutton-icon-fill-attention); 570 } 571 572 /* URL bar and page action buttons */ 573 574 /* 575 * The background can be very dark and if the add-on uses a black-ish svg it 576 * will be barely visible. For now we try to make them more visible through 577 * some filtering tricks. 578 * 579 * TODO(emilio): Evaluate removing this. SVGs can use prefers-color-scheme to 580 * determine the right color-scheme to use, see bug 1779457. 581 */ 582 .urlbar-addon-page-action[style*=".svg"] > .urlbar-icon { 583 :root[lwt-toolbar-field="dark"] #urlbar:not([focused]) &, 584 :root[lwt-toolbar-field-focus="dark"] #urlbar[focused] & { 585 filter: grayscale(100%) brightness(20%) invert(); 586 } 587 588 /* As above, but for the default theme in dark mode, which suffers from the same issue */ 589 @media (prefers-color-scheme: dark) { 590 :root:not([lwtheme]) & { 591 filter: grayscale(100%) brightness(20%) invert(); 592 } 593 } 594 } 595 596 #userContext-icons, 597 #urlbar-zoom-button { 598 margin-inline: 6px; 599 } 600 601 .urlbar-icon { 602 width: 16px; 603 height: 16px; 604 -moz-context-properties: fill, fill-opacity; 605 fill: currentColor; 606 fill-opacity: var(--urlbar-icon-fill-opacity); 607 } 608 609 .urlbar-page-action, 610 .urlbar-revert-button, 611 .urlbar-go-button, 612 .search-go-button { 613 width: calc(var(--urlbar-min-height) - 2 * var(--urlbar-container-border-padding)); 614 height: calc(var(--urlbar-min-height) - 2 * var(--urlbar-container-border-padding)); 615 border-radius: var(--urlbar-inner-border-radius); 616 padding: var(--urlbar-icon-padding); 617 color: inherit; 618 outline: var(--toolbarbutton-outline); 619 outline-offset: var(--toolbarbutton-outline-offset); 620 621 &:not([disabled]):hover { 622 background-color: var(--urlbar-box-hover-bgcolor); 623 color: var(--urlbar-box-hover-text-color); 624 outline-color: var(--toolbarbutton-hover-outline-color); 625 } 626 627 &:not([disabled])[open], 628 &:not([disabled]):hover:active { 629 background-color: var(--urlbar-box-active-bgcolor); 630 color: var(--urlbar-box-hover-text-color); 631 outline-color: var(--toolbarbutton-active-outline-color); 632 } 633 } 634 635 .urlbar-page-action { 636 list-style-image: var(--pageAction-image, inherit); 637 638 &:focus-visible { 639 outline: var(--focus-outline); 640 outline-offset: var(--focus-outline-inset); 641 } 642 } 643 644 .urlbar-go-button, 645 .search-go-button { 646 list-style-image: url("chrome://browser/skin/forward.svg"); 647 648 &:-moz-locale-dir(rtl) { 649 transform: scaleX(-1); 650 } 651 } 652 653 #pageActionButton, 654 .share-more-button { 655 list-style-image: url("chrome://global/skin/icons/more.svg"); 656 } 657 658 /* 659 * Display visual cue that browser is under remote control. 660 * This is to help users visually distinguish a user agent session that 661 * is under remote control from those used for normal browsing sessions. 662 * 663 * Attribute is controlled by browser.js:/gRemoteControl. 664 */ 665 :root[remotecontrol] { 666 #remote-control-box { 667 visibility: visible; 668 padding-inline: var(--urlbar-icon-padding); 669 } 670 671 #remote-control-icon { 672 list-style-image: url(chrome://browser/content/static-robot.png); 673 width: 16px; 674 height: 16px; 675 } 676 677 .urlbar-background { 678 background-image: repeating-linear-gradient(-45deg, rgba(255, 60, 60, 0.25) 0 25px, rgba(175, 0, 0, 0.25) 25px 50px); 679 680 background-attachment: fixed; 681 /* Override the usual breakout animation so the gradient doesn't shift around 682 when the panel opens. */ 683 animation: none !important; 684 } 685 } 686 687 /** 688 * Contextual Feature Recommendation 689 * 690 * Animate the recommendation icon to expand outwards and display a text label. 691 * Fake the effect of a smoothly expanding width without animating any widths 692 * by (continuously) animating only `mask-position-x` and `transform`. 693 * 694 * In a few places, transition a property using the timing-function `step-start` 695 * while collapsed and `step-end` while expanded in order to (discretely) modify 696 * the value while expanded and while transitioning in either direction. 697 * 698 * This UI is part of an experiment launching in LTR locales only. Fixing the 699 * RTL issues is tracked by Bug 1485725. 700 */ 701 702 :root { 703 --cfr-animation-duration: 0.35s; 704 --cfr-button-addons-icon: url(chrome://activity-stream/content/data/content/assets/glyph-webextension-16.svg); 705 --cfr-button-features-icon: url(chrome://browser/content/asrouter/assets/glyph-cfr-feature-16.svg); 706 --cfr-button-highlights-icon: url(chrome://global/skin/icons/highlights.svg); 707 --cfr-active-color: #0060df; 708 --cfr-active-text-color: white; 709 } 710 711 #contextual-feature-recommendation { 712 width: 28px; 713 margin-inline-start: 0; 714 transition: margin-inline-start step-end var(--cfr-animation-duration); 715 716 #urlbar[cfr-recommendation-state="expanded"] & { 717 width: auto; 718 margin-inline-start: calc(var(--cfr-label-width) * -1); 719 transition: margin-inline-start step-start var(--cfr-animation-duration); 720 } 721 722 &[data-cfr-icon="recommendations-icon"] { 723 width: auto; 724 725 #cfr-button { 726 list-style-image: var(--cfr-button-features-icon); 727 height: auto; 728 align-items: center; 729 } 730 } 731 732 &[data-cfr-icon="highlights-icon"] { 733 width: auto; 734 735 #cfr-button { 736 list-style-image: var(--cfr-button-highlights-icon); 737 height: auto; 738 align-items: center; 739 } 740 } 741 742 &[data-cfr-icon="webextensions-icon"] #cfr-button { 743 list-style-image: var(--cfr-button-addons-icon); 744 } 745 } 746 747 #cfr-button { 748 transition-property: fill, fill-opacity, transform; 749 transition-timing-function: ease-in-out; 750 transition-duration: var(--cfr-animation-duration); 751 752 #urlbar[cfr-recommendation-state="expanded"] & { 753 background-color: transparent; 754 transform: translateX(calc(var(--cfr-label-width) * -1)); 755 756 &:-moz-locale-dir(rtl) { 757 transform: translateX(calc(var(--cfr-label-width))); 758 } 759 760 &, 761 .urlbar-icon { 762 fill: var(--cfr-active-text-color); 763 fill-opacity: 1; 764 } 765 } 766 767 #urlbar[cfr-recommendation-state="collapsed"] & { 768 animation: cfr-button-fade-through-active-color calc(3 * var(--cfr-animation-duration)); 769 } 770 } 771 772 @keyframes cfr-button-fade-through-active-color { 773 33% { 774 fill-opacity: 1; 775 fill: var(--cfr-active-color); 776 } 777 67% { 778 fill-opacity: 1; 779 fill: var(--cfr-active-color); 780 } 781 } 782 783 #cfr-label-container { 784 width: 0; 785 overflow: hidden; 786 border-radius: var(--urlbar-inner-border-radius); 787 padding-inline-start: 28px; 788 mask-image: linear-gradient(to right, transparent 0, black 0); 789 mask-position-x: var(--cfr-label-width); 790 mask-repeat: no-repeat; 791 transition-property: background-color, mask-position-x, width, margin-inline-end; 792 transition-timing-function: ease-in-out, ease-in-out, step-end, step-end; 793 transition-duration: var(--cfr-animation-duration); 794 align-items: center; 795 margin-block: calc((var(--urlbar-min-height) - 24px) / 2 - var(--urlbar-container-border-padding)); 796 797 &:-moz-locale-dir(rtl) { 798 mask-position-x: calc(var(--cfr-label-width) * -1); 799 } 800 801 #urlbar[cfr-recommendation-state="expanded"] & { 802 width: calc(var(--cfr-label-width) + 28px); 803 background-color: var(--cfr-active-color); 804 margin-inline-end: -28px; 805 mask-position-x: 0; 806 transition-timing-function: ease-in-out, ease-in-out, step-start, step-start; 807 } 808 } 809 810 #cfr-label { 811 margin: 0; 812 padding: 3px 5px; 813 padding-inline-start: 0; 814 color: white; 815 mask-image: linear-gradient(to right, transparent 0, black 0); 816 mask-position-x: var(--cfr-label-width); 817 mask-repeat: no-repeat; 818 transition: mask-position-x ease-in-out var(--cfr-animation-duration); 819 820 &:-moz-locale-dir(rtl) { 821 mask-position-x: calc(var(--cfr-label-width) * -1); 822 } 823 824 #urlbar[cfr-recommendation-state="expanded"] & { 825 mask-position-x: 0; 826 } 827 } 828 829 /* Shift the url-bar text fading to stop the recommendation overlapping */ 830 #urlbar[cfr-recommendation-state] .urlbar-input { 831 /* A mask-image is usually only defined for the url bar when text overflows. 832 We need to re-define the mask image here so that it shows up correctly when 833 we transition to or from an `expanded` state (in which the right end of the 834 url bar may be obscured without overflow). */ 835 mask-image: linear-gradient(to left, transparent, black 3ch); 836 transition: mask-position-x ease-in-out var(--cfr-animation-duration); 837 838 &:-moz-locale-dir(rtl) { 839 mask-image: linear-gradient(to right, transparent, black 3ch); 840 } 841 } 842 #urlbar[cfr-recommendation-state="expanded"] .urlbar-input { 843 mask-position-x: calc(var(--cfr-label-width) * -1); 844 845 &:-moz-locale-dir(rtl) { 846 mask-position-x: calc(var(--cfr-label-width)); 847 } 848 } 849 850 /* Persisted Search revert button */ 851 852 #urlbar-revert-button { 853 list-style-image: url(chrome://global/skin/icons/defaultFavicon.svg); 854 fill: var(--toolbarbutton-icon-fill-attention); 855 856 &:focus-visible { 857 outline: var(--focus-outline); 858 } 859 } 860 861 #urlbar[persistsearchterms] > .urlbar-input-container { 862 > #urlbar-revert-button-container { 863 display: inherit; 864 } 865 866 > .urlbar-go-button { 867 display: none; 868 } 869 } 870 871 /* Reader mode icon */ 872 873 #reader-mode-button > .urlbar-icon { 874 list-style-image: url(chrome://browser/skin/reader-mode.svg); 875 } 876 877 #reader-mode-button[readeractive] > .urlbar-icon { 878 fill: var(--toolbarbutton-icon-fill-attention); 879 fill-opacity: 1; 880 } 881 882 /* Picture-in-Picture icon */ 883 #picture-in-picture-button > .urlbar-icon { 884 list-style-image: url("chrome://global/skin/media/picture-in-picture-open.svg"); 885 } 886 887 #picture-in-picture-button[pipactive] > .urlbar-icon { 888 list-style-image: url("chrome://global/skin/media/picture-in-picture-closed.svg"); 889 } 890 891 #picture-in-picture-button:-moz-locale-dir(rtl) > .urlbar-icon { 892 transform: scaleX(-1); 893 } 894 895 /* Taskbar Tabs icon */ 896 897 #taskbar-tabs-button > .urlbar-icon { 898 list-style-image: url(chrome://browser/skin/taskbar-tabs-add-tab.svg); 899 :root[taskbartab] & { 900 list-style-image: url(chrome://browser/skin/taskbar-tabs-move-tab.svg); 901 } 902 } 903 904 /* Translations button */ 905 906 #translations-button-icon { 907 list-style-image: url(chrome://browser/skin/translations.svg); 908 /* The translation icon's right letter is 1px too long, so account for that here. 909 Don't use margin-inline-end as this is adjusting the art of the icon. */ 910 margin-right: -1px; 911 912 #translations-button[translationsactive] > & { 913 fill: var(--toolbarbutton-icon-fill-attention); 914 fill-opacity: 1; 915 } 916 } 917 918 #translations-button-circle-arrows { 919 height: 16px; 920 width: 16px; 921 list-style-image: url("chrome://global/skin/icons/loading.svg"); 922 fill: var(--toolbarbutton-icon-fill-attention); 923 fill-opacity: 1; 924 margin-inline: 1px; 925 } 926 927 #translations-button-locale { 928 background-color: var(--toolbarbutton-icon-fill-attention); 929 color: var(--toolbarbutton-icon-fill-attention-text); 930 border-radius: var(--border-radius-small); 931 font-size: 0.8em; 932 height: 20px; 933 min-width: 20px; 934 text-align: center; 935 padding-top: 3px; 936 padding-inline: 1px; 937 box-sizing: border-box; 938 margin-inline: 2px -2px; 939 margin-block: -2px; 940 } 941 942 #translations-button[translationsactive="true"] { 943 width: auto; 944 } 945 946 @media (prefers-contrast) and (-moz-platform: windows) { 947 #translations-button-locale { 948 font-weight: var(--font-weight-bold); 949 } 950 951 #translations-button[translationsactive]:is(:hover, [open]) > #translations-button-icon { 952 fill: currentColor; 953 } 954 955 #translations-button:is(:hover, [open]) > #translations-button-locale { 956 background-color: var(--toolbar-field-background-color); 957 color: var(--toolbarbutton-icon-fill-attention); 958 } 959 960 #translations-button:is(:hover, [open]) > #translations-button-circle-arrows { 961 fill: currentColor; 962 } 963 } 964 965 /* Zoom button */ 966 967 #urlbar-zoom-button { 968 appearance: none; 969 font-size: 0.8em; 970 padding: 3px 7px; 971 border-radius: var(--urlbar-inner-border-radius); 972 background-color: var(--urlbar-box-bgcolor); 973 color: var(--urlbar-box-text-color); 974 margin-block: calc((var(--urlbar-min-height) - 20px) / 2 - var(--urlbar-container-border-padding)); 975 overflow: hidden; 976 977 :where(#urlbar[focused]) & { 978 background-color: var(--urlbar-box-focus-bgcolor); 979 } 980 981 &:hover { 982 background-color: var(--urlbar-box-hover-bgcolor); 983 color: var(--urlbar-box-hover-text-color); 984 985 &:active { 986 background-color: var(--urlbar-box-active-bgcolor); 987 color: var(--urlbar-box-hover-text-color); 988 } 989 } 990 991 &[animate="true"] { 992 animation-name: urlbar-zoom-reset-pulse; 993 animation-duration: 250ms; 994 } 995 996 &:focus-visible { 997 outline: var(--focus-outline); 998 outline-offset: var(--focus-outline-inset); 999 } 1000 1001 > .toolbarbutton-text { 1002 display: flex; 1003 } 1004 1005 > .toolbarbutton-icon { 1006 display: none; 1007 } 1008 } 1009 1010 @keyframes urlbar-zoom-reset-pulse { 1011 0% { 1012 transform: scale(0); 1013 } 1014 75% { 1015 transform: scale(1.5); 1016 } 1017 100% { 1018 transform: scale(1); 1019 } 1020 } 1021 1022 /* Search bar */ 1023 1024 #search-container, 1025 #wrapper-search-container:not([place="panel"]) { 1026 flex: 175 175 auto; 1027 } 1028 1029 #search-container { 1030 min-width: 125px; 1031 width: 125px; 1032 1033 &[width] { 1034 /* Take something closer to the explicit width when requested. Also important 1035 * to use flex-basis auto so that the width is actually honored. */ 1036 flex: 1 auto; 1037 } 1038 1039 .widget-overflow-list > & { 1040 margin: var(--arrowpanel-menuitem-margin); 1041 width: auto; 1042 1043 :root[lwtheme] & > #searchbar { 1044 /* Theme authors usually only consider contrast against the toolbar when 1045 picking a border color for the search bar. Since the search bar can be 1046 dragged into the overflow panel, we need to show a high-contrast border 1047 around the searchbar in case the searchbar and panel background are the 1048 same color. */ 1049 border-color: var(--panel-separator-color); 1050 } 1051 } 1052 } 1053 1054 /* stylelint-disable-next-line media-query-no-invalid */ 1055 @media not -moz-pref("browser.search.widget.new") { 1056 #searchbar-new { 1057 display: none; 1058 } 1059 } 1060 /* stylelint-disable-next-line media-query-no-invalid */ 1061 @media -moz-pref("browser.search.widget.new") { 1062 #searchbar { 1063 display: none; 1064 } 1065 } 1066 1067 .search-go-button { 1068 margin-inline: 1px; 1069 } 1070 1071 .searchbar-search-button { 1072 align-items: center; 1073 fill: currentColor; 1074 } 1075 1076 .searchbar-search-icon { 1077 list-style-image: url(chrome://global/skin/icons/search-glass.svg); 1078 -moz-context-properties: fill, fill-opacity; 1079 fill-opacity: var(--urlbar-icon-fill-opacity); 1080 pointer-events: none; 1081 margin-inline: 8px 6px; 1082 width: 16px; 1083 } 1084 1085 .searchbar-search-icon-overlay { 1086 pointer-events: none; 1087 1088 .searchbar-search-button[addengines="true"] > & { 1089 list-style-image: url(chrome://browser/skin/search-indicator-badge-add.svg); 1090 margin-inline: -15px 4px; 1091 margin-top: -10px; 1092 width: 11px; 1093 height: 11px; 1094 1095 &:-moz-locale-dir(rtl) { 1096 margin-inline: -25px 14px; 1097 } 1098 } 1099 1100 .searchbar-search-button:hover:not([addengines="true"]) > & { 1101 list-style-image: url(chrome://global/skin/icons/arrow-down-12.svg); 1102 -moz-context-properties: fill; 1103 margin-inline: -8px 2px; 1104 width: 6px; 1105 height: 6px; 1106 1107 &:-moz-locale-dir(rtl) { 1108 margin-inline: -26px 20px; 1109 } 1110 } 1111 } 1112 1113 .searchbar-engine-one-off-add-engine:not([image]), 1114 .context-menu-add-engine:not([image]) { 1115 list-style-image: image-set(url("chrome://browser/skin/search-engine-placeholder.png"), url("chrome://browser/skin/search-engine-placeholder@2x.png") 2x); 1116 } 1117 1118 .searchbar-engine-one-off-add-engine > .button-box, 1119 .context-menu-add-engine { 1120 position: relative; 1121 1122 &::before { 1123 content: ""; 1124 position: absolute; 1125 display: block; 1126 background: url(chrome://browser/skin/search-indicator-badge-add.svg) no-repeat center; 1127 height: 11px; 1128 width: 11px; 1129 margin-inline-start: 9px; 1130 margin-top: -8px; 1131 /* Needed so it paints after the icon when it is a stacking context (with 1132 * opacity, below) */ 1133 z-index: 1; 1134 } 1135 } 1136 1137 /* Fade a little the icon so that the + badge is more evident and the button 1138 is less likely to be visually confused with a normal search shortcut */ 1139 .searchbar-engine-one-off-add-engine[image]:not(:hover) > .button-box > .button-icon { 1140 opacity: 0.7; 1141 } 1142 1143 .searchmode-switcher { 1144 appearance: none; 1145 border-radius: var(--urlbar-inner-border-radius); 1146 margin: 0; 1147 margin-inline-end: var(--urlbar-searchmodeswitcher-margin-inline-end); 1148 padding-inline: var(--urlbar-searchmodeswitcher-inline-padding); 1149 1150 &:focus-visible { 1151 outline: var(--focus-outline); 1152 outline-offset: var(--focus-outline-inset); 1153 } 1154 1155 &[open] { 1156 background-color: var(--urlbar-box-focus-bgcolor); 1157 } 1158 1159 /* No need space if page information icons such as lock and shield is shown */ 1160 .urlbar[pageproxystate="valid"] & { 1161 margin-inline-end: 0; 1162 } 1163 1164 .urlbar[searchmode] & { 1165 background-color: var(--urlbar-box-bgcolor); 1166 margin-inline-end: 0; 1167 border-start-end-radius: 0; 1168 border-end-end-radius: 0; 1169 } 1170 1171 /* The background rule should match to .searchmode-switcher-chicklet */ 1172 .urlbar[focused] & { 1173 background-color: var(--urlbar-box-focus-bgcolor); 1174 } 1175 1176 /* stylelint-disable media-query-no-invalid */ 1177 @media (not -moz-pref("browser.urlbar.searchModeSwitcher.featureGate")) and (not -moz-pref("browser.urlbar.scotchBonnet.enableOverride")) { 1178 display: none; 1179 } 1180 /* stylelint-enable media-query-no-invalid */ 1181 } 1182 1183 .searchmode-switcher-icon { 1184 width: 16px; 1185 height: 16px; 1186 -moz-context-properties: fill; 1187 fill: currentColor; 1188 list-style-image: url("chrome://global/skin/icons/search-glass.svg"); 1189 } 1190 1191 .searchmode-switcher-chicklet { 1192 background-color: var(--urlbar-box-bgcolor); 1193 border-start-end-radius: var(--urlbar-inner-border-radius); 1194 border-end-end-radius: var(--urlbar-inner-border-radius); 1195 align-items: center; 1196 height: 100%; 1197 max-width: 40%; 1198 margin-inline-end: var(--urlbar-searchmodeswitcher-margin-inline-end); 1199 display: none; 1200 1201 /* stylelint-disable-next-line media-query-no-invalid */ 1202 @media -moz-pref("browser.urlbar.searchModeSwitcher.featureGate") or -moz-pref("browser.urlbar.scotchBonnet.enableOverride") { 1203 .urlbar[searchmode] & { 1204 display: inline-flex; 1205 } 1206 } 1207 1208 .urlbar[focused] & { 1209 background-color: var(--urlbar-box-focus-bgcolor); 1210 } 1211 } 1212 1213 .searchmode-switcher-title { 1214 margin: 0; 1215 align-items: center; 1216 text-overflow: ellipsis; 1217 overflow: hidden; 1218 white-space: nowrap; 1219 max-width: var(--search-engine-name-max-width); 1220 margin-inline-end: var(--urlbar-searchmodeswitcher-inline-padding); 1221 1222 &:empty { 1223 display: none; 1224 } 1225 1226 #searchbar-new & { 1227 display: none; 1228 } 1229 } 1230 1231 .searchmode-switcher-close { 1232 appearance: none; 1233 pointer-events: all; 1234 margin-inline-end: var(--urlbar-searchmodeswitcher-inline-padding); 1235 1236 .urlbar[searchmode] & { 1237 display: inline-flex; 1238 } 1239 } 1240 1241 .searchmode-switcher-dropmarker { 1242 @media (prefers-reduced-motion: no-preference) { 1243 transition: 300ms transform ease-in-out; 1244 } 1245 1246 .urlbar[searchmode] & { 1247 display: none; 1248 } 1249 .searchmode-switcher[open] > & { 1250 transform: rotate(-180deg); 1251 1252 &:-moz-locale-dir(rtl) { 1253 transform: rotate(180deg); 1254 } 1255 } 1256 } 1257 1258 .searchmode-switcher-popup { 1259 --panel-padding: 4px 0; 1260 max-width: var(--search-engine-name-max-width); 1261 1262 > menuitem { 1263 margin-inline: 4px; 1264 1265 &.searchmode-switcher-addEngine::before { 1266 content: ""; 1267 position: relative; 1268 display: flex; 1269 background: url(chrome://browser/skin/search-indicator-badge-add.svg) no-repeat center; 1270 height: 11px; 1271 width: 11px; 1272 margin-inline: 10px -21px; 1273 margin-top: -13px; 1274 } 1275 } 1276 } 1277 1278 .searchmode-switcher-popup-description { 1279 margin-inline: 4px; 1280 padding: var(--arrowpanel-menuitem-padding); 1281 } 1282 1283 .searchmode-switcher-popup-search-settings-button, 1284 .searchmode-switcher-local { 1285 -moz-context-properties: fill; 1286 fill: currentColor; 1287 } 1288 1289 /* stylelint-disable-next-line media-query-no-invalid */ 1290 @media -moz-pref("browser.urlbar.searchModeSwitcher.featureGate") or -moz-pref("browser.urlbar.scotchBonnet.enableOverride") { 1291 #urlbar[searchmode] > .urlbar-input-container > #urlbar-search-mode-indicator { 1292 display: none; 1293 } 1294 1295 /* stylelint-disable-next-line media-query-no-invalid */ 1296 @media not -moz-pref("browser.urlbar.unifiedSearchButton.always") { 1297 .searchmode-switcher { 1298 background-color: var(--urlbar-box-bgcolor); 1299 .urlbar:not([unifiedsearchbutton-available]) > .urlbar-input-container > & { 1300 /* Display as off-screen to get focus */ 1301 position: fixed; 1302 top: -999px; 1303 } 1304 } 1305 1306 .searchmode-switcher-dropmarker { 1307 margin-inline-start: var(--urlbar-searchmodeswitcher-inline-padding); 1308 } 1309 1310 #urlbar[pageproxystate="invalid"] { 1311 #identity-box, 1312 #tracking-protection-icon-container { 1313 display: none; 1314 } 1315 } 1316 } 1317 }