diff --git a/browser/brave_rewards/tip_dialog.cc b/browser/brave_rewards/tip_dialog.cc index 82d31db0670d..42e38b0a35c1 100644 --- a/browser/brave_rewards/tip_dialog.cc +++ b/browser/brave_rewards/tip_dialog.cc @@ -5,6 +5,7 @@ #include "brave/browser/brave_rewards/tip_dialog.h" +#include #include #include #include @@ -33,6 +34,8 @@ namespace { constexpr int kDialogMargin = 25; constexpr int kDialogMinHeight = 400; constexpr int kDialogMaxHeight = 700; +// max width = 1920 - margin +constexpr int kDialogMaxWidth = 1895; // A ui::WebDialogDelegate that specifies the tip dialog appearance. class TipDialogDelegate : public ui::WebDialogDelegate { @@ -107,7 +110,8 @@ void TipDialogDelegate::GetDialogSize(gfx::Size* size) const { // initial size in between min and max const int max_height = kDialogMinHeight + (kDialogMaxHeight - kDialogMinHeight); - size->SetSize(target_size.width() - kDialogMargin, max_height); + int width = std::min(target_size.width() - kDialogMargin, kDialogMaxWidth); + size->SetSize(width, max_height); } std::string TipDialogDelegate::GetDialogArgs() const { @@ -138,7 +142,7 @@ void OpenTipDialog(WebContents* initiator, content::WebContents* outermost_web_contents = guest_view::GuestViewBase::GetTopLevelWebContents(initiator); gfx::Size host_size = outermost_web_contents->GetContainerBounds().size(); - const int width = host_size.width() - kDialogMargin; + int width = std::min(host_size.width() - kDialogMargin, kDialogMaxWidth); gfx::Size min_size(width, kDialogMinHeight); gfx::Size max_size(width, kDialogMaxHeight); // TODO(petemill): adjust min and max when host size changes (e.g. window diff --git a/package-lock.json b/package-lock.json index 6771b6284c4c..55259f76e03f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1597,8 +1597,8 @@ } }, "brave-ui": { - "version": "github:brave/brave-ui#1fd91faa8f6676c156039c813e2168578d1261ca", - "from": "github:brave/brave-ui#1fd91faa8f6676c156039c813e2168578d1261ca", + "version": "github:brave/brave-ui#0220a24a82b5e63a9d5733d25f982c7dc5f66a45", + "from": "github:brave/brave-ui#0220a24a82b5e63a9d5733d25f982c7dc5f66a45", "dev": true, "requires": { "@ctrl/tinycolor": "^2.2.1", diff --git a/package.json b/package.json index df1a5fb34503..ffc89acddc2e 100644 --- a/package.json +++ b/package.json @@ -277,7 +277,7 @@ "@types/react-redux": "6.0.4", "@types/redux-logger": "^3.0.7", "awesome-typescript-loader": "^5.2.1", - "brave-ui": "github:brave/brave-ui#1fd91faa8f6676c156039c813e2168578d1261ca", + "brave-ui": "github:brave/brave-ui#0220a24a82b5e63a9d5733d25f982c7dc5f66a45", "css-loader": "^2.1.1", "csstype": "^2.5.5", "deep-freeze-node": "^1.1.3",