Chromium changes:
https://chromium.googlesource.com/chromium/src/+/1527e1c0fa38dfb971603f9f59faf7de58c3f313
commit 1527e1c0fa38dfb971603f9f59faf7de58c3f313
Author: Samuel Huang <huangs@chromium.org>
Date: Wed Apr 8 21:43:14 2026 -0700
[Android NTP] Fix vertical gaps between adjacent main sections
The New Tab Page (NTP) has multiple "sections" that are vertically
stacked. Let's specify these with abbreviations:
* FSB: Fake Search Box.
* AIM: AI Mode Button + Incognito Button, AKA Composeplate.
* MVT: Most Visited Tiles.
* MS: Magic Stack, AKA New Tab Page Cards.
* DF: Discovery Feed.
Note that we're ignoring the Logo (above FSB) and promotion (e.g., for
Sign in) sections.
{MVT, MS, DF} may be absent sometimes:
* NTP Customization can toggle {MVT, MS, DF}.
* MS dynamically appears / disappears.
AIM is now a permanent component of the layout and cannot be optionally
removed.
Let FSB-AIM be the vertical gap between the FSB bottom and AIM top.
Similarly, define other spacings. Since {MVT, MS, DF} may be absent,
there are 7 gap cases: FSB-AIM, AIM-{MVT,MS,DF}, MVT-{MS,DF}, MS-DF.
Recently we found that these gap sizes are inconsistent. This CL fixes
the inconsistency by making FSB-AIM = 8 dp, and everything else 16 dp:
Gap Old Goal
FSB-AIM 9 dp 8 dp
AIM-MVT 25 dp 16 dp
AIM-MS 18 dp 16 dp
AIM-DF 18 dp 16 dp
MVT-MS 16 dp 16 dp
MVT-DF 16 dp 16 dp
MS-DF 16 dp 16 dp
Strategy:
* Assign top margins to 12 dp for {FSB, MVT, MS, DF} and 4 dp for AIM.
* Assign bottom margins to 4 dp. Previously this existed so that
sections can expand to accommodate shadows. This is no longer
needed, but we keep the margin anyway as buffer space.
Note that 4 dp + 12 dp = 16 dp, which will be the standard spacing
between sections; and the FSB-AIM exception is managed by 4 dp + 4 dp.
In a previous CL (crrev.com/c/7603164), we removed the dynamic resizing
logic that was previously required to accommodate the AIM view's shadow.
With that logic removed, we can now rely entirely on these static
margins, greatly simplifying the spacing definitions.
Details:
* For common dimensions define and use:
@dimen/ntp_section_top_margin = 12 dp
@dimen/ntp_section_bottom_margin = 4 dp
* For AIM top margin define and use:
@dimen/composeplate_view_margin_top = 4 dp
* Define "padding" quantities to replace previous uses of
section-specific "margin" quantities for padding.
* Update ShowNtpAtStartupTest to expect the new standardized
@dimen/ntp_section_bottom_margin on the MVT container.
* Bump revisions in TabSwitcherLayoutPTTest and FeedV2NewTabPageTest to
trigger Skia Gold rebaselines for the new spacing.
Bug: 481717794
Change-Id: I77adb4c8980a3bc2e0803a5b6cd0b2ac7a66d48a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7589698
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Brandon Wylie <wylieb@google.com>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1611969}