Skip to content

Commit e07badc

Browse files
committed
Make all four corners of the tip panel rounded
1 parent 9caca49 commit e07badc

File tree

2 files changed

+10
-38
lines changed

2 files changed

+10
-38
lines changed

browser/ui/views/brave_rewards/tip_panel_bubble_host.cc

+9-37
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,10 @@ namespace brave_rewards {
2424

2525
namespace {
2626

27-
// The tip dialog is anchored to the center of the location bar, and must be
28-
// drawn with rounded bottom borders. We implement these customizations by
29-
// subclassing `WebUIBubbleDialogView`. This implementation is then used by
30-
// `TipPanelBubbleManager` when creating the dialog view.
31-
class TipPanelDialogView : public WebUIBubbleDialogView {
32-
public:
33-
TipPanelDialogView(views::View* anchor_view,
34-
BubbleContentsWrapper* contents_wrapper,
35-
const absl::optional<gfx::Rect>& anchor_rect)
36-
: WebUIBubbleDialogView(anchor_view, contents_wrapper, anchor_rect) {
37-
SetArrow(views::BubbleBorder::TOP_CENTER);
38-
SetPaintClientToLayer(true);
39-
set_use_round_corners(true);
40-
set_corner_radius(16);
41-
}
42-
43-
// views::Widget:
44-
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView(
45-
views::Widget* widget) override {
46-
auto frame = WebUIBubbleDialogView::CreateNonClientFrameView(widget);
47-
auto* bubble_frame = static_cast<views::BubbleFrameView*>(frame.get());
48-
auto* bubble_border = bubble_frame->bubble_border();
49-
DCHECK(bubble_border);
50-
bubble_border->SetRoundedCorners(0, 0, 16, 16);
51-
return frame;
52-
}
53-
54-
// views::View:
55-
void AddedToWidget() override {
56-
WebUIBubbleDialogView::AddedToWidget();
57-
web_view()->holder()->SetCornerRadii(gfx::RoundedCornersF(0, 0, 16, 16));
58-
}
59-
};
60-
61-
// In order to use `TipPanelDialogView` as the dialog view implementation, we
62-
// must override the `CreateWebUIBubbleDialog` of `WebUIBubbleManager`.
27+
// In order to customize the borders and alignment of the bubble panel, we must
28+
// override the `CreateWebUIBubbleDialog` of `WebUIBubbleManager`. Note that
29+
// originally only the bottom borders were rounded but at the time that resulted
30+
// in inconsistent cross-platform rendering.
6331
class TipPanelBubbleManager : public WebUIBubbleManager {
6432
public:
6533
TipPanelBubbleManager(views::View* anchor_view, Profile* profile)
@@ -82,8 +50,12 @@ class TipPanelBubbleManager : public WebUIBubbleManager {
8250
set_cached_contents_wrapper(std::move(contents_wrapper));
8351
cached_contents_wrapper()->ReloadWebContents();
8452

85-
auto bubble_view = std::make_unique<TipPanelDialogView>(
53+
auto bubble_view = std::make_unique<WebUIBubbleDialogView>(
8654
anchor_view_, cached_contents_wrapper(), anchor);
55+
bubble_view->SetArrow(views::BubbleBorder::TOP_CENTER);
56+
bubble_view->SetPaintClientToLayer(true);
57+
bubble_view->set_use_round_corners(true);
58+
bubble_view->set_corner_radius(16);
8759

8860
auto weak_ptr = bubble_view->GetWeakPtr();
8961
views::BubbleDialogDelegateView::CreateBubble(std::move(bubble_view));

components/resources/rewards_strings.grdp

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@
628628
Share your support
629629
</message>
630630
<message name="IDS_REWARDS_TIP_SHARE_TEXT" desc="">
631-
I just contributed <ph name="AMOUNT">$1</ph> using the Brave Browser! See how you can support your favorite creators and sites too: https://brave.com/rewards
631+
I just contributed <ph name="AMOUNT">$1</ph> BAT using the Brave Browser! See how you can support your favorite creators and sites too: https://brave.com/rewards
632632
</message>
633633
<message name="IDS_REWARDS_TIP_UNEXPECTED_ERROR_TITLE" desc="">
634634
An unexpected error has occurred

0 commit comments

Comments
 (0)