diff --git a/web/images/loading-dark.svg b/web/images/loading-dark.svg deleted file mode 100644 index fa5269b1a396d..0000000000000 --- a/web/images/loading-dark.svg +++ /dev/null @@ -1,24 +0,0 @@ - \ No newline at end of file diff --git a/web/toolbar.js b/web/toolbar.js index 3d33cdce75876..30b80e688ea72 100644 --- a/web/toolbar.js +++ b/web/toolbar.js @@ -22,8 +22,6 @@ import { toggleCheckedBtn, } from "./ui_utils.js"; -const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading"; - /** * @typedef {Object} ToolbarOptions * @property {HTMLDivElement} container - Container for the secondary toolbar. @@ -300,7 +298,7 @@ class Toolbar { updateLoadingIndicatorState(loading = false) { const { pageNumber } = this.items; - pageNumber.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading); + pageNumber.classList.toggle("loading", loading); } } diff --git a/web/viewer.css b/web/viewer.css index 3594483f9a087..b271e9802ae55 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -168,11 +168,6 @@ --doorhanger-separator-color: rgb(92 92 97); --dialog-button-bg-color: rgb(92 92 97); --dialog-button-hover-bg-color: rgb(115 115 115); - - /* This image is used in elements, which unfortunately means that - * the `mask-image` approach used with all of the other images doesn't work - * here; hence why we still have two versions of this particular image. */ - --loading-icon: url(images/loading-dark.svg); } } @@ -494,22 +489,21 @@ body { #findInput { width: 200px; -} -/*#if !MOZCENTRAL*/ -#findInput::-webkit-input-placeholder { - color: rgb(191 191 191); -} -/*#endif*/ -#findInput::placeholder { - font-style: normal; -} -#findInput[data-status="pending"] { - background-image: var(--loading-icon); - background-repeat: no-repeat; - background-position: calc(50% + 48% * var(--dir-factor)); -} -#findInput[data-status="notFound"] { - background-color: rgb(255 102 102); + + /*#if !MOZCENTRAL*/ + &::-webkit-input-placeholder { + color: rgb(191 191 191); + } + /*#endif*/ + &::placeholder { + font-style: normal; + } + .loadingInput:has(> &[data-status="pending"])::after { + visibility: visible; + } + &[data-status="notFound"] { + background-color: rgb(255 102 102); + } } .secondaryToolbar, @@ -1100,22 +1094,42 @@ a:is(.toolbarButton, .secondaryToolbarButton)[href="#"] { width: 40px; background-size: 0 0; transition-property: none; + + /*#if !MOZCENTRAL*/ + &::-webkit-inner-spin-button { + -webkit-appearance: none; + } + /*#endif*/ + + .loadingInput:has(> &.loading)::after { + visibility: visible; + + transition-property: visibility; + transition-delay: var(--loading-icon-delay); + } } -#pageNumber.visiblePageIsLoading { - background-image: var(--loading-icon); - background-repeat: no-repeat; - background-position: calc(50% - 42% * var(--dir-factor)); - background-size: 16px 16px; - /* Using a delay with background-image doesn't work, - consequently we use background-size. */ - transition-property: background-size; - transition-delay: var(--loading-icon-delay); -} -/*#if !MOZCENTRAL*/ -#pageNumber::-webkit-inner-spin-button { - -webkit-appearance: none; + +.loadingInput { + &::after { + position: absolute; + visibility: hidden; + top: calc(50% - 8px); + width: 16px; + height: 16px; + + content: ""; + background-color: var(--toolbar-icon-bg-color); + mask-size: cover; + mask-image: var(--loading-icon); + } + + &.start::after { + inset-inline-start: 4px; + } + &.end::after { + inset-inline-end: 4px; + } } -/*#endif*/ .toolbarField:focus { border-color: #0a84ff; diff --git a/web/viewer.html b/web/viewer.html index 32bf487caf071..c9acfd416c904 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -138,7 +138,9 @@