Merge pull request #15842 from Snuffleupagus/gv-pageLayout

[GeckoView] Ignore the pageLayout, from the PDF document, to prevent issues
This commit is contained in:
Jonas Jenwald 2022-12-16 17:56:18 +01:00 committed by GitHub
commit 18eb1a0ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -1236,7 +1236,10 @@ const PDFViewerApplication = {
if (pageMode && sidebarView === SidebarView.UNKNOWN) {
sidebarView = apiPageModeToSidebarView(pageMode);
}
// NOTE: Always ignore the pageLayout in GeckoView since there's
// no UI available to change Scroll/Spread modes for the user.
if (
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("GECKOVIEW")) &&
pageLayout &&
scrollMode === ScrollMode.UNKNOWN &&
spreadMode === SpreadMode.UNKNOWN

View File

@ -265,13 +265,19 @@ class PDFScriptingManager {
case "error":
console.error(value);
break;
case "layout":
if (isInPresentationMode) {
case "layout": {
// NOTE: Always ignore the pageLayout in GeckoView since there's
// no UI available to change Scroll/Spread modes for the user.
if (
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("GECKOVIEW")) ||
isInPresentationMode
) {
return;
}
const modes = apiPageLayoutToViewerModes(value);
this._pdfViewer.spreadMode = modes.spreadMode;
break;
}
case "page-num":
this._pdfViewer.currentPageNumber = value + 1;
break;

View File

@ -769,9 +769,6 @@ function getActiveOrFocusedElement() {
/**
* Converts API PageLayout values to the format used by `BaseViewer`.
* NOTE: This is supported to the extent that the viewer implements the
* necessary Scroll/Spread modes (since SinglePage, TwoPageLeft,
* and TwoPageRight all suggests using non-continuous scrolling).
* @param {string} mode - The API PageLayout value.
* @returns {Object}
*/