Merge pull request #16018 from Snuffleupagus/GeckoView-skip-pageLabels
[GeckoView] Skip fetching/parsing of pageLabels
This commit is contained in:
		
						commit
						72abcedf48
					
				
							
								
								
									
										22
									
								
								web/app.js
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								web/app.js
									
									
									
									
									
								
							| @ -467,7 +467,9 @@ const PDFViewerApplication = { | |||||||
|       linkService: pdfLinkService, |       linkService: pdfLinkService, | ||||||
|       eventBus, |       eventBus, | ||||||
|       updateMatchesCountOnProgress: |       updateMatchesCountOnProgress: | ||||||
|         typeof PDFJSDev === "undefined" || !PDFJSDev.test("GECKOVIEW"), |         typeof PDFJSDev === "undefined" | ||||||
|  |           ? !window.isGECKOVIEW | ||||||
|  |           : !PDFJSDev.test("GECKOVIEW"), | ||||||
|     }); |     }); | ||||||
|     this.findController = findController; |     this.findController = findController; | ||||||
| 
 | 
 | ||||||
| @ -1251,14 +1253,18 @@ const PDFViewerApplication = { | |||||||
|               spreadMode = stored.spreadMode | 0; |               spreadMode = stored.spreadMode | 0; | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|  |           // NOTE: Ignore the pageMode/pageLayout in GeckoView since there's no
 | ||||||
|  |           // sidebar available, nor any UI for changing the Scroll/Spread modes.
 | ||||||
|  |           if ( | ||||||
|  |             typeof PDFJSDev === "undefined" | ||||||
|  |               ? !window.isGECKOVIEW | ||||||
|  |               : !PDFJSDev.test("GECKOVIEW") | ||||||
|  |           ) { | ||||||
|             // Always let the user preference/view history take precedence.
 |             // Always let the user preference/view history take precedence.
 | ||||||
|             if (pageMode && sidebarView === SidebarView.UNKNOWN) { |             if (pageMode && sidebarView === SidebarView.UNKNOWN) { | ||||||
|               sidebarView = apiPageModeToSidebarView(pageMode); |               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 ( |             if ( | ||||||
|             (typeof PDFJSDev === "undefined" || !PDFJSDev.test("GECKOVIEW")) && |  | ||||||
|               pageLayout && |               pageLayout && | ||||||
|               scrollMode === ScrollMode.UNKNOWN && |               scrollMode === ScrollMode.UNKNOWN && | ||||||
|               spreadMode === SpreadMode.UNKNOWN |               spreadMode === SpreadMode.UNKNOWN | ||||||
| @ -1269,6 +1275,7 @@ const PDFViewerApplication = { | |||||||
|               // scrollMode = modes.scrollMode;
 |               // scrollMode = modes.scrollMode;
 | ||||||
|               spreadMode = modes.spreadMode; |               spreadMode = modes.spreadMode; | ||||||
|             } |             } | ||||||
|  |           } | ||||||
| 
 | 
 | ||||||
|           this.setInitialView(hash, { |           this.setInitialView(hash, { | ||||||
|             rotation, |             rotation, | ||||||
| @ -1528,6 +1535,13 @@ const PDFViewerApplication = { | |||||||
|    * @private |    * @private | ||||||
|    */ |    */ | ||||||
|   async _initializePageLabels(pdfDocument) { |   async _initializePageLabels(pdfDocument) { | ||||||
|  |     if ( | ||||||
|  |       typeof PDFJSDev === "undefined" | ||||||
|  |         ? window.isGECKOVIEW | ||||||
|  |         : PDFJSDev.test("GECKOVIEW") | ||||||
|  |     ) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     const labels = await pdfDocument.getPageLabels(); |     const labels = await pdfDocument.getPageLabels(); | ||||||
| 
 | 
 | ||||||
|     if (pdfDocument !== this.pdfDocument) { |     if (pdfDocument !== this.pdfDocument) { | ||||||
|  | |||||||
| @ -269,7 +269,9 @@ class PDFScriptingManager { | |||||||
|           // NOTE: Always ignore the pageLayout in GeckoView since there's
 |           // NOTE: Always ignore the pageLayout in GeckoView since there's
 | ||||||
|           // no UI available to change Scroll/Spread modes for the user.
 |           // no UI available to change Scroll/Spread modes for the user.
 | ||||||
|           if ( |           if ( | ||||||
|             (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GECKOVIEW")) || |             (typeof PDFJSDev === "undefined" | ||||||
|  |               ? window.isGECKOVIEW | ||||||
|  |               : PDFJSDev.test("GECKOVIEW")) || | ||||||
|             isInPresentationMode |             isInPresentationMode | ||||||
|           ) { |           ) { | ||||||
|             return; |             return; | ||||||
|  | |||||||
| @ -68,6 +68,7 @@ function webViewerLoad() { | |||||||
| 
 | 
 | ||||||
|       document.head.append(link); |       document.head.append(link); | ||||||
|     } |     } | ||||||
|  |     window.isGECKOVIEW = true; | ||||||
| 
 | 
 | ||||||
|     import("pdfjs-web/genericcom.js").then(function (genericCom) { |     import("pdfjs-web/genericcom.js").then(function (genericCom) { | ||||||
|       PDFViewerApplication.run(config); |       PDFViewerApplication.run(config); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user