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

Added separator to sidebar ctx menu between show sidebar and position (uplift to 1.48.x) #16735

Merged
merged 1 commit into from
Jan 23, 2023
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
2 changes: 2 additions & 0 deletions browser/ui/views/sidebar/sidebar_control_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ void SidebarControlView::ShowContextMenuForViewImpl(
static_cast<int>(ShowSidebarOption::kShowNever),
brave_l10n::GetLocalizedResourceUTF16String(
IDS_SIDEBAR_SHOW_OPTION_NEVER));
context_menu_model_->AddSeparator(
ui::MenuSeparatorType::BOTH_SIDE_PADDED_SEPARATOR);
context_menu_model_->AddTitle(brave_l10n::GetLocalizedResourceUTF16String(
IDS_SIDEBAR_MENU_MODEL_POSITION_OPTION_TITLE));
context_menu_model_->AddItemWithStringId(
Expand Down
15 changes: 15 additions & 0 deletions chromium_src/ui/base/models/menu_separator_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2023 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

#ifndef BRAVE_CHROMIUM_SRC_UI_BASE_MODELS_MENU_SEPARATOR_TYPES_H_
#define BRAVE_CHROMIUM_SRC_UI_BASE_MODELS_MENU_SEPARATOR_TYPES_H_

#define PADDED_SEPARATOR BOTH_SIDE_PADDED_SEPARATOR, PADDED_SEPARATOR

#include "src/ui/base/models/menu_separator_types.h"

#undef PADDED_SEPARATOR

#endif // BRAVE_CHROMIUM_SRC_UI_BASE_MODELS_MENU_SEPARATOR_TYPES_H_
12 changes: 12 additions & 0 deletions chromium_src/ui/views/controls/menu/menu_separator.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) 2023 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

#define BRAVE_MENU_SEPARATOR_ON_PAINT \
else if (type_ == ui::BOTH_SIDE_PADDED_SEPARATOR) \
paint_rect.Inset(gfx::Insets::VH(0, 8));

#include "src/ui/views/controls/menu/menu_separator.cc"

#undef BRAVE_MENU_SEPARATOR_ON_PAINT
12 changes: 12 additions & 0 deletions patches/ui-views-controls-menu-menu_separator.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/ui/views/controls/menu/menu_separator.cc b/ui/views/controls/menu/menu_separator.cc
index be7ca4059bc2d7f78419dbf863fdb7c74070e9dc..6391ae9d86b0d66cca37d98f71506c2733b12edd 100644
--- a/ui/views/controls/menu/menu_separator.cc
+++ b/ui/views/controls/menu/menu_separator.cc
@@ -43,6 +43,7 @@ void MenuSeparator::OnPaint(gfx::Canvas* canvas) {
if (type_ == ui::PADDED_SEPARATOR)
paint_rect.Inset(
gfx::Insets::TLBR(0, menu_config.padded_separator_left_margin, 0, 0));
+ BRAVE_MENU_SEPARATOR_ON_PAINT
else if (menu_config.use_outer_border)
paint_rect.Inset(gfx::Insets::VH(0, 1));