Fix pinned tab visibility on insertion in vertical tab#34206
Draft
Fix pinned tab visibility on insertion in vertical tab#34206
Conversation
Use layout_helper_->GetPinnedTabCount() instead of data().pinned in StartInsertTabAnimation() to determine if a tab is pinned. The tab's data has not been set yet at this point in the insertion flow (TabStrip::AddTabsAt calls AddTabs before SetData), so data().pinned is always false for newly inserted tabs. This caused restored pinned tabs to receive unpinned-width initial bounds, resulting in incorrect icon positioning and missing favicons. Fix brave/brave-browser#53083
Add RestoredPinnedTabHasCorrectBoundsAndIcon browser test to verify that closing a pinned tab and restoring it via chrome::RestoreTab() in vertical tab mode results in correct pinned-width bounds and a visible favicon icon. Fix brave/brave-browser#53083
1bfc608 to
0ca148d
Compare
Collaborator
|
Warning You have got a presubmit warning. Please address it if possible. |
Contributor
|
Chromium major version is behind target branch (145.0.7632.120 vs 146.0.7680.32). Please rebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves brave/brave-browser#53083
BraveTabContainer::ShouldTabBeVisible() was checking data().pinned to decide
whether a pinned tab should always be visible.
During tab insertion (restore, duplicate, etc.), SetData() has not been called yet when
ShouldTabBeVisible() runs, so newly inserted pinned tabs were incorrectly treated as unpinned and hidden.
IsPinned() combines data().pinned with a model-based fallback: when data().pinned is false,
it checks the tab's index in tabs_view_model_ against layout_helper_->GetPinnedTabCount(),
both of which are already accurate because AddTabToViewModel() runs before StartInsertTabAnimation().
Use IsPinned() in both ShouldTabBeVisible() and StartInsertTabAnimation().
TEST=VerticalTabStripStripBrowserTest.PinnedTabVisibilityAfterRestore