Merge pull request #14225 from Snuffleupagus/render-better-holes-check
Avoid doing unnecessary checks, when pre-rendering page layouts with "holes" (PR 14131 follow-up)
This commit is contained in:
commit
2ac6c939a5
@ -115,13 +115,13 @@ class PDFRenderingQueue {
|
|||||||
* 2. if last scrolled down, the page after the visible pages, or
|
* 2. if last scrolled down, the page after the visible pages, or
|
||||||
* if last scrolled up, the page before the visible pages
|
* if last scrolled up, the page before the visible pages
|
||||||
*/
|
*/
|
||||||
const visibleViews = visible.views;
|
const visibleViews = visible.views,
|
||||||
|
numVisible = visibleViews.length;
|
||||||
|
|
||||||
const numVisible = visibleViews.length;
|
|
||||||
if (numVisible === 0) {
|
if (numVisible === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < numVisible; ++i) {
|
for (let i = 0; i < numVisible; i++) {
|
||||||
const view = visibleViews[i].view;
|
const view = visibleViews[i].view;
|
||||||
if (!this.isViewFinished(view)) {
|
if (!this.isViewFinished(view)) {
|
||||||
return view;
|
return view;
|
||||||
@ -132,7 +132,7 @@ class PDFRenderingQueue {
|
|||||||
|
|
||||||
// All the visible views have rendered; try to handle any "holes" in the
|
// All the visible views have rendered; try to handle any "holes" in the
|
||||||
// page layout (can happen e.g. with spreadModes at higher zoom levels).
|
// page layout (can happen e.g. with spreadModes at higher zoom levels).
|
||||||
if (lastId - firstId > 1) {
|
if (lastId - firstId + 1 > numVisible) {
|
||||||
for (let i = 1, ii = lastId - firstId; i < ii; i++) {
|
for (let i = 1, ii = lastId - firstId; i < ii; i++) {
|
||||||
const holeId = scrolledDown ? firstId + i : lastId - i,
|
const holeId = scrolledDown ? firstId + i : lastId - i,
|
||||||
holeView = views[holeId - 1];
|
holeView = views[holeId - 1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user