Simon Hong c091089ba3 Fixed vertical tab layout in RTL (#34423)
Resolves brave/brave-browser#53099

Fix vertical tab strip layout in RTL

The vertical tab strip and its surrounding views (contents area, bookmark bar, infobar, sidebar) were
being incorrectly positioned in RTL locales. The Views framework automatically mirrors child view
positions in RTL, which conflicted with Brave's explicit alignment preferences for the vertical tab
strip and sidebar.

Root cause

The layout in CalculateSideBarLayout was applying GetMirroredRect only to the sidebar and contents
bounds. When in RTL mode, the Views framework would also auto-mirror the vertical tab strip host view,
causing it to appear on the opposite side from what the user configured.

Changes

- BraveBrowserViewTabbedLayoutImpl::CalculateProposedLayout: Consolidate all RTL mirroring into a
single post-processing step at the end of the function. After the full layout is computed in logical
(LTR-equivalent) coordinates, apply GetMirroredRect uniformly to contents, bookmark bar, infobar
container, sidebar container, sidebar separator, and vertical tab strip host. This ensures all views
are mirrored consistently and respects the user's vertical-tab/sidebar alignment preference regardless of
RTL mode.

- BraveBrowserViewTabbedLayoutImpl::CalculateSideBarLayout: Remove the per-view GetMirroredRect calls
that were previously scattered here (sidebar bounds, contents bounds, separator bounds). These are now
handled centrally in CalculateProposedLayout.

- BraveVerticalTabStripRegionView and VerticalTabStripWidgetDelegateView: Call SetMirrored(false) to
prevent the Views framework from flipping their internal layout in RTL. Their visual position is
already controlled by the layout's GetMirroredRect post-processing step, matching the approach used by
SidebarContainerView.

- Add VerticalTabLayoutInRTL browser test to verify that both the host view (via GetMirroredBounds())
and the OS-level widget (via GetWindowBoundsInScreen()) are on the correct side of the contents area in
RTL, for both the "vertical tab on left" and "vertical tab on right" user preferences.
2026-03-09 20:40:06 +09:00
2026-03-02 17:18:22 +00:00
2026-03-03 14:24:22 +00:00
2026-03-09 00:02:59 +00:00
2026-03-09 00:02:59 +00:00
2026-03-09 00:02:59 +00:00

Brave Core

Brave Core is a set of changes, APIs, and scripts used for customizing Chromium to make the Brave browser. Please also check https://github.com/brave/brave-browser

Follow @brave on Twitter for important announcements.

Resources

Community

You can ask questions and interact with the community in the following locations:

S
Description
No description provided
Readme MPL-2.0
3.8 GiB
Languages
C++ 36.9%
HTML 31.6%
Swift 9.4%
TypeScript 9%
Java 4.8%
Other 8.1%