Class ScrollSweepPlanner

java.lang.Object
com.shaft.gui.browser.internal.ScrollSweepPlanner

public final class ScrollSweepPlanner extends Object
Pure decision logic for BrowserActions.scrollToLoadAll()'s bounded progressive scroll sweep (issue #3749, Increment D).

Extracted out of the browser-driving loop so the step-count/height-stability stop condition can be unit tested without a real WebDriver, following the same test-seam philosophy as BidiNetworkActivitySource's injected clock.

  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    shouldStop(int completedSteps, int maxSteps, long previousPageHeight, long currentPageHeight, boolean bottomReached)
    Decides whether a bounded progressive scroll sweep should stop after the step that just completed.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • shouldStop

      public static boolean shouldStop(int completedSteps, int maxSteps, long previousPageHeight, long currentPageHeight, boolean bottomReached)
      Decides whether a bounded progressive scroll sweep should stop after the step that just completed.

      Stops when either the configured step ceiling has been reached (bounding worst-case cost regardless of page behavior), or the page has stopped growing and the viewport bottom has been reached. A grown page keeps the sweep going even past the visual bottom, since newly appended content may still need one more step to itself be scrolled into view.

      Parameters:
      completedSteps - number of scroll steps performed so far (including the one that just completed)
      maxSteps - the configured ceiling (timeouts.lazyLoadingScrollSweepMaxSteps)
      previousPageHeight - the page's scroll height before this step
      currentPageHeight - the page's scroll height after this step
      bottomReached - whether the viewport bottom reached the page's scroll height after this step
      Returns:
      true when the sweep should stop