tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d545a3cc2c5fcee9edcfbd7229714e71d4afbd3d
parent 87a9480785754b7382c7f9800efd6ac1d47bcbbd
Author: Mugurell <Mugurell@users.noreply.github.com>
Date:   Wed, 17 Dec 2025 16:06:37 +0000

Bug 1988730 - part 3 - Avoid wrapping the display toolbar in CFR code if CFR will not be shown r=android-reviewers,moyin,Roger

Saw in manual testing that wrapping the display toolbar with the CFR will
negatively impact the transition between the full and minimal toolbar, it
resulting in a wrong computed height for the toolbar & wrong animation.

Differential Revision: https://phabricator.services.mozilla.com/D275991

Diffstat:
Mmobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/BrowserToolbar.kt | 58++++++++++++++++++++++++++++++++++------------------------
1 file changed, 34 insertions(+), 24 deletions(-)

diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/BrowserToolbar.kt b/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/BrowserToolbar.kt @@ -82,30 +82,7 @@ fun BrowserToolbar( onInteraction = { store.dispatch(it) }, ) } else { - CFRPopupLayout( - showCFR = cfr?.enabled == true, - properties = cfrProperties, - onCFRShown = { cfr?.onShown?.invoke() }, - onDismiss = { explicit -> cfr?.onDismiss?.invoke(explicit) }, - title = { - cfr?.title?.let { - Text( - text = it, - color = AcornTheme.colors.textOnColorPrimary, - style = AcornTheme.typography.subtitle2, - ) - } - }, - text = { - cfr?.description?.let { - Text( - text = it, - color = AcornTheme.colors.textOnColorPrimary, - style = AcornTheme.typography.body2, - ) - } - }, - ) { + val displayToolbar = @Composable { BrowserDisplayToolbar( pageOrigin = uiState.displayState.pageOrigin, progressBarConfig = uiState.displayState.progressBarConfig, @@ -117,6 +94,39 @@ fun BrowserToolbar( onInteraction = { store.dispatch(it) }, ) } + + if (cfr?.enabled == true) { + // Wrapping the toolbar with the CFR code negatively impacts the transition + // between the full and minimal toolbar <=> Avoid this when not needed. + CFRPopupLayout( + showCFR = true, + properties = cfrProperties, + onCFRShown = { cfr.onShown.invoke() }, + onDismiss = { explicit -> cfr.onDismiss.invoke(explicit) }, + title = { + cfr.title.let { + Text( + text = it, + color = AcornTheme.colors.textOnColorPrimary, + style = AcornTheme.typography.subtitle2, + ) + } + }, + text = { + cfr.description.let { + Text( + text = it, + color = AcornTheme.colors.textOnColorPrimary, + style = AcornTheme.typography.body2, + ) + } + }, + ) { + displayToolbar() + } + } else { + displayToolbar() + } } }