Skip to content

Commit 9d3018a

Browse files
authored
Merge pull request #626 from brave/ui/extension-popup-brave-radius
Remove border radius from brave extension popup windows
2 parents 6024245 + fa108b8 commit 9d3018a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
2+
index 4ee33a9f9b77b55f1d5848d06c25dd2ae6e31c2e..343f00bbb94c7e53ee08a9d9e55718f8476b7484 100644
3+
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
4+
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
5+
@@ -4,6 +4,7 @@
6+
7+
#include "chrome/browser/ui/views/extensions/extension_popup.h"
8+
9+
+#include "brave/common/extensions/extension_constants.h"
10+
#include "chrome/browser/chrome_notification_types.h"
11+
#include "chrome/browser/devtools/devtools_window.h"
12+
#include "chrome/browser/extensions/extension_view_host.h"
13+
@@ -142,8 +143,23 @@ gfx::Size ExtensionPopup::CalculatePreferredSize() const {
14+
}
15+
16+
void ExtensionPopup::AddedToWidget() {
17+
- const int radius =
18+
- GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius();
19+
+
20+
+ // HACK: removes border radius for brave extensions
21+
+ // as webview does not support radius clipping which results
22+
+ // in white strips at top and bottom of popup.
23+
+ // TODO: add brave extension radius back in when macOS and Windows
24+
+ // popups support web dialog window radius clipping.
25+
+
26+
+ bool shouldDisableRadiusForPopup = false;
27+
+ // Clipping issue is not present on linux
28+
+#if defined(OS_MACOSX) || defined(OS_WIN)
29+
+ const auto extensionId = host_->extension()->id();
30+
+ const bool isBraveExtension = (extensionId == brave_extension_id ||
31+
+ extensionId == brave_rewards_extension_id);
32+
+ shouldDisableRadiusForPopup = isBraveExtension;
33+
+#endif
34+
+ const int radius = shouldDisableRadiusForPopup ? 0
35+
+ : GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius();
36+
const bool contents_has_rounded_corners =
37+
GetExtensionView()->holder()->SetCornerRadius(radius);
38+
SetBorder(views::CreateEmptyBorder(

0 commit comments

Comments
 (0)