Truly independent web browser
UI/Qt: Run the open vertical tab sidebar the full height of the window
Andreas Kling3030f1782f94
diff --git a/UI/Qt/ChromeStyle.cpp b/UI/Qt/ChromeStyle.cppindex 1fc3e53aa34..fdf917b9eb7 100644--- a/UI/Qt/ChromeStyle.cpp+++ b/UI/Qt/ChromeStyle.cpp@@ -1193,10 +1193,8 @@ QWidget#LadybirdDevToolsBanner QPushButton:pressed {{QString tab_widget_style_sheet(QPalette const& palette){auto dark = is_dark(palette);- auto chrome_background_color = chrome_background(palette);- auto background = style_sheet_color(chrome_tab_strip_background(palette));- // The sidebar shares the toolbar's color, so the toolbar and the sidebar frame the page as one surface.- auto sidebar_background = style_sheet_color(chrome_background_color);+ auto tab_strip_background = chrome_tab_strip_background(palette);+ auto background = style_sheet_color(tab_strip_background);auto hover = style_sheet_color(chrome_control_surface_hover(palette));auto pressed = style_sheet_color(chrome_control_surface_pressed(palette));auto control_border = style_sheet_color(chrome_control_border(palette));@@ -1205,7 +1203,7 @@ QString tab_widget_style_sheet(QPalette const& palette)auto close_text = style_sheet_color(chrome_destructive_text());auto sidebar_separator = style_sheet_color(chrome_content_separator(palette));// The sidebar's edge shows up clearly while it can be dragged, to show that the sidebar can be resized.- auto sidebar_separator_hover = style_sheet_color(mix(chrome_background_color, chrome_text(palette), dark ? 0.30 : 0.28));+ auto sidebar_separator_hover = style_sheet_color(mix(tab_strip_background, chrome_text(palette), dark ? 0.30 : 0.28));return qformatted(R"(QWidget#LadybirdTabStrip {{@@ -1216,7 +1214,7 @@ QWidget#LadybirdTabStrip {{QWidget#LadybirdVerticalTabBar {{color: {4};- background: {9};+ background: {0};border: 0;border-right: 1px solid {7};}}@@ -1237,6 +1235,12 @@ QWidget#LadybirdVerticalTabBar[verticalTabsPosition="right"][active="true"] {{border-left: 1px solid {8};}}+QToolButton#LadybirdVerticalTabsToggleButton {{+ background: transparent;+ border: 0;+ padding: 0;+}}+QWidget#LadybirdVerticalTabsResizeHandle {{background: transparent;border: 0;@@ -1370,7 +1374,7 @@ QWidget#LadybirdVerticalTabsContentSeparator {{)"#endif,- background, hover, pressed, control_border, text, close_hover, close_text, sidebar_separator, sidebar_separator_hover, sidebar_background);+ background, hover, pressed, control_border, text, close_hover, close_text, sidebar_separator, sidebar_separator_hover);}QString autocomplete_popup_style_sheet(QPalette const& palette)diff --git a/UI/Qt/Icon.cpp b/UI/Qt/Icon.cppindex cf9dd40255c..1eecda5b0c9 100644--- a/UI/Qt/Icon.cpp+++ b/UI/Qt/Icon.cpp@@ -159,23 +159,33 @@ static QPainterPath horizontally_flipped_path(QPainterPath const& path)return transform.map(path);}+// The expanded sidebar's button shows the sidebar with an arrow into it. The collapsed sidebar's button is a double+// chevron pointing away from the sidebar's edge of the window.static void draw_vertical_tab_bar_icon(QPainter& painter, QColor const& color, bool expanded, bool right_side){+ if (!expanded) {+ QPainterPath chevrons;+ chevrons.moveTo(6.0, 6.3);+ chevrons.lineTo(9.7, 10.0);+ chevrons.lineTo(6.0, 13.7);+ chevrons.moveTo(10.6, 6.3);+ chevrons.lineTo(14.3, 10.0);+ chevrons.lineTo(10.6, 13.7);+ if (right_side)+ chevrons = horizontally_flipped_path(chevrons);+ draw_stroked_icon_path(painter, chevrons, color, 1.7);+ return;+ }+QPainterPath tab_bar;tab_bar.addRoundedRect(QRectF(3.8, 4.2, 12.4, 11.6), 1.6, 1.6);tab_bar.moveTo(7.8, 4.6);tab_bar.lineTo(7.8, 15.4);QPainterPath arrow;- if (expanded) {- arrow.moveTo(13.1, 7.8);- arrow.lineTo(10.3, 10.0);- arrow.lineTo(13.1, 12.2);- } else {- arrow.moveTo(10.7, 7.8);- arrow.lineTo(13.5, 10.0);- arrow.lineTo(10.7, 12.2);- }+ arrow.moveTo(13.1, 7.8);+ arrow.lineTo(10.3, 10.0);+ arrow.lineTo(13.1, 12.2);if (right_side) {tab_bar = horizontally_flipped_path(tab_bar);diff --git a/UI/Qt/Tab.cpp b/UI/Qt/Tab.cppindex 54b49ff1427..c6eeb7c9c2e 100644--- a/UI/Qt/Tab.cpp+++ b/UI/Qt/Tab.cpp@@ -49,6 +49,7 @@#include <QMimeData>#include <QMimeDatabase>#include <QPainter>+#include <QPainterPath>#include <QProgressBar>#include <QPushButton>#include <QResizeEvent>@@ -364,7 +365,6 @@ static constexpr int TOOLBAR_HORIZONTAL_MARGIN = 12;static constexpr int WEB_VIEW_INSET = 6;#endifstatic constexpr int TOOLBAR_VERTICAL_MARGIN = 2;-static constexpr int TOOLBAR_SIDEBAR_TOGGLE_NAVIGATION_GAP = 8;static constexpr int TOOLBAR_WINDOW_CONTROLS_RIGHT_MARGIN = 4;static constexpr int DOWNLOADS_POPOVER_WIDTH = 380;static constexpr int DOWNLOADS_POPOVER_MAX_HEIGHT = 360;@@ -818,7 +818,6 @@ void Tab::initialize(Optional<WebView::CanonicalTraversable&> traversable)QObject::connect(m_stop_action, &QAction::triggered, this, [this] {view().stop_loading();});- m_toggle_vertical_tabs_expanded_action = create_application_action(*this, application.toggle_vertical_tabs_expanded_action());m_open_downloads_page_action = create_application_action(*this, application.open_downloads_page_action());m_downloads_button = new DownloadsButton(m_toolbar);@@ -905,12 +904,6 @@ void Tab::initialize(Optional<WebView::CanonicalTraversable&> traversable)navigation_button_layout->setSpacing(2);navigation_button_layout->setContentsMargins(0, 0, 0, 0);- m_left_toggle_vertical_tabs_expanded_button = create_toolbar_button(*navigation_button_cluster, *m_toggle_vertical_tabs_expanded_action);- m_right_toggle_vertical_tabs_expanded_button = create_toolbar_button(*m_toolbar, *m_toggle_vertical_tabs_expanded_action);- m_sidebar_toggle_navigation_spacer = new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);-- navigation_button_layout->addWidget(m_left_toggle_vertical_tabs_expanded_button);- navigation_button_layout->addItem(m_sidebar_toggle_navigation_spacer);navigation_button_layout->addWidget(create_navigation_history_toolbar_button(*navigation_button_cluster, *m_navigate_back_action, -1));navigation_button_layout->addWidget(create_navigation_history_toolbar_button(*navigation_button_cluster, *m_navigate_forward_action, 1));m_reload_button = create_toolbar_button<ReloadButton>(*navigation_button_cluster, *m_reload_action);@@ -943,7 +936,6 @@ void Tab::initialize(Optional<WebView::CanonicalTraversable&> traversable)toolbar_layout->addWidget(m_downloads_button, 0, Qt::AlignVCenter);toolbar_layout->addWidget(m_private_badge, 0, Qt::AlignVCenter);toolbar_layout->addWidget(m_content_blocking_button, 0, Qt::AlignVCenter);- toolbar_layout->addWidget(m_right_toggle_vertical_tabs_expanded_button, 0, Qt::AlignVCenter);toolbar_layout->addWidget(m_hamburger_button, 0, Qt::AlignVCenter);if constexpr (!use_native_macos_window_controls()) {@@ -1489,7 +1481,6 @@ void Tab::ensure_loaded()// TabWidget pushed these while the tab had no toolbar to apply them to.set_vertical_tabs_enabled(m_vertical_tabs_enabled);recreate_toolbar_icons();- update_vertical_tabs_toolbar_button_placement();set_toolbar_window_controls_visible(toolbar_window_controls_visible);if (m_session_tab_id.has_value())@@ -1580,32 +1571,16 @@ void Tab::set_vertical_tabs_enabled(bool enabled)return;m_toolbar->setProperty(WINDOW_DRAG_REGION_PROPERTY, true);- if (m_sidebar_toggle_navigation_spacer)- m_sidebar_toggle_navigation_spacer->changeSize(enabled ? TOOLBAR_SIDEBAR_TOGGLE_NAVIGATION_GAP : 0, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);- update_vertical_tabs_toolbar_button_placement();update_bookmarks_bar_visibility();m_toolbar->layout()->invalidate();}-void Tab::set_vertical_tabs_position(WebView::VerticalTabsPosition position)-{- if (m_vertical_tabs_position == position)- return;-- m_vertical_tabs_position = position;- if (!is_loaded())- return;-- recreate_toolbar_icons();- update_vertical_tabs_toolbar_button_placement();- m_toolbar->layout()->invalidate();-}-#ifdef AK_OS_MACOSvoid Tab::update_web_view_frame(bool chrome_visible, Optional<WebView::VerticalTabsPosition> sidebar_position){m_web_view_chrome_visible = chrome_visible;m_web_view_sidebar_position = sidebar_position;+ update();if (!is_loaded())return;@@ -1616,9 +1591,10 @@ void Tab::update_web_view_frame(bool chrome_visible, Optional<WebView::VerticalTreturn;}- // Keep the web view's rounded corners clear of the window edges. The sidebar has its own padding.- auto left = sidebar_position == WebView::VerticalTabsPosition::Left ? 0 : WEB_VIEW_INSET;- auto right = sidebar_position == WebView::VerticalTabsPosition::Right ? 0 : WEB_VIEW_INSET;+ // Keep the web view's rounded corners clear of the window edges. The sidebar has its own padding, so a narrower frame+ // of the toolbar's color sets the page apart from it.+ auto left = sidebar_position == WebView::VerticalTabsPosition::Left ? WEB_VIEW_INSET / 2 : WEB_VIEW_INSET;+ auto right = sidebar_position == WebView::VerticalTabsPosition::Right ? WEB_VIEW_INSET / 2 : WEB_VIEW_INSET;m_view_layout->setContentsMargins(left, 0, right, WEB_VIEW_INSET);m_view->set_has_rounded_corners(true);}@@ -1644,6 +1620,18 @@ void Tab::set_toolbar_container_in_tab_layout(bool in_tab_layout)}}+// NB: The location field gets a point more room above it below the horizontal tab strip, where the selected tab flows+// into the toolbar, and at the top of a macOS window, whose outline covers the toolbar's first point.+static int toolbar_extra_top_margin(bool window_controls_visible)+{+ return use_native_macos_window_controls() || !window_controls_visible ? 1 : 0;+}++int Tab::toolbar_height(bool window_controls_visible)+{+ return browser_chrome_layout_policy().toolbar_height + toolbar_extra_top_margin(window_controls_visible);+}+void Tab::set_toolbar_window_controls_visible(bool visible){m_toolbar_window_controls_visible = visible;@@ -1655,22 +1643,8 @@ void Tab::set_toolbar_window_controls_visible(bool visible)m_toolbar_window_controls_separator->setVisible(has_custom_window_controls);m_toolbar_window_controls->setVisible(has_native_window_controls || has_custom_window_controls);- auto top_margin = TOOLBAR_VERTICAL_MARGIN;- auto toolbar_height = browser_chrome_layout_policy().toolbar_height;- // NB: Below the horizontal tab strip, the selected tab flows into the toolbar, so the location field gets a point more- // room above it.- if (!visible) {- ++top_margin;- ++toolbar_height;- }-#ifdef AK_OS_MACOS- // NB: A toolbar holding the window controls is the top of the window, whose outline covers its first point.- auto window_outline_width = visible ? 1 : 0;- top_margin += window_outline_width;- toolbar_height += window_outline_width;-#endif- m_toolbar->setFixedHeight(toolbar_height);- m_toolbar->layout()->setContentsMargins(TOOLBAR_HORIZONTAL_MARGIN, top_margin, has_custom_window_controls ? TOOLBAR_WINDOW_CONTROLS_RIGHT_MARGIN : TOOLBAR_HORIZONTAL_MARGIN, TOOLBAR_VERTICAL_MARGIN);+ m_toolbar->setFixedHeight(toolbar_height(visible));+ m_toolbar->layout()->setContentsMargins(TOOLBAR_HORIZONTAL_MARGIN, TOOLBAR_VERTICAL_MARGIN + toolbar_extra_top_margin(visible), has_custom_window_controls ? TOOLBAR_WINDOW_CONTROLS_RIGHT_MARGIN : TOOLBAR_HORIZONTAL_MARGIN, TOOLBAR_VERTICAL_MARGIN);m_toolbar->layout()->invalidate();}@@ -1793,11 +1767,7 @@ void Tab::tab_settings_changed()auto const& tab_settings = WebView::Application::settings().tab_settings();m_vertical_tabs_enabled = tab_settings.vertical_tabs_enabled;- m_vertical_tabs_position = tab_settings.vertical_tabs_position;- if (m_sidebar_toggle_navigation_spacer)- m_sidebar_toggle_navigation_spacer->changeSize(m_vertical_tabs_enabled ? TOOLBAR_SIDEBAR_TOGGLE_NAVIGATION_GAP : 0, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);recreate_toolbar_icons();- update_vertical_tabs_toolbar_button_placement();update_bookmarks_bar_visibility();m_toolbar->layout()->invalidate();}@@ -1886,7 +1856,27 @@ void Tab::paintEvent(QPaintEvent*){// The inset around the web view should match the chrome surrounding it.QPainter painter(this);- painter.fillRect(rect(), ChromeStyle::chrome_background(window()->palette()));+ auto const& palette = window()->palette();+ painter.fillRect(rect(), ChromeStyle::chrome_background(palette));++ if (!m_web_view_chrome_visible || !m_web_view_sidebar_position.has_value() || !is_loaded())+ return;++ // At the bottom of the window, the sidebar's color reaches around the web view's rounded corner beside it, so the+ // inset bends around that corner rather than meeting the sidebar in a square corner. At the top, the inset joins+ // the toolbar instead.+ // NB: The curve meets the sidebar's edge and the window's bottom edge in a tangent.+ auto radius = m_view->viewport_corner_radius() + (WEB_VIEW_INSET / 2.0);+ auto left = *m_web_view_sidebar_position == WebView::VerticalTabsPosition::Right ? width() - radius : 0.0;+ auto curve_left = *m_web_view_sidebar_position == WebView::VerticalTabsPosition::Right ? width() - (2 * radius) : 0.0;++ QPainterPath corner;+ corner.addRect(left, height() - radius, radius, radius);+ QPainterPath inside;+ inside.addEllipse(curve_left, height() - (2 * radius), 2 * radius, 2 * radius);++ painter.setRenderHint(QPainter::Antialiasing, true);+ painter.fillPath(corner.subtracted(inside), ChromeStyle::chrome_tab_strip_background(palette));}#endif@@ -1998,11 +1988,6 @@ void Tab::update_chrome_style()void Tab::recreate_toolbar_icons(){- auto vertical_tabs_are_expanded = WebView::Application::settings().tab_settings().vertical_tabs_expanded;- auto vertical_tabs_icon = m_vertical_tabs_position == WebView::VerticalTabsPosition::Right- ? (vertical_tabs_are_expanded ? ChromeIcon::VerticalTabBarCollapseRight : ChromeIcon::VerticalTabBarExpandRight)- : (vertical_tabs_are_expanded ? ChromeIcon::VerticalTabBarCollapse : ChromeIcon::VerticalTabBarExpand);- m_toggle_vertical_tabs_expanded_action->setIcon(create_chrome_icon(vertical_tabs_icon, palette()));m_navigate_back_action->setIcon(create_chrome_icon(ChromeIcon::Back, palette()));m_navigate_forward_action->setIcon(create_chrome_icon(ChromeIcon::Forward, palette()));m_reload_action->setIcon(create_chrome_icon(ChromeIcon::Reload, palette()));@@ -2226,17 +2211,6 @@ void Tab::show_content_blocking_popover()m_content_blocking_popover->focus_switch();}-void Tab::update_vertical_tabs_toolbar_button_placement()-{- auto show_left_button = m_vertical_tabs_enabled && m_vertical_tabs_position == WebView::VerticalTabsPosition::Left;- auto show_right_button = m_vertical_tabs_enabled && m_vertical_tabs_position == WebView::VerticalTabsPosition::Right;-- if (m_left_toggle_vertical_tabs_expanded_button)- m_left_toggle_vertical_tabs_expanded_button->setVisible(show_left_button);- if (m_right_toggle_vertical_tabs_expanded_button)- m_right_toggle_vertical_tabs_expanded_button->setVisible(show_right_button);-}-void Tab::show_private_session_popover(){if (!m_private_badge || !m_private_badge->isVisible())diff --git a/UI/Qt/Tab.h b/UI/Qt/Tab.hindex b1f52ac8b08..4518d881aae 100644--- a/UI/Qt/Tab.h+++ b/UI/Qt/Tab.h@@ -149,13 +149,13 @@ public:QWidget* toolbar_container() const { return m_toolbar_container; }void set_vertical_tabs_enabled(bool);- void set_vertical_tabs_position(WebView::VerticalTabsPosition);#ifdef AK_OS_MACOSvoid update_web_view_frame(bool chrome_visible, Optional<WebView::VerticalTabsPosition> sidebar_position);#endifvoid set_window(BrowserWindow&);void set_toolbar_container_in_tab_layout(bool);void set_toolbar_window_controls_visible(bool);+ static int toolbar_height(bool window_controls_visible);void update_window_control_icons();void update_hover_label();@@ -200,7 +200,6 @@ private:virtual void content_blocker_count_visibility_changed() override;void recreate_toolbar_icons();- void update_vertical_tabs_toolbar_button_placement();void connect_hamburger_menu();QToolButton* create_navigation_history_toolbar_button(QWidget& parent, QAction&, int direction);void update_chrome_style();@@ -235,9 +234,6 @@ private:QWidget* m_performance_monitor { nullptr };QWidget* m_toolbar_window_controls_separator { nullptr };QWidget* m_toolbar_window_controls { nullptr };- QSpacerItem* m_sidebar_toggle_navigation_spacer { nullptr };- QToolButton* m_left_toggle_vertical_tabs_expanded_button { nullptr };- QToolButton* m_right_toggle_vertical_tabs_expanded_button { nullptr };WindowControlButton* m_minimize_window_button { nullptr };WindowControlButton* m_maximize_window_button { nullptr };WindowControlButton* m_close_window_button { nullptr };@@ -275,7 +271,6 @@ private:bool m_has_had_real_size { false };bool m_is_updating_chrome_style { false };bool m_vertical_tabs_enabled { false };- WebView::VerticalTabsPosition m_vertical_tabs_position { WebView::VerticalTabsPosition::Left };#ifdef AK_OS_MACOSQHBoxLayout* m_view_layout { nullptr };// The web view's frame as TabWidget last asked for it, which a tab that hasn't loaded gets once it loads.@@ -292,7 +287,6 @@ private:QMenu* m_media_context_menu { nullptr };QMenu* m_select_dropdown { nullptr };- QAction* m_toggle_vertical_tabs_expanded_action { nullptr };QAction* m_navigate_back_action { nullptr };QAction* m_navigate_forward_action { nullptr };QAction* m_reload_action { nullptr };diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cppindex 11f1801b3c0..4206e71d794 100644--- a/UI/Qt/TabBar.cpp+++ b/UI/Qt/TabBar.cpp@@ -54,6 +54,7 @@#include <QStaticText>#include <QStyle>#include <QStyleOptionButton>+#include <QStyleOptionToolButton>#include <QStylePainter>#include <QTimer>#include <QToolButton>@@ -83,7 +84,7 @@ static constexpr int HORIZONTAL_TAB_MAX_WIDTH = 232;// A pinned tab's tile, which shows only its favicon.static constexpr int PINNED_TAB_TILE_WIDTH = 40;static constexpr int PINNED_TABS_SEPARATOR_HEIGHT = 9;-static constexpr int VERTICAL_TAB_HEIGHT = 38;+static constexpr int VERTICAL_TAB_HEIGHT = 37;static constexpr int VERTICAL_TABS_COLLAPSED_WIDTH = browser_chrome_layout_policy().collapsed_sidebar_width;static constexpr int VERTICAL_TABS_DEFAULT_EXPANDED_WIDTH = browser_chrome_layout_policy().expanded_sidebar_width;static constexpr int VERTICAL_TABS_MIN_EXPANDED_WIDTH = 190;@@ -92,8 +93,17 @@ static constexpr int VERTICAL_TABS_RESIZE_HIT_AREA_WIDTH = 5;static constexpr int VERTICAL_TABS_COLLAPSED_SIDE_MARGIN = 6;static constexpr int VERTICAL_TABS_EXPANDED_SIDE_MARGIN = 5;static constexpr int VERTICAL_TABS_TOP_MARGIN = 8;+static constexpr int VERTICAL_TABS_TOGGLE_BUTTON_SIZE = 32;+// The collapsed sidebar's corner below the toolbar, beside the page, is as round as the page's own corners.+static constexpr qreal VERTICAL_TABS_COLLAPSED_CORNER_RADIUS = 10.0;static constexpr int TAB_CARD_SHAPE_HORIZONTAL_INSET = 5;-static constexpr int TAB_CARD_SHAPE_VERTICAL_INSET = 3;+// A vertical tab's card sits a point higher than the middle of its row, so the cards in the sidebar sit close together+// while they keep an even height.+static constexpr int TAB_CARD_SHAPE_TOP_INSET = 3;+static constexpr int TAB_CARD_SHAPE_BOTTOM_INSET = 2;+// The selected vertical tab reaches across to the page's frame, with its sides flaring out into it above and below. The+// bar leaves this much room above its first tab and below its last, so the flares there are not cut off.+static constexpr int VERTICAL_TAB_FLARE_RADIUS = 6;// A horizontal tab's card holds its contents, and is what lights up when the tab is hovered. The selected tab is its card// extended down to the toolbar. The card sits above the middle of the tab, so its contents line up with the window// controls.@@ -226,7 +236,7 @@ static char const* vertical_tabs_position_property_value(WebView::VerticalTabsPostatic QRectF tab_card_shape_rect(QRectF const& rect){- return rect.adjusted(TAB_CARD_SHAPE_HORIZONTAL_INSET, TAB_CARD_SHAPE_VERTICAL_INSET, -TAB_CARD_SHAPE_HORIZONTAL_INSET, -TAB_CARD_SHAPE_VERTICAL_INSET);+ return rect.adjusted(TAB_CARD_SHAPE_HORIZONTAL_INSET, TAB_CARD_SHAPE_TOP_INSET, -TAB_CARD_SHAPE_HORIZONTAL_INSET, -TAB_CARD_SHAPE_BOTTOM_INSET);}enum class TabBarEdge : u8 {@@ -276,6 +286,39 @@ static QPainterPath horizontal_selected_tab_path(QRectF const& body)return path;}+// The selected vertical tab's outline: Its card reaches across to the page's edge of the sidebar at x = page_edge, and+// flares out above and below into the page's frame there. As with the horizontal tab, the path is left open along the+// edge it shares with the frame, and runs clockwise, which is the way the loading swirl goes around it. Filling it closes+// it.+static QPainterPath vertical_selected_tab_path(QRectF const& card, qreal page_edge)+{+ auto top = card.top();+ auto bottom = card.bottom();+ auto radius = card.height() / 2.0;+ qreal flare = VERTICAL_TAB_FLARE_RADIUS;++ QPainterPath path;+ if (page_edge > card.center().x()) {+ // From the bottom of the page's edge, along the bottom, around the round end, and along the top.+ path.moveTo(page_edge, bottom + flare);+ path.arcTo(QRectF(page_edge - (2 * flare), bottom, 2 * flare, 2 * flare), 0, 90);+ path.lineTo(card.left() + radius, bottom);+ path.arcTo(QRectF(card.left(), top, 2 * radius, 2 * radius), 270, -180);+ path.lineTo(page_edge - flare, top);+ path.arcTo(QRectF(page_edge - (2 * flare), top - (2 * flare), 2 * flare, 2 * flare), 270, 90);+ return path;+ }++ // From the top of the page's edge, along the top, around the round end, and along the bottom.+ path.moveTo(page_edge, top - flare);+ path.arcTo(QRectF(page_edge, top - (2 * flare), 2 * flare, 2 * flare), 180, 90);+ path.lineTo(card.right() - radius, top);+ path.arcTo(QRectF(card.right() - (2 * radius), top, 2 * radius, 2 * radius), 90, -180);+ path.lineTo(page_edge + flare, bottom);+ path.arcTo(QRectF(page_edge, bottom, 2 * flare, 2 * flare), 90, 90);+ return path;+}+// The new tab button lines up with the cards of the tabs beside it.static QRectF horizontal_new_tab_button_shape_rect(QRectF const& rect){@@ -286,7 +329,7 @@ static QRectF horizontal_new_tab_button_shape_rect(QRectF const& rect)static QRect tab_card_shape_rect(QRect const& rect){- return rect.adjusted(TAB_CARD_SHAPE_HORIZONTAL_INSET, TAB_CARD_SHAPE_VERTICAL_INSET, -TAB_CARD_SHAPE_HORIZONTAL_INSET, -TAB_CARD_SHAPE_VERTICAL_INSET);+ return rect.adjusted(TAB_CARD_SHAPE_HORIZONTAL_INSET, TAB_CARD_SHAPE_TOP_INSET, -TAB_CARD_SHAPE_HORIZONTAL_INSET, -TAB_CARD_SHAPE_BOTTOM_INSET);}// When a tab finishes loading, a soft band of light sweeps across its pill from left to right.@@ -339,21 +382,14 @@ static QColor horizontal_tab_separator(QPalette const& palette)return ChromeStyle::mix(ChromeStyle::chrome_tab_strip_background(palette), ChromeStyle::chrome_text(palette), dark ? 0.18 : 0.25);}-// The selected vertical tab is a flat card that stands out from the sidebar a little more than a hovered tab does.-static QColor vertical_selected_tab_surface(QPalette const& palette)-{- auto dark = ChromeStyle::is_dark(palette);- return ChromeStyle::mix(ChromeStyle::chrome_background(palette), dark ? QColor(255, 255, 255) : QColor(0, 0, 0), dark ? 0.14 : 0.09);-}-static QRectF collapsed_vertical_tab_shape_rect(QRectF const& rect){- return rect.adjusted(4.0, 3.0, -4.0, -3.0);+ return rect.adjusted(4.0, TAB_CARD_SHAPE_TOP_INSET, -4.0, -TAB_CARD_SHAPE_BOTTOM_INSET);}static QRect collapsed_vertical_tab_shape_rect(QRect const& rect){- return rect.adjusted(4, 3, -4, -3);+ return rect.adjusted(4, TAB_CARD_SHAPE_TOP_INSET, -4, -TAB_CARD_SHAPE_BOTTOM_INSET);}class NewTabButton final : public QToolButton {@@ -397,7 +433,7 @@ private:? tab_card_shape_rect(QRectF(rect())): (is_horizontal_new_tab_button? horizontal_new_tab_button_shape_rect(QRectF(rect()))- : QRectF(rect()).adjusted(4.0, 3.0, -4.0, -3.0));+ : QRectF(rect()).adjusted(4.0, TAB_CARD_SHAPE_TOP_INSET, -4.0, -TAB_CARD_SHAPE_BOTTOM_INSET));// NB: The horizontal new tab button's shape is square, so this pill is a circle.QPainterPath tab_path;tab_path.addRoundedRect(shape_rect, shape_rect.height() / 2.0, shape_rect.height() / 2.0);@@ -448,6 +484,24 @@ private:TabBar& m_tab_bar;};+class VerticalTabsToggleButton final : public QToolButton {+public:+ AK_ALLOC_WITH_KMALLOC;++ using QToolButton::QToolButton;++private:+ virtual void paintEvent(QPaintEvent*) override+ {+ QStyleOptionToolButton option;+ initStyleOption(&option);++ QStylePainter painter(this);+ ChromeStyle::paint_circular_control_frame(painter, *this);+ painter.drawComplexControl(QStyle::CC_ToolButton, option);+ }+};+class TabPreviewThumbnail final : public QWidget {public:AK_ALLOC_WITH_KMALLOC;@@ -788,7 +842,7 @@ QSize TabBar::minimumSizeHint() const{// However many tabs are pinned, one row is enough: Pinned tabs that don't fit in half the bar scroll with the rest.if (tab_layout() != TabLayout::Horizontal)- return { vertical_tab_width(m_available_width, tab_layout()), count() > 0 ? VERTICAL_TAB_HEIGHT : 0 };+ return { vertical_tab_width(m_available_width, tab_layout()), count() > 0 ? (2 * VERTICAL_TAB_FLARE_RADIUS) + VERTICAL_TAB_HEIGHT : 0 };return QTabBar::minimumSizeHint();}@@ -896,7 +950,9 @@ void TabBar::paintEvent(QPaintEvent*)// While tabs make way for a pinned tab dragged in from another window, the pinned tabs can take up another row.auto pinned_region_growth = qRound(current_pinned_region_growth());auto fixed_height = region.scrolls ? 0 : region.height + pinned_region_growth;- QRect unpinned_clip { 0, fixed_height, width(), max(0, height() - fixed_height) };+ // NB: Without pinned tabs in the way, the unpinned tabs also use the room above them.+ auto unpinned_clip_top = fixed_height > 0 ? VERTICAL_TAB_FLARE_RADIUS + fixed_height : 0;+ QRect unpinned_clip { 0, unpinned_clip_top, width(), max(0, height() - unpinned_clip_top) };// Titles are shaped once and kept for as long as some tab shows them, since resizing the window repaints the tab// bar on every step without changing any title.@@ -946,6 +1002,8 @@ void TabBar::paintEvent(QPaintEvent*)QPainterPath tab_path;if (!is_vertical && is_selected)tab_path = horizontal_selected_tab_path(QRectF(shape_rect.left(), shape_rect.top(), shape_rect.width(), tab_rect.bottom() + 1 - shape_rect.top()));+ else if (is_selected && !is_pinned_tile)+ tab_path = vertical_selected_tab_path(shape_rect, vertical_tabs_are_on_right() ? 0.0 : static_cast<qreal>(width()));elsetab_path.addRoundedRect(shape_rect, shape_rect.height() / 2.0, shape_rect.height() / 2.0);@@ -974,7 +1032,7 @@ void TabBar::paintEvent(QPaintEvent*)painter.drawPath(tab_path);} else if (is_selected) {painter.setPen(Qt::NoPen);- painter.setBrush(vertical_selected_tab_surface(palette()));+ painter.setBrush(ChromeStyle::chrome_active_tab_surface(palette()));painter.drawPath(tab_path);} else if (is_hovered) {painter.setBrush(tab_hover_surface(palette(), hover_progress));@@ -1117,7 +1175,7 @@ void TabBar::paintEvent(QPaintEvent*)auto separator = ChromeStyle::chrome_border(palette());separator.setAlpha(dark ? 40 : 32);painter.setPen(separator);- auto separator_y = region.height + pinned_region_growth - (PINNED_TABS_SEPARATOR_HEIGHT / 2) - (region.scrolls ? m_vertical_scroll_offset : 0);+ auto separator_y = VERTICAL_TAB_FLARE_RADIUS + region.height + pinned_region_growth - (PINNED_TABS_SEPARATOR_HEIGHT / 2) - (region.scrolls ? m_vertical_scroll_offset : 0);painter.drawLine(QPoint(10, separator_y), QPoint(width() - 10, separator_y));}}@@ -1846,11 +1904,18 @@ QPoint TabBar::tab_preview_position_for(int index, QSize const& popup_size) consreturn position;}+// The width of the tabs, which the bar reaches past on the page's side, where the selected tab joins the page's frame.int TabBar::vertical_bar_width() const{+ auto tab_width = vertical_tab_width(m_available_width, tab_layout());if (auto bar_width = width(); bar_width > 0)- return bar_width;- return vertical_tab_width(m_available_width, tab_layout());+ return min(bar_width, tab_width);+ return tab_width;+}++int TabBar::vertical_tabs_left() const+{+ return vertical_tabs_are_on_right() ? max(0, width() - vertical_bar_width()) : 0;}TabBar::PinnedRegion TabBar::pinned_region() const@@ -1905,12 +1970,12 @@ QRect TabBar::vertical_tab_rect(int index, PinnedRegion const& region) constif (index < region.count) {auto row = index / region.columns;auto column = index % region.columns;- auto top = (row * VERTICAL_TAB_HEIGHT) - (region.scrolls ? m_vertical_scroll_offset : 0);- return { column * region.tile_width, top, region.tile_width, VERTICAL_TAB_HEIGHT };+ auto top = VERTICAL_TAB_FLARE_RADIUS + (row * VERTICAL_TAB_HEIGHT) - (region.scrolls ? m_vertical_scroll_offset : 0);+ return { vertical_tabs_left() + (column * region.tile_width), top, region.tile_width, VERTICAL_TAB_HEIGHT };}auto unpinned_index = index - region.count;- return { 0, region.height + (unpinned_index * VERTICAL_TAB_HEIGHT) - m_vertical_scroll_offset, vertical_bar_width(), VERTICAL_TAB_HEIGHT };+ return { vertical_tabs_left(), VERTICAL_TAB_FLARE_RADIUS + region.height + (unpinned_index * VERTICAL_TAB_HEIGHT) - m_vertical_scroll_offset, vertical_bar_width(), VERTICAL_TAB_HEIGHT };}int TabBar::tab_index_at(QPoint const& position) const@@ -1922,17 +1987,23 @@ int TabBar::tab_index_at(QPoint const& position) constreturn -1;auto region = pinned_region();- auto pinned_y = position.y() + (region.scrolls ? m_vertical_scroll_offset : 0);+ auto y = position.y() - VERTICAL_TAB_FLARE_RADIUS;+ if (y < 0)+ return -1;+ auto pinned_y = y + (region.scrolls ? m_vertical_scroll_offset : 0);if (pinned_y < region.height) {if (pinned_y >= region.height - PINNED_TABS_SEPARATOR_HEIGHT)return -1;+ auto x = position.x() - vertical_tabs_left();+ if (x < 0)+ return -1;auto row = pinned_y / VERTICAL_TAB_HEIGHT;- auto column = min(position.x() / region.tile_width, region.columns - 1);+ auto column = min(x / region.tile_width, region.columns - 1);auto index = (row * region.columns) + column;return index < region.count ? index : -1;}- auto index = region.count + ((position.y() - region.height + m_vertical_scroll_offset) / VERTICAL_TAB_HEIGHT);+ auto index = region.count + ((y - region.height + m_vertical_scroll_offset) / VERTICAL_TAB_HEIGHT);if (index >= count())return -1;@@ -1945,7 +2016,7 @@ int TabBar::tab_index_at(QPoint const& position) constQSize TabBar::vertical_size_hint(int tab_count) const{auto region = pinned_region();- return { vertical_tab_width(m_available_width, tab_layout()), region.height + (max(0, tab_count - region.count) * VERTICAL_TAB_HEIGHT) };+ return { vertical_tab_width(m_available_width, tab_layout()), (2 * VERTICAL_TAB_FLARE_RADIUS) + region.height + (max(0, tab_count - region.count) * VERTICAL_TAB_HEIGHT) };}bool TabBar::vertical_tabs_are_on_right() const@@ -1958,7 +2029,7 @@ int TabBar::max_vertical_scroll_offset() constif (tab_layout() == TabLayout::Horizontal)return 0;auto region = pinned_region();- return max(0, region.height + ((count() - region.count) * VERTICAL_TAB_HEIGHT) - height());+ return max(0, (2 * VERTICAL_TAB_FLARE_RADIUS) + region.height + ((count() - region.count) * VERTICAL_TAB_HEIGHT) - height());}void TabBar::set_vertical_scroll_offset(int offset)@@ -1987,7 +2058,7 @@ void TabBar::ensure_tab_visible(int index)? (index / region.columns) * VERTICAL_TAB_HEIGHT: region.height + ((index - region.count) * VERTICAL_TAB_HEIGHT) - region.fixed_height();auto tab_bottom = tab_top + VERTICAL_TAB_HEIGHT;- auto visible_height = height() - region.fixed_height();+ auto visible_height = height() - (2 * VERTICAL_TAB_FLARE_RADIUS) - region.fixed_height();if (tab_top < m_vertical_scroll_offset)set_vertical_scroll_offset(tab_top);@@ -2310,6 +2381,14 @@ TabWidget::TabWidget(QWidget* parent)m_vertical_tab_bar_column->setProperty(VERTICAL_TABS_RESIZE_HANDLE_ACTIVE_PROPERTY, false);m_vertical_tab_bar_column->installEventFilter(this);+ m_vertical_tabs_toggle_button = new VerticalTabsToggleButton(m_vertical_tab_bar_column);+ m_vertical_tabs_toggle_button->setObjectName("LadybirdVerticalTabsToggleButton");+ m_vertical_tabs_toggle_button->setDefaultAction(create_application_action(*this, Application::the().toggle_vertical_tabs_expanded_action()));+ m_vertical_tabs_toggle_button->setAutoRaise(true);+ m_vertical_tabs_toggle_button->setFocusPolicy(Qt::NoFocus);+ m_vertical_tabs_toggle_button->setIconSize({ 20, 20 });+ m_vertical_tabs_toggle_button->setFixedSize(VERTICAL_TABS_TOGGLE_BUTTON_SIZE, VERTICAL_TABS_TOGGLE_BUTTON_SIZE);+m_vertical_tabs_content_separator = new QWidget(this);m_vertical_tabs_content_separator->setObjectName("LadybirdVerticalTabsContentSeparator");m_vertical_tabs_content_separator->setAttribute(Qt::WA_TransparentForMouseEvents);@@ -2457,7 +2536,6 @@ void TabWidget::insert_tab(int index, Tab* widget, QString const& label)m_toolbar_container->insertWidget(index, widget->toolbar_container());widget->set_vertical_tabs_enabled(m_vertical_tabs_enabled);- widget->set_vertical_tabs_position(m_vertical_tabs_position);#ifdef AK_OS_MACOSupdate_web_view_frame(*widget);#endif@@ -2587,8 +2665,6 @@ void TabWidget::set_vertical_tabs_position(WebView::VerticalTabsPosition positiom_vertical_tabs_position = position;set_vertical_tabs_hover_expanded(false);- for (int index = 0; index < m_stacked_widget->count(); ++index)- tab(index)->set_vertical_tabs_position(position);rebuild_layout();}@@ -2634,6 +2710,11 @@ bool TabWidget::eventFilter(QObject* watched, QEvent* event)if (watched == m_tab_bar && (event->type() == QEvent::Move || event->type() == QEvent::Resize))place_horizontal_new_tab_button();+ if (watched == m_vertical_tab_bar_column && event->type() == QEvent::Paint && !m_vertical_tabs_expanded) {+ paint_collapsed_vertical_tabs_column();+ return true;+ }+if (watched == m_tab_bar_row || watched == m_vertical_tab_bar_column) {auto* tab_strip = static_cast<QWidget*>(watched);@@ -2890,7 +2971,19 @@ int TabWidget::vertical_tabs_layout_width() constbool TabWidget::should_show_window_controls_in_tab_toolbar() const{- return m_window_controls_visible && m_tab_bar->tab_layout() != TabLayout::Horizontal;+ return m_window_controls_visible && m_tab_bar->tab_layout() != TabLayout::Horizontal && !vertical_tabs_hold_window_controls();+}++// The native window controls sit in the window's top left corner, so the open sidebar on the left holds them.+bool TabWidget::vertical_tabs_hold_window_controls() const+{+ return use_native_macos_window_controls() && m_window_controls_visible && m_vertical_tabs_expanded && !vertical_tabs_are_on_right();+}++int TabWidget::vertical_tabs_column_top_margin() const+{+ // NB: The open sidebar's top row is level with the toolbar, at the top of the window.+ return m_vertical_tabs_expanded ? 0 : VERTICAL_TABS_TOP_MARGIN;}void TabWidget::update_toolbar_placement()@@ -2953,15 +3046,25 @@ void TabWidget::rebuild_layout()if (m_tab_bar->tab_layout() != TabLayout::Horizontal) {rebuild_layout_for_vertical_tabs();- m_main_layout->addWidget(m_toolbar_container);- m_page_column->hide();++ // The open sidebar runs the full height of the window, with the toolbar beside it above the page. The collapsed+ // sidebar sits below a toolbar across the whole window.+ QWidget* page = m_stacked_widget;+ if (m_vertical_tabs_expanded) {+ rebuild_page_column();+ page = m_page_column;+ m_page_column->show();+ } else {+ m_main_layout->addWidget(m_toolbar_container);+ m_page_column->hide();+ }if (vertical_tabs_are_on_right()) {- m_vertical_tabs_content_layout->addWidget(m_stacked_widget, 1);+ m_vertical_tabs_content_layout->addWidget(page, 1);m_vertical_tabs_content_layout->addWidget(m_vertical_tabs_reserved_space);} else {m_vertical_tabs_content_layout->addWidget(m_vertical_tabs_reserved_space);- m_vertical_tabs_content_layout->addWidget(m_stacked_widget, 1);+ m_vertical_tabs_content_layout->addWidget(page, 1);}m_main_layout->addWidget(m_vertical_tabs_content, 1);m_vertical_tabs_content->show();@@ -3026,6 +3129,7 @@ void TabWidget::place_horizontal_new_tab_button()void TabWidget::rebuild_layout_for_vertical_tabs(){+ update_vertical_tabs_toggle_icon();auto reserved_width = vertical_tabs_layout_width();auto side_bar_width = current_vertical_tabs_width();m_vertical_tabs_reserved_space->setFixedWidth(reserved_width);@@ -3033,19 +3137,82 @@ void TabWidget::rebuild_layout_for_vertical_tabs()set_dynamic_property_if_needed(*m_vertical_tab_bar_column, VERTICAL_TABS_POSITION_PROPERTY, vertical_tabs_position_property_value(m_vertical_tabs_position));m_vertical_tab_bar_column_layout->setSpacing(0);- auto tab_layout = m_tab_bar->tab_layout();- auto side_margin = vertical_tabs_side_margin(tab_layout != TabLayout::VerticalCollapsed);if (auto* window_controls_layout = m_window_controls->layout())window_controls_layout->setContentsMargins(0, 0, 0, 0);- m_vertical_tab_bar_column_layout->setContentsMargins(side_margin, VERTICAL_TABS_TOP_MARGIN, side_margin, 8);+ update_vertical_tabs_column_margins();update_vertical_tabs_button_layout();+ auto* top_row_layout = new QHBoxLayout;+ top_row_layout->setSpacing(0);+ if (m_vertical_tabs_expanded) {+ // The open sidebar runs the full height of the window. Its top row sits beside the toolbar, and holds the window+ // controls when they are on its side, with the sidebar's toggle at the edge toward the page.+ auto page_side_margin = vertical_tabs_side_margin(true);+ top_row_layout->setContentsMargins(vertical_tabs_are_on_right() ? page_side_margin : 0, 0, vertical_tabs_are_on_right() ? 0 : page_side_margin, 0);+ top_row_layout->addStrut(Tab::toolbar_height(should_show_window_controls_in_tab_toolbar()));+ if (vertical_tabs_hold_window_controls())+ top_row_layout->addSpacing(NATIVE_MACOS_WINDOW_CONTROLS_WIDTH);+ if (!vertical_tabs_are_on_right())+ top_row_layout->addStretch(1);+ top_row_layout->addWidget(m_vertical_tabs_toggle_button, 0, Qt::AlignVCenter);+ if (vertical_tabs_are_on_right())+ top_row_layout->addStretch(1);+ } else {+ // The collapsed sidebar's toggle sits above its tabs, centered on the collapsed sidebar, and stays put while+ // the sidebar opens on hover.+ auto collapsed_tab_width = VERTICAL_TABS_COLLAPSED_WIDTH - vertical_tabs_horizontal_margin_width(TabLayout::VerticalCollapsed);+ auto inset = (collapsed_tab_width - VERTICAL_TABS_TOGGLE_BUTTON_SIZE) / 2;+ top_row_layout->setContentsMargins(vertical_tabs_are_on_right() ? 0 : inset, 0, vertical_tabs_are_on_right() ? inset : 0, 0);+ // NB: The tab bar below leaves room above its first tab.+ top_row_layout->addStrut(VERTICAL_TAB_HEIGHT - VERTICAL_TAB_FLARE_RADIUS);+ if (vertical_tabs_are_on_right())+ top_row_layout->addStretch(1);+ top_row_layout->addWidget(m_vertical_tabs_toggle_button, 0, Qt::AlignVCenter);+ if (!vertical_tabs_are_on_right())+ top_row_layout->addStretch(1);+ }+ m_vertical_tab_bar_column_layout->addLayout(top_row_layout);+ if (m_vertical_tabs_expanded)+ m_vertical_tab_bar_column_layout->addSpacing(VERTICAL_TABS_TOP_MARGIN - VERTICAL_TAB_FLARE_RADIUS);+m_vertical_tab_bar_column_layout->addWidget(m_tab_bar);- m_vertical_tab_bar_column_layout->addWidget(m_new_tab_button);+ m_vertical_tab_bar_column_layout->addWidget(m_new_tab_button, 0, vertical_tabs_are_on_right() ? Qt::AlignRight : Qt::AlignLeft);m_vertical_tab_bar_column_layout->addStretch(1);}+// The collapsed sidebar sits below the toolbar, which flows around its rounded corner beside the page into the frame+// around the page.+void TabWidget::paint_collapsed_vertical_tabs_column()+{+ QPainter painter(m_vertical_tab_bar_column);+ QStyleOption option;+ option.initFrom(m_vertical_tab_bar_column);+ m_vertical_tab_bar_column->style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, m_vertical_tab_bar_column);++ auto radius = VERTICAL_TABS_COLLAPSED_CORNER_RADIUS;+ auto page_edge = vertical_tabs_are_on_right() ? 0.0 : static_cast<qreal>(m_vertical_tab_bar_column->width());+ auto corner_left = vertical_tabs_are_on_right() ? page_edge : page_edge - radius;++ QPainterPath corner;+ corner.addRect(corner_left, 0, radius, radius);+ QPainterPath inside;+ inside.addEllipse(QPointF(vertical_tabs_are_on_right() ? page_edge + radius : page_edge - radius, radius), radius, radius);++ painter.setRenderHint(QPainter::Antialiasing, true);+ painter.fillPath(corner.subtracted(inside), ChromeStyle::chrome_background(palette()));+}++void TabWidget::update_vertical_tabs_column_margins()+{+ // NB: The tab bar reaches the page's side of the sidebar, where its selected tab joins the page's frame, so the+ // column has no margin on that side.+ auto side_margin = vertical_tabs_side_margin(m_tab_bar->tab_layout() != TabLayout::VerticalCollapsed);+ auto left = vertical_tabs_are_on_right() ? 0 : side_margin;+ auto right = vertical_tabs_are_on_right() ? side_margin : 0;+ m_vertical_tab_bar_column_layout->setContentsMargins(left, vertical_tabs_column_top_margin(), right, 8);+}+void TabWidget::rebuild_page_column(){m_page_column_layout->addWidget(m_toolbar_container);@@ -3141,12 +3308,9 @@ void TabWidget::update_vertical_tabs_hover_layout()m_tab_bar->set_pinned_tabs_in_rows(m_vertical_tabs_hover_expanded && !m_vertical_tabs_expanded);m_tab_bar->set_tab_layout(current_tab_layout());- auto tab_layout = m_tab_bar->tab_layout();- auto side_margin = vertical_tabs_side_margin(tab_layout != TabLayout::VerticalCollapsed);-m_tab_bar->set_vertical_tabs_position(m_vertical_tabs_position);set_dynamic_property_if_needed(*m_vertical_tab_bar_column, VERTICAL_TABS_POSITION_PROPERTY, vertical_tabs_position_property_value(m_vertical_tabs_position));- m_vertical_tab_bar_column_layout->setContentsMargins(side_margin, VERTICAL_TABS_TOP_MARGIN, side_margin, 8);+ update_vertical_tabs_column_margins();update_vertical_tabs_button_layout();update_tab_button_visibility();@@ -3155,7 +3319,8 @@ void TabWidget::update_vertical_tabs_hover_layout()QRect TabWidget::vertical_tabs_chrome_rect() const{- auto chrome_height = m_toolbar_container->height();+ // NB: The open sidebar runs the full height of the window, and the collapsed one starts below the toolbar.+ auto chrome_height = m_vertical_tabs_expanded ? 0 : m_toolbar_container->height();auto chrome_width = current_vertical_tabs_width();return {vertical_tabs_are_on_right() ? max(0, width() - chrome_width) : 0,@@ -3279,11 +3444,23 @@ void TabWidget::update_web_view_frame(Tab& tab)void TabWidget::recreate_icons(){m_tab_bar->recreate_icons();+ update_vertical_tabs_toggle_icon();m_new_tab_button->setIcon(create_chrome_icon(ChromeIcon::NewTab, palette()));update_vertical_tabs_action_labels();update_window_button_icons();}+void TabWidget::update_vertical_tabs_toggle_icon()+{+ // NB: The icons are first made before the sidebar and its toggle are.+ if (!m_vertical_tabs_toggle_button)+ return;+ auto icon = vertical_tabs_are_on_right()+ ? (m_vertical_tabs_expanded ? ChromeIcon::VerticalTabBarCollapseRight : ChromeIcon::VerticalTabBarExpandRight)+ : (m_vertical_tabs_expanded ? ChromeIcon::VerticalTabBarCollapse : ChromeIcon::VerticalTabBarExpand);+ m_vertical_tabs_toggle_button->defaultAction()->setIcon(create_chrome_icon(icon, palette()));+}+void TabWidget::update_chrome_style(){if (m_is_updating_chrome_style)diff --git a/UI/Qt/TabBar.h b/UI/Qt/TabBar.hindex a4fc56ac52f..66ffd357bee 100644--- a/UI/Qt/TabBar.h+++ b/UI/Qt/TabBar.h@@ -157,6 +157,7 @@ private:QRect vertical_tab_rect(int index, PinnedRegion const&) const;bool pinned_tabs_are_tiles() const;int vertical_bar_width() const;+ int vertical_tabs_left() const;QRect visual_tab_rect(int index) const;int tab_index_at(QPoint const&) const;@@ -272,12 +273,16 @@ private:bool vertical_tabs_are_on_right() const;int vertical_tabs_layout_width() const;bool should_show_window_controls_in_tab_toolbar() const;+ bool vertical_tabs_hold_window_controls() const;+ int vertical_tabs_column_top_margin() const;void rebuild_layout();void rebuild_layout_for_horizontal_tabs();void place_horizontal_new_tab_button();void rebuild_layout_for_vertical_tabs();void rebuild_page_column();+ void update_vertical_tabs_column_margins();+ void paint_collapsed_vertical_tabs_column();void update_toolbar_placement();void update_tab_toolbar_window_controls_visibility();int current_vertical_tabs_width() const;@@ -296,6 +301,7 @@ private:void update_web_view_frame(Tab&);#endifvoid recreate_icons();+ void update_vertical_tabs_toggle_icon();void update_chrome_style();void update_vertical_tabs_overlay_geometry();void update_vertical_tabs_content_overlay();@@ -312,6 +318,7 @@ private:QStackedWidget* m_stacked_widget { nullptr };QToolButton* m_new_tab_button { nullptr };+ QToolButton* m_vertical_tabs_toggle_button { nullptr };QToolButton* m_minimize_window_button { nullptr };QToolButton* m_maximize_window_button { nullptr };QToolButton* m_close_window_button { nullptr };