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

Omnibox changes (location bar height, inkdrop color, icon changes) (uplift to 1.62.x) #21761

Merged
merged 4 commits into from
Jan 29, 2024
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
5 changes: 3 additions & 2 deletions browser/ui/brave_layout_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ absl::optional<int> GetBraveLayoutConstant(LayoutConstant constant) {
return 24;
}
case LOCATION_BAR_HEIGHT:
return touch ? 36 : 34;
// Consider adjust below element padding also when this height is changed.
return 32;
case LOCATION_BAR_ELEMENT_PADDING:
return 4;
return 2;
default:
break;
}
Expand Down
6 changes: 6 additions & 0 deletions browser/ui/color/brave_color_mixer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ void AddChromeLightThemeColorMixer(ui::ColorProvider* provider,
ui::kColorFocusableBorderFocused};
mixer[kColorTabFocusRingActive] = {ui::kColorFocusableBorderFocused};
mixer[kColorTabFocusRingInactive] = {ui::kColorFocusableBorderFocused};

// Upstream uses tab's background color as omnibox chip background color.
// In our light mode, there is no difference between location bar's bg
// color and tab's bg color. So, it looks like chip's bg color is transparent.
// Use frame color as chip background to have different bg color.
mixer[kColorOmniboxChipBackground] = {kLightFrame};
}

void AddChromeDarkThemeColorMixer(ui::ColorProvider* provider,
Expand Down
15 changes: 7 additions & 8 deletions browser/ui/views/brave_actions/brave_actions_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
#include "ui/views/layout/box_layout.h"
#include "ui/views/view.h"

namespace {

constexpr gfx::Size kToolbarActionSize(34, 30);

} // namespace

BraveActionsContainer::BraveActionsContainer(Browser* browser, Profile* profile)
: browser_(browser) {}

Expand Down Expand Up @@ -84,14 +78,14 @@ void BraveActionsContainer::AddActionViewForShields() {
AddChildViewAt(std::make_unique<BraveShieldsActionView>(
*browser_->profile(), *browser_->tab_strip_model()),
1);
shields_action_btn_->SetPreferredSize(kToolbarActionSize);
shields_action_btn_->SetPreferredSize(GetActionSize());
shields_action_btn_->Init();
}

void BraveActionsContainer::AddActionViewForRewards() {
auto button = std::make_unique<BraveRewardsActionView>(browser_);
rewards_action_btn_ = AddChildViewAt(std::move(button), 2);
rewards_action_btn_->SetPreferredSize(kToolbarActionSize);
rewards_action_btn_->SetPreferredSize(GetActionSize());
rewards_action_btn_->SetVisible(ShouldShowBraveRewardsAction());
rewards_action_btn_->Update();
}
Expand Down Expand Up @@ -125,6 +119,11 @@ void BraveActionsContainer::UpdateVisibility() {
SetVisible(!should_hide_ && can_show);
}

gfx::Size BraveActionsContainer::GetActionSize() const {
return {34, GetLayoutConstant(LOCATION_BAR_HEIGHT) -
2 * GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING)};
}

void BraveActionsContainer::SetShouldHide(bool should_hide) {
should_hide_ = should_hide;
Update();
Expand Down
1 change: 1 addition & 0 deletions browser/ui/views/brave_actions/brave_actions_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class BraveActionsContainer : public views::View {
void AddActionViewForShields();

void UpdateVisibility();
gfx::Size GetActionSize() const;

// Brave Rewards preferences change observers callback.
void OnBraveRewardsPreferencesChanged();
Expand Down
4 changes: 2 additions & 2 deletions browser/ui/views/brave_actions/brave_rewards_action_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class ButtonHighlightPathGenerator : public views::HighlightPathGenerator {
auto* layout_provider = ChromeLayoutProvider::Get();
DCHECK(layout_provider);

int radius = layout_provider->GetCornerRadiusMetric(
views::Emphasis::kMaximum, rect.size());
int radius = layout_provider->GetCornerRadiusMetric(views::Emphasis::kHigh,
rect.size());

SkPath path;
path.addRoundRect(gfx::RectToSkRect(rect), radius, radius);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ SkPath BraveShieldsActionView::GetHighlightPath() const {
gfx::Rect rect(GetPreferredSize());
rect.Inset(highlight_insets);
const int radii = ChromeLayoutProvider::Get()->GetCornerRadiusMetric(
views::Emphasis::kMaximum, rect.size());
views::Emphasis::kHigh, rect.size());
SkPath path;
path.addRoundRect(gfx::RectToSkRect(rect), radii, radii);
return path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"

// |icon_left| - Padding between left border of location bar and first
// decoration. Use fixed 4px always.
// decoration. Use element padding.
// |text_left| - Padding between omnibox view and last leading decoration.
// If last decoration has label, it has sufficient padding inside.
// If custom padding is provided(text_left is not null), respect
// it. Otherwise, set our design value - 5px.
#define BRAVE_LAYOUT_LEADING_DECORATIONS \
icon_left = 4; \
icon_left = GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING); \
if (text_left == 0 && !location_icon_view_->ShouldShowLabel()) { \
text_left = 5; \
}
Expand Down
2 changes: 1 addition & 1 deletion vector_icons/leo_overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"//chrome/app/vector_icons/zoom_plus.icon": "leo_search_zoom_in",
"//components/omnibox/browser/vector_icons/bookmark.icon": "leo_browser_bookmark_normal",
"//components/omnibox/browser/vector_icons/find_in_page.icon": "leo_window_search",
"//components/omnibox/browser/vector_icons/http.icon": "leo_warning_circle_filled",
"//components/omnibox/browser/vector_icons/http.icon": "leo_info_filled",
"//components/omnibox/browser/vector_icons/install_desktop.icon": "leo_pwa_install",
"//components/omnibox/browser/vector_icons/share_mac.icon": "leo_share_macos",
"//components/omnibox/browser/vector_icons/share_win.icon": "leo_share_windows",
Expand Down
Loading