-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't hide the different layers when zooming #19186
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,8 @@ class PDFPageView { | |
|
||
#scaleRoundY = 1; | ||
|
||
#structTreeDOM = null; | ||
|
||
#renderError = null; | ||
|
||
#renderingState = RenderingStates.INITIAL; | ||
|
@@ -482,11 +484,12 @@ class PDFPageView { | |
* aria-owns to work. | ||
*/ | ||
async #renderStructTreeLayer() { | ||
if (!this.textLayer) { | ||
if (!this.textLayer || this.#structTreeDOM) { | ||
return; | ||
} | ||
|
||
const treeDom = await this.structTreeLayer?.render(); | ||
const treeDom = (this.#structTreeDOM = | ||
await this.structTreeLayer?.render()); | ||
if (treeDom) { | ||
this.l10n.pause(); | ||
this.structTreeLayer?.addElementsToTextLayer(); | ||
|
@@ -563,23 +566,9 @@ class PDFPageView { | |
} | ||
div.removeAttribute("data-loaded"); | ||
|
||
if (annotationLayerNode) { | ||
// Hide the annotation layer until all elements are resized | ||
// so they are not displayed on the already resized page. | ||
this.annotationLayer.hide(); | ||
} | ||
if (annotationEditorLayerNode) { | ||
this.annotationEditorLayer.hide(); | ||
} | ||
if (xfaLayerNode) { | ||
// Hide the XFA layer until all elements are resized | ||
// so they are not displayed on the already resized page. | ||
this.xfaLayer.hide(); | ||
} | ||
Comment on lines
-574
to
-578
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that the xfaLayer is a bit special, is keeping it visible actually correct and safe in general? Ninja-edit: Testing the preview the answer unfortunately seems to be NO, since scrolling to the end of an XFA document and then rotating it triggers intermittent rendering glitches (since pages that are not visible will not be updated until they are scrolled into view again). |
||
if (textLayerNode) { | ||
this.textLayer.hide(); | ||
} | ||
this.structTreeLayer?.hide(); | ||
|
||
if (!keepCanvasWrapper && this.#canvasWrapper) { | ||
this.#canvasWrapper = null; | ||
|
@@ -761,6 +750,8 @@ class PDFPageView { | |
} | ||
if (this.structTreeLayer && !this.textLayer) { | ||
this.structTreeLayer = null; | ||
this.#structTreeDOM?.remove(); | ||
this.#structTreeDOM = null; | ||
} | ||
if ( | ||
this.annotationEditorLayer && | ||
|
@@ -984,15 +975,23 @@ class PDFPageView { | |
// Don't add the canvas until the first draw callback, or until | ||
// drawing is complete when `!this.renderingQueue`, to prevent black | ||
// flickering. | ||
this.l10n.pause(); | ||
canvasWrapper.append(canvas); | ||
this.l10n.resume(); | ||
showCanvas = null; | ||
return; | ||
} | ||
if (!isLastShow) { | ||
return; | ||
} | ||
|
||
this.l10n.pause(); | ||
if (prevCanvas) { | ||
if (this.#structTreeDOM) { | ||
// Add the struct tree now in order to minimize the number of reflows. | ||
canvas.append(this.#structTreeDOM); | ||
this.structTreeLayer.show(); | ||
} | ||
prevCanvas.replaceWith(canvas); | ||
prevCanvas.width = prevCanvas.height = 0; | ||
} else { | ||
|
@@ -1001,6 +1000,7 @@ class PDFPageView { | |
// have a final flash we just display it once all the drawing is done. | ||
canvasWrapper.append(canvas); | ||
} | ||
this.l10n.resume(); | ||
|
||
showCanvas = null; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about pages that are still active in the
PDFPageViewBuffer
buffer, but not currently visible?These annotation-related layers won't have e.g. their rotation updated until they become visible again, and it's not clear to me if that could cause them to overflow their respective page-containers (similar to the xfaLayer) and thus potentially "mess" with layout?