Skip to content

Commit 302568b

Browse files
committed
Fix gg and G on pdf.js and other pages
1 parent ba7d8e7 commit 302568b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

common/content/buffer.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ const Buffer = Module("buffer", {
698698
* Scrolls to the bottom of the current buffer.
699699
*/
700700
scrollBottom: function () {
701-
Buffer.scrollToPercent(null, 100);
701+
Buffer.scrollElemToPercent(null, null, 100);
702702
},
703703

704704
/**
@@ -715,7 +715,7 @@ const Buffer = Module("buffer", {
715715
* Scrolls to the top of the current buffer.
716716
*/
717717
scrollEnd: function () {
718-
Buffer.scrollToPercent(100, null);
718+
Buffer.scrollElemToPercent(null, 100, null);
719719
},
720720

721721
/**
@@ -772,7 +772,7 @@ const Buffer = Module("buffer", {
772772
* @param {number} y The vertical page percentile.
773773
*/
774774
scrollToPercent: function (x, y) {
775-
Buffer.scrollToPercent(x, y);
775+
Buffer.scrollElemToPercent(null, x, y);
776776
},
777777

778778
/**
@@ -790,14 +790,14 @@ const Buffer = Module("buffer", {
790790
* Scrolls the current buffer laterally to its leftmost.
791791
*/
792792
scrollStart: function () {
793-
Buffer.scrollToPercent(0, null);
793+
Buffer.scrollElemToPercent(null, 0, null);
794794
},
795795

796796
/**
797797
* Scrolls the current buffer vertically to the top.
798798
*/
799799
scrollTop: function () {
800-
Buffer.scrollToPercent(null, 0);
800+
Buffer.scrollElemToPercent(null, null, 0);
801801
},
802802

803803
// TODO: allow callback for filtering out unwanted frames? User defined?
@@ -1064,7 +1064,7 @@ const Buffer = Module("buffer", {
10641064
return win;
10651065
},
10661066

1067-
findScrollable: function findScrollable(dir, horizontal) {
1067+
findScrollable: function findScrollable(dir = 0, horizontal) {
10681068
let pos = "scrollTop", maxPos = "scrollTopMax", clientSize = "clientHeight";
10691069
if (horizontal)
10701070
pos = "scrollLeft", maxPos = "scrollLeftMax", clientSize = "clientWidth";
@@ -1076,7 +1076,7 @@ const Buffer = Module("buffer", {
10761076
for (; elem && elem.parentNode instanceof Element; elem = elem.parentNode) {
10771077
if (elem[clientSize] == 0)
10781078
continue;
1079-
if (dir < 0 && elem[pos] > 0 || dir > 0 && elem[pos] < elem[maxPos])
1079+
if (dir < 0 && elem[pos] > 0 || dir > 0 && elem[pos] < elem[maxPos] || dir == 0 && elem[maxPos] > 0)
10801080
break;
10811081
}
10821082
return elem;

0 commit comments

Comments
 (0)