Treat the toolbar, tab strip, and vertical sidebar as one browser chrome surface. Add an explicit layout policy for platform window controls and sidebar widths. This lets macOS use left-side traffic lights while other platforms keep right-side custom controls. Keep the macOS toolbar stable in vertical-tabs mode. Traffic lights and navigation controls stay in the top row, and the sidebar sits below it. Draw chrome/content separators explicitly so the content edge remains clear without adding seams inside the chrome surface. Retune tab, toolbar, and omnibox styling for the unified chrome. Tabs use card-like selected states, quiet inactive states, and matching horizontal and vertical geometry. Make hover-expanded vertical tabs draw as a chrome overlay so the web content does not relayout. Keep the overlay above native web views and route macOS window drags through AppKit events for reliable dragging from custom chrome.
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2026-present, the Ladybird developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Platform.h>
|
|
|
|
namespace Ladybird {
|
|
|
|
enum class WindowControlsPlacement {
|
|
LeftTrafficLights,
|
|
RightCustomControls,
|
|
};
|
|
|
|
struct BrowserChromeLayoutPolicy {
|
|
WindowControlsPlacement controls_placement;
|
|
int expanded_sidebar_width;
|
|
int collapsed_sidebar_width;
|
|
int toolbar_height;
|
|
};
|
|
|
|
static constexpr BrowserChromeLayoutPolicy browser_chrome_layout_policy()
|
|
{
|
|
return {
|
|
#if defined(AK_OS_MACOS)
|
|
.controls_placement = WindowControlsPlacement::LeftTrafficLights,
|
|
#else
|
|
.controls_placement = WindowControlsPlacement::RightCustomControls,
|
|
#endif
|
|
.expanded_sidebar_width = 232,
|
|
.collapsed_sidebar_width = 52,
|
|
.toolbar_height = 42,
|
|
};
|
|
}
|
|
|
|
static constexpr bool use_left_traffic_light_window_controls()
|
|
{
|
|
return browser_chrome_layout_policy().controls_placement == WindowControlsPlacement::LeftTrafficLights;
|
|
}
|
|
|
|
static constexpr bool use_right_custom_window_controls()
|
|
{
|
|
return browser_chrome_layout_policy().controls_placement == WindowControlsPlacement::RightCustomControls;
|
|
}
|
|
|
|
static constexpr bool show_menubar_option_available()
|
|
{
|
|
return use_right_custom_window_controls();
|
|
}
|
|
|
|
}
|