PDF Viewer: Make Viewport class work with HTMLElement instead of Window.
This is necessary in order to have the Viewport class work for both PDFViewerUpdate=false/true codepaths. Previously the Viewport constructor was expecting a Window instance to be passed as the scrolling container, but that is no longer the case in the PDFViewerUpdate UI. This CL modifies the code such that the scrolling container passed to the Viewport constructor is: - the <html> element for PDFViewerUpdate=false - the #main element for PDFViewerUpdate=true In order to do so - the <html> element is given a height of 100%, so that offsetHeight has a meaningful non-zero value. - innerHeight/innerWidth is replaced with offsetHeight/offsetWidth. - pageXOffset/pageYOffset is replaced with scrollLeft/scrollTop - a new MockElement class is introduced to replace MockWindow in some tests (MockWindow is still used in toolbar_manager_tests.js) Bug: 1101598 Change-Id: I0d3fa1a8a0146c97ef636b01954911750b5be942 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308865 Commit-Queue: dpapad <dpapad@chromium.org> Reviewed-by:Rebekah Potter <rbpotter@chromium.org> Cr-Commit-Position: refs/heads/master@{#791686}
Showing
This diff is collapsed.
Please register or sign in to comment