Skip to content

Commit

Permalink
Merge pull request #25537 from Ilie-Lesan/brave-crashes-when-its-redu…
Browse files Browse the repository at this point in the history
…ced-to-the-smallest-size-on-screen

Increase the contents view size so it can still receive events(please…
  • Loading branch information
simonhong authored Sep 30, 2024
2 parents 0edf16f + 92aa3bc commit 30038b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
5 changes: 3 additions & 2 deletions browser/ui/brave_layout_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ std::optional<int> GetBraveLayoutConstant(LayoutConstant constant) {
}
case TAB_STRIP_HEIGHT: {
if (HorizontalTabsUpdateEnabled()) {
return brave_tabs::GetHorizontalTabStripHeight();
return brave_tabs::GetHorizontalTabStripHeight() +
GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP);
}
return std::nullopt;
}
Expand All @@ -57,7 +58,7 @@ std::optional<int> GetBraveLayoutConstant(LayoutConstant constant) {
if (!HorizontalTabsUpdateEnabled()) {
return std::nullopt;
}
return 0;
return 1;
}
case LOCATION_BAR_CHILD_CORNER_RADIUS:
return 4;
Expand Down
33 changes: 8 additions & 25 deletions browser/ui/views/frame/brave_non_client_hit_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "brave/browser/ui/views/frame/brave_non_client_hit_test_helper.h"

#include "brave/browser/ui/views/tabs/vertical_tab_utils.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "ui/base/hit_test.h"
Expand Down Expand Up @@ -48,6 +49,12 @@ int NonClientHitTest(BrowserView* browser_view,
return hit_test_result;
}

// Below checking is only for dragging with tab when vertical tab is
// enabled and title is hidden.
if (!tabs::utils::ShouldShowVerticalTabs(browser_view->browser())) {
return HTNOWHERE;
}

// Now we have only resizable areas.
if (point_in_widget.x() <= kResizableArea &&
point_in_widget.y() <= kResizableArea) {
Expand All @@ -59,35 +66,11 @@ int NonClientHitTest(BrowserView* browser_view,
return HTTOPRIGHT;
}

if (point_in_widget.x() <= kResizableArea &&
point_in_widget.y() >= (widget_bounds.bottom() - kResizableArea)) {
return HTBOTTOMLEFT;
}

if (point_in_widget.x() >= (widget_bounds.right() - kResizableArea) &&
point_in_widget.y() >= (widget_bounds.bottom() - kResizableArea)) {
return HTBOTTOMRIGHT;
}

if (point_in_widget.x() <= kResizableArea) {
return HTLEFT;
}

if (point_in_widget.x() >= (widget_bounds.right() - kResizableArea)) {
return HTRIGHT;
}

if (point_in_widget.y() <= kResizableArea) {
return HTTOP;
}

if (point_in_widget.y() <= (widget_bounds.bottom() - kResizableArea)) {
return HTBOTTOM;
}

NOTREACHED_IN_MIGRATION()
<< "This shouldn't happen. Maybe due to inclusive/exclusive comparison?";
return hit_test_result;
return HTNOWHERE;
}

} // namespace brave

0 comments on commit 30038b8

Please sign in to comment.