diff --git a/src/core/drive/page_snapshot.js b/src/core/drive/page_snapshot.js index 58a5a75a9..7bbb62c16 100644 --- a/src/core/drive/page_snapshot.js +++ b/src/core/drive/page_snapshot.js @@ -82,6 +82,10 @@ export class PageSnapshot extends Snapshot { return this.getSetting("refresh-scroll") === "preserve" } + get shouldHideProgressBarOnRefresh() { + return this.shouldMorphPage && this.getSetting("refresh-progress-bar") === "hide" + } + // Private getSetting(name) { diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index 6a40a94d9..24fade684 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -63,6 +63,10 @@ export class PageView extends View { return this.isPageRefresh(visit) && this.snapshot.shouldPreserveScrollPosition } + shouldHideProgressBar() { + return this.snapshot.shouldHideProgressBarOnRefresh + } + get snapshot() { return PageSnapshot.fromElement(this.element) } diff --git a/src/core/drive/visit.js b/src/core/drive/visit.js index ec7565979..cbb8374b5 100644 --- a/src/core/drive/visit.js +++ b/src/core/drive/visit.js @@ -341,6 +341,16 @@ export class Visit { this.finishRequest() } + // Progress bar + + hideProgressBar() { + return this.view.shouldHideProgressBar() + } + + showProgressBarAfterDelay() { + return this.hasCachedSnapshot() || this.action !== "restore" + } + // Scrolling performScroll() { diff --git a/src/core/native/browser_adapter.js b/src/core/native/browser_adapter.js index 6f4c73bfe..96a568085 100644 --- a/src/core/native/browser_adapter.js +++ b/src/core/native/browser_adapter.js @@ -27,7 +27,10 @@ export class BrowserAdapter { visitRequestStarted(visit) { this.progressBar.setValue(0) - if (visit.hasCachedSnapshot() || visit.action != "restore") { + + if (visit.hideProgressBar()) return + + if (visit.showProgressBarAfterDelay()) { this.showVisitProgressBarAfterDelay() } else { this.showProgressBar() diff --git a/src/tests/fixtures/page_refresh_progress_bar.html b/src/tests/fixtures/page_refresh_progress_bar.html new file mode 100644 index 000000000..05f98bfce --- /dev/null +++ b/src/tests/fixtures/page_refresh_progress_bar.html @@ -0,0 +1,143 @@ + + +
+ + + + +Link with params to refresh the page
+ + + + + + + +