[Generic viewer] Re-factor how the notFound appearance is set on the "findInput" in the PDFFindBar

Rather than having two slightly different ways of setting the pending/notFound appearance on the "findInput", we can simply use "data-status" in both cases since they're obviously mutually exclusive.
This commit is contained in:
Jonas Jenwald 2020-12-02 15:23:20 +01:00
parent 956fcab967
commit 313ee28436
2 changed files with 4 additions and 8 deletions

View File

@ -104,7 +104,6 @@ class PDFFindBar {
} }
updateUIState(state, previous, matchesCount) { updateUIState(state, previous, matchesCount) {
let notFound = false;
let findMsg = ""; let findMsg = "";
let status = ""; let status = "";
@ -118,7 +117,7 @@ class PDFFindBar {
case FindState.NOT_FOUND: case FindState.NOT_FOUND:
findMsg = this.l10n.get("find_not_found", null, "Phrase not found"); findMsg = this.l10n.get("find_not_found", null, "Phrase not found");
notFound = true; status = "notFound";
break; break;
case FindState.WRAPPED: case FindState.WRAPPED:
@ -137,8 +136,6 @@ class PDFFindBar {
} }
break; break;
} }
this.findField.classList.toggle("notFound", notFound);
this.findField.setAttribute("data-status", status); this.findField.setAttribute("data-status", status);
Promise.resolve(findMsg).then(msg => { Promise.resolve(findMsg).then(msg => {

View File

@ -582,6 +582,9 @@ html[dir="rtl"] #findInput {
html[dir="rtl"] #findInput[data-status="pending"] { html[dir="rtl"] #findInput[data-status="pending"] {
background-position: 3px; background-position: 3px;
} }
#findInput[data-status="notFound"] {
background-color: rgba(255, 102, 102, 1);
}
.secondaryToolbar { .secondaryToolbar {
padding: 6px 0 10px 0; padding: 6px 0 10px 0;
@ -682,10 +685,6 @@ html[dir="ltr"] .doorHangerRight:before {
display: none; display: none;
} }
#findInput.notFound {
background-color: rgba(255, 102, 102, 1);
}
#toolbarViewerMiddle { #toolbarViewerMiddle {
position: absolute; position: absolute;
left: 50%; left: 50%;