Class ScrollSweepPlanner
java.lang.Object
com.shaft.gui.browser.internal.ScrollSweepPlanner
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 TypeMethodDescriptionstatic booleanshouldStop(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.
-
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 stepcurrentPageHeight- the page's scroll height after this stepbottomReached- whether the viewport bottom reached the page's scroll height after this step- Returns:
truewhen the sweep should stop
-