[cr147][Android] Changes for ToolbarSwipeLayout

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/6257cc0a04731f19de38049632765ee5ffa5f249

commit 6257cc0a04731f19de38049632765ee5ffa5f249
Author: Yanting Yu <yyanting@google.com>
Date:   Tue Feb 17 13:22:09 2026 -0800

    Fix the toolbar swipe animation in NTP (Part2).

    This is the follow up CL for crrev.com/c/7552991. In this CL, we fixed
    1) toolbar jumps down when swiping the toolbar from newly created NTP;
    2) the empty bar is observed above the bottom toolbar after swipe to
    non-NTP tab from newly created NTP.

    Root cause: When preparing the swipe animation, we use the stale toolbar
    capture including the top padding for E2E in NTP. Even though the
    toolbar is notified to remove its own padding before swipe starts. We
    fixed this bug by forcing the toolbar to update its layout and capture
    the bitmap.

    Before: https://screencast.googleplex.com/cast/NTAyMDk1NTYwNzgyNjQzMnxkNWU5ZGQwYy1jMw
    After: https://screencast.googleplex.com/cast/NjI5MTcyNTEzMDY2MTg4OHxkMzE3Y2ZhNi1lYQ

    Bug: 469708907, 480857474
    Change-Id: I7a365b8f1a11ea65d7b3c13b54e00bfb7f1d88ce
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7563889
    Commit-Queue: Yanting Yu <yyanting@google.com>
    Reviewed-by: Patrick Noland <pnoland@chromium.org>
    Reviewed-by: Xi Han <hanxi@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1585966}
This commit is contained in:
Artem Samoilenko
2026-02-26 14:14:57 +00:00
committed by Claudio DeSouza
parent 5143bba76d
commit f4f73437c0
2 changed files with 6 additions and 3 deletions
@@ -30,7 +30,8 @@ public class BraveToolbarSwipeLayout extends ToolbarSwipeLayout {
LayoutManager layoutManager,
TopUiThemeColorProvider topUiColorProvider,
NonNullObservableSupplier<Integer> bottomControlsOffsetSupplier,
ViewGroup contentContainer) {
ViewGroup contentContainer,
Runnable forceLayoutUpdateAndCaptureRunnable) {
super(
context,
updateHost,
@@ -39,7 +40,8 @@ public class BraveToolbarSwipeLayout extends ToolbarSwipeLayout {
layoutManager,
topUiColorProvider,
bottomControlsOffsetSupplier,
contentContainer);
contentContainer,
forceLayoutUpdateAndCaptureRunnable);
// To postpone toolbar transition animation to the end of the swipe.
mMoveToolbar = false;
@@ -2111,7 +2111,8 @@ public class BytecodeTest {
LayoutManager.class,
TopUiThemeColorProvider.class,
NonNullObservableSupplier.class,
ViewGroup.class));
ViewGroup.class,
Runnable.class));
Assert.assertTrue(
constructorsMatch(
"org/chromium/components/embedder_support/view/ContentView",