Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace patches in BrowserFrameViewWin with overrides #22025

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions browser/ui/views/frame/brave_browser_frame_view_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "brave/browser/ui/views/frame/brave_browser_frame_view_win.h"

#include "brave/browser/ui/tabs/brave_tab_prefs.h"
#include "brave/browser/ui/tabs/features.h"
#include "brave/browser/ui/views/frame/brave_non_client_hit_test_helper.h"
#include "brave/browser/ui/views/frame/brave_window_frame_graphic.h"
#include "brave/browser/ui/views/tabs/vertical_tab_utils.h"
Expand Down Expand Up @@ -105,3 +106,14 @@ int BraveBrowserFrameViewWin::NonClientHitTest(const gfx::Point& point) {

return result;
}

int BraveBrowserFrameViewWin::FrameTopBorderThickness(bool restored) const {
if (tabs::features::HorizontalTabsUpdateEnabled()) {
if (!(frame()->IsFullscreen() || IsMaximized()) || restored) {
if (browser_view()->GetTabStripVisible()) {
return 2;
}
}
}
return BrowserFrameViewWin::FrameTopBorderThickness(restored);
}
1 change: 1 addition & 0 deletions browser/ui/views/frame/brave_browser_frame_view_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class BraveBrowserFrameViewWin : public BrowserFrameViewWin {
void OnPaint(gfx::Canvas* canvas) override;
int GetTopInset(bool restored) const override;
int NonClientHitTest(const gfx::Point& point) override;
int FrameTopBorderThickness(bool restored) const override;

std::unique_ptr<BraveWindowFrameGraphic> frame_graphic_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "brave/browser/ui/tabs/features.h"
#include "ui/base/ui_base_features.h"

// The tab region view maintains its own padding; the frame view does not need
// to reserve an extra top margin for it.
#define BRAVE_BROWSER_FRAME_VIEW_WIN_TOP_AREA_HEIGHT \
if (tabs::features::HorizontalTabsUpdateEnabled()) { \
return top; \
}
namespace features {

// The top frame border thickness is smaller when using updated horizontal tabs.
#define BRAVE_BROWSER_FRAME_VIEW_WIN_FRAME_TOP_BORDER_THICKNESS \
if (tabs::features::HorizontalTabsUpdateEnabled()) { \
return 2; \
}
bool BraveHorizontalTabsUpdateEnabled() {
return tabs::features::HorizontalTabsUpdateEnabled();
}

} // namespace features

// When updated horizontal tabs are enabled, we want to use the same layout
// logic as upstream's "Refresh2023" for tab strip positioning and for the
// window caption button height. When upstream's feature flag is removed, this
// define can also be removed.
#define IsChromeRefresh2023 BraveHorizontalTabsUpdateEnabled

#include "src/chrome/browser/ui/views/frame/browser_frame_view_win.cc" // IWYU pragma: export

#undef BRAVE_BROWSER_FRAME_VIEW_WIN_FRAME_TOP_BORDER_THICKNESS
#undef BRAVE_BROWSER_FRAME_VIEW_WIN_TOP_AREA_HEIGHT
#undef IsChromeRefresh2023
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
client_view_bounds_; \
friend class BraveBrowserFrameViewWin

#define FrameTopBorderThickness virtual FrameTopBorderThickness

#include "src/chrome/browser/ui/views/frame/browser_frame_view_win.h" // IWYU pragma: export

#undef FrameTopBorderThickness
#undef client_view_bounds_

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_VIEW_WIN_H_

This file was deleted.

Loading