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

update brave-ui for tip site banner image fix #2566

Merged
merged 2 commits into from
Jul 1, 2019
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
8 changes: 6 additions & 2 deletions browser/brave_rewards/tip_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "brave/browser/brave_rewards/tip_dialog.h"

#include <algorithm>
#include <memory>
#include <string>
#include <utility>
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down