Add goToNextPage() and goToPreviousPage() to ViewportImpl.

Currently the PDF Viewer goes to the next/previous page by calling
ViewportImpl.goToPage() with the result of
ViewportImpl.getMostVisiblePage() +/- 1, respectively. This assumes that
the layout is in single-view and makes it so that PDF viewer needs to
know what layout the document is in.

This CL adds goToNextPage() and goToPreviousPage() to ViewportImpl which
moves the aforementioned page traversal logic out of PDF viewer and into
ViewportImpl. This allows PDF viewer to traverse the document correctly
without having to know what layout the document is in.

Bug: 51472
Change-Id: If1880d5fb35283ecc8d05a2529f8d7626265402a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757148
Reviewed-by: Rebekah Potter <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Commit-Queue: Jeremy Chinsen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#687691}
diff --git a/chrome/browser/resources/pdf/viewport.js b/chrome/browser/resources/pdf/viewport.js
index 27b540e..59556f1 100644
--- a/chrome/browser/resources/pdf/viewport.js
+++ b/chrome/browser/resources/pdf/viewport.js
@@ -954,6 +954,20 @@
   }
 
   /**
+   * Go to the next page.
+   */
+  goToNextPage() {
+    this.goToPage(this.getMostVisiblePage() + 1);
+  }
+
+  /**
+   * Go to the previous page.
+   */
+  goToPreviousPage() {
+    this.goToPage(this.getMostVisiblePage() - 1);
+  }
+
+  /**
    * Go to the given page index.
    *
    * @param {number} page the index of the page to go to. zero-based.