Merge pull request #10071 from Snuffleupagus/matchesCount-FirefoxCom-forward
Enable forwarding, in `FirefoxCom`, of the matchesCount to the browser findbar (bug 1062025)
This commit is contained in:
commit
a85ee3616e
@ -212,7 +212,7 @@ PDFViewerApplication.externalServices = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateFindMatchesCount(data) {
|
updateFindMatchesCount(data) {
|
||||||
// FirefoxCom.request('updateFindMatchesCount', data);
|
FirefoxCom.request('updateFindMatchesCount', data);
|
||||||
},
|
},
|
||||||
|
|
||||||
initPassiveLoading(callbacks) {
|
initPassiveLoading(callbacks) {
|
||||||
|
@ -161,16 +161,33 @@ class PDFFindBar {
|
|||||||
|
|
||||||
if (total) {
|
if (total) {
|
||||||
if (total > limit) {
|
if (total > limit) {
|
||||||
matchesCountMsg = this.l10n.get('find_matches_count_limit', {
|
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {
|
||||||
n: limit,
|
// TODO: Remove this hard-coded `[other]` form once plural support has
|
||||||
limit: limit.toLocaleString(),
|
// been implemented in the mozilla-central specific `l10n.js` file.
|
||||||
}, 'More than {{limit}} match' + (limit !== 1 ? 'es' : ''));
|
matchesCountMsg = this.l10n.get('find_matches_count_limit[other]', {
|
||||||
|
limit: limit.toLocaleString(),
|
||||||
|
}, 'More than {{limit}} matches');
|
||||||
|
} else {
|
||||||
|
matchesCountMsg = this.l10n.get('find_matches_count_limit', {
|
||||||
|
n: limit,
|
||||||
|
limit: limit.toLocaleString(),
|
||||||
|
}, 'More than {{limit}} match' + (limit !== 1 ? 'es' : ''));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
matchesCountMsg = this.l10n.get('find_matches_count', {
|
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {
|
||||||
n: total,
|
// TODO: Remove this hard-coded `[other]` form once plural support has
|
||||||
current: current.toLocaleString(),
|
// been implemented in the mozilla-central specific `l10n.js` file.
|
||||||
total: total.toLocaleString(),
|
matchesCountMsg = this.l10n.get('find_matches_count[other]', {
|
||||||
}, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : ''));
|
current: current.toLocaleString(),
|
||||||
|
total: total.toLocaleString(),
|
||||||
|
}, '{{current}} of {{total}} matches');
|
||||||
|
} else {
|
||||||
|
matchesCountMsg = this.l10n.get('find_matches_count', {
|
||||||
|
n: total,
|
||||||
|
current: current.toLocaleString(),
|
||||||
|
total: total.toLocaleString(),
|
||||||
|
}, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : ''));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Promise.resolve(matchesCountMsg).then((msg) => {
|
Promise.resolve(matchesCountMsg).then((msg) => {
|
||||||
|
@ -510,7 +510,7 @@ class PDFFindController {
|
|||||||
// When searching starts, this method may be called before the `pageMatches`
|
// When searching starts, this method may be called before the `pageMatches`
|
||||||
// have been counted (in `_calculateMatch`). Ensure that the UI won't show
|
// have been counted (in `_calculateMatch`). Ensure that the UI won't show
|
||||||
// temporarily broken state when the active find result doesn't make sense.
|
// temporarily broken state when the active find result doesn't make sense.
|
||||||
if (current > total) {
|
if (current < 1 || current > total) {
|
||||||
current = total = 0;
|
current = total = 0;
|
||||||
}
|
}
|
||||||
return { current, total, };
|
return { current, total, };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user