mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Skip the scroll/scrollend workaround in the Firefox PDF Viewer (PR 17724 follow-up)
Given that [bug 1881974](https://bugzilla.mozilla.org/show_bug.cgi?id=1881974) has been fixed in Firefox 126, the workaround should no longer be necessary in the *built-in* Firefox PDF Viewer.
This commit is contained in:
parent
46a29ff41b
commit
ff2e0c8afd
1 changed files with 19 additions and 12 deletions
31
web/app.js
31
web/app.js
|
@ -177,8 +177,6 @@ const PDFViewerApplication = {
|
|||
_nimbusDataPromise: null,
|
||||
_caretBrowsing: null,
|
||||
_isScrolling: false,
|
||||
_lastScrollTop: 0,
|
||||
_lastScrollLeft: 0,
|
||||
|
||||
// Called once when the document is loaded.
|
||||
async initialize(appConfig) {
|
||||
|
@ -2002,15 +2000,20 @@ const PDFViewerApplication = {
|
|||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Using the values lastScrollTop and lastScrollLeft is a workaround to
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1881974.
|
||||
// TODO: remove them once the bug is fixed.
|
||||
({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =
|
||||
mainContainer);
|
||||
const scrollend = () => {
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
// Using the values lastScrollTop and lastScrollLeft is a workaround to
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1881974.
|
||||
// TODO: remove them once the bug is fixed.
|
||||
({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =
|
||||
mainContainer);
|
||||
}
|
||||
|
||||
const scrollend = () => {
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =
|
||||
mainContainer);
|
||||
}
|
||||
|
||||
this._isScrolling = false;
|
||||
mainContainer.addEventListener("scroll", scroll, {
|
||||
passive: true,
|
||||
|
@ -2020,13 +2023,17 @@ const PDFViewerApplication = {
|
|||
mainContainer.removeEventListener("blur", scrollend, { signal });
|
||||
};
|
||||
const scroll = () => {
|
||||
if (this._isCtrlKeyDown) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
this._isCtrlKeyDown ||
|
||||
(this._lastScrollTop === mainContainer.scrollTop &&
|
||||
this._lastScrollLeft === mainContainer.scrollLeft)
|
||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) &&
|
||||
this._lastScrollTop === mainContainer.scrollTop &&
|
||||
this._lastScrollLeft === mainContainer.scrollLeft
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainContainer.removeEventListener("scroll", scroll, {
|
||||
passive: true,
|
||||
signal,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue