Commit e70a61f0 authored by Hiroyuki Ikezoe's avatar Hiroyuki Ikezoe
Browse files

Bug 1777052 - Skip counting scroll events where the scroll position is...

Bug 1777052 - Skip counting scroll events where the scroll position is unchanged in test_mousecapture.xhtml. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D174050
parent 5f419053
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -73,10 +73,22 @@ function selectionScrollCheck() {
  var element = otherWindow.document.documentElement;

  var count = 0;
  let previousScrollPosition = 0;

  function selectionScrollDone() {
    // Don't count unchanged scroll position.
    // There's a bug that scroll events get fired during reconstructing scroll
    // frames even if the scroll position is unchanged (bug 1825470). We need to
    // ignore the unchanged scroll events here.
    if (otherWindow.scrollY == previousScrollPosition) {
      return;
    }
    previousScrollPosition = otherWindow.scrollY;

    // wait for 6 scroll events to occur
    if (count++ < 6)
    if (count++ < 6) {
      return;
    }

    otherWindow.removeEventListener("scroll", selectionScrollDone);