Compare commits

...

9 Commits

Author SHA1 Message Date
wukko c0b9568b65 revision: bump to 2 (#919) 2026-02-16 21:21:37 +00:00
wukko 941352d902 helium/ui/vertical: tab indicator reposition & minor fixes (#918) 2026-02-17 03:11:50 +06:00
wukko 4cf9165668 helium/ui/vertical: fix top & bottom gaps
fixes perceived bottom margin to new tab button & between top actions in collapsed state. now tabs, buttons, and new tab button have visually the same margin.
2026-02-17 03:07:53 +06:00
wukko 4963889d71 helium/ui/vertical/bottom: fix disabled state text color
previously the text color would change on window unfocus
2026-02-17 03:05:41 +06:00
wukko 01a6615e60 helium/ui/vertical/tab: show indicator before title
fixes jiggle on hover
2026-02-17 03:04:55 +06:00
wukko a6994c688e helium/ui/vertical: draw a rounded corner on top of contents (#912)
instead of rounding the contents which causes a hole on linux & windows
2026-02-16 23:36:28 +06:00
wukko 23908b348c helium/ui: remove all layout separators, not just the top one (#908) 2026-02-16 14:30:03 +00:00
jj 1a3f947eb8 utils/name-substitution: replace fake async with process pool (#909)
before: real 0m46.312s
after: real 0m14.080s
2026-02-16 13:02:46 +01:00
wukko 9aed4b3a85 helium/ui: disable ink ripple effect on all platforms & webui (#907) 2026-02-16 17:59:40 +06:00
9 changed files with 457 additions and 135 deletions
@@ -0,0 +1,44 @@
--- a/ui/views/style/platform_style.h
+++ b/ui/views/style/platform_style.h
@@ -70,7 +70,7 @@ class VIEWS_EXPORT PlatformStyle {
static constexpr bool kTreeViewSelectionPaintsEntireRow = BUILDFLAG(IS_MAC);
// Whether ripples should be used for visual feedback on control activation.
- static constexpr bool kUseRipples = !BUILDFLAG(IS_MAC);
+ static constexpr bool kUseRipples = false;
// Whether text fields should use a "drag" cursor when not actually
// dragging but available to do so.
--- a/ui/webui/resources/cr_elements/cr_ripple/cr_ripple_mixin.ts
+++ b/ui/webui/resources/cr_elements/cr_ripple/cr_ripple_mixin.ts
@@ -31,7 +31,7 @@ export const CrRippleMixin =
};
}
- accessor noink: boolean = false;
+ accessor noink: boolean = true;
rippleContainer: HTMLElement|null = null;
private ripple_: CrRippleElement|null = null;
--- a/ui/webui/resources/cr_elements/cr_ripple/cr_ripple_mixin_polymer.ts
+++ b/ui/webui/resources/cr_elements/cr_ripple/cr_ripple_mixin_polymer.ts
@@ -31,7 +31,7 @@ export const CrRippleMixinPolymer =
noink: {
type: Boolean,
observer: 'onNoinkChanged_',
- value: false,
+ value: true,
},
};
}
--- a/ui/webui/resources/cr_elements/cr_ripple/cr_ripple.ts
+++ b/ui/webui/resources/cr_elements/cr_ripple/cr_ripple.ts
@@ -38,7 +38,7 @@ export class CrRippleElement extends CrL
accessor holdDown: boolean = false;
accessor recenters: boolean = false;
- accessor noink: boolean = false;
+ accessor noink: boolean = true;
private ripples_: Element[] = [];
private eventTracker_: EventTracker = new EventTracker();
+3 -3
View File
@@ -488,7 +488,7 @@
// Returns whether the shadow overlay (with its attendant margin) around the
--- a/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
@@ -105,6 +105,9 @@ BrowserViewTabbedLayoutImpl::GetMinimumT
@@ -103,6 +103,9 @@ BrowserViewTabbedLayoutImpl::GetMinimumT
views().vertical_tab_strip_region_view->GetMinimumSize();
return std::make_pair(result, gfx::Size());
}
@@ -498,7 +498,7 @@
case TabStripType::kWebUi:
// WebUI tabstrip is lazily-created.
return std::make_pair(gfx::Size(),
@@ -150,6 +153,9 @@ BrowserViewTabbedLayoutImpl::GetTabStrip
@@ -148,6 +151,9 @@ BrowserViewTabbedLayoutImpl::GetTabStrip
if (delegate().ShouldDrawVerticalTabStrip()) {
return TabStripType::kVertical;
}
@@ -508,7 +508,7 @@
return delegate().ShouldDrawTabStrip() ? TabStripType::kHorizontal
: TabStripType::kNone;
}
@@ -707,9 +713,11 @@ gfx::Rect BrowserViewTabbedLayoutImpl::C
@@ -705,9 +711,11 @@ gfx::Rect BrowserViewTabbedLayoutImpl::C
if (IsParentedTo(views().toolbar, views().top_container)) {
gfx::Rect toolbar_bounds;
if (toolbar_visible) {
+285 -74
View File
@@ -29,7 +29,7 @@
}
--- a/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
@@ -654,10 +654,12 @@ BrowserViewTabbedLayoutImpl::CalculatePr
@@ -652,10 +652,12 @@ BrowserViewTabbedLayoutImpl::CalculatePr
? std::max(0, base::ClampCeil(browser_params.leading_exclusion
.ContentWithPadding()
.width()) -
@@ -43,7 +43,7 @@
}
return layout;
@@ -714,7 +716,8 @@ gfx::Rect BrowserViewTabbedLayoutImpl::C
@@ -712,7 +714,8 @@ gfx::Rect BrowserViewTabbedLayoutImpl::C
gfx::Rect toolbar_bounds;
if (toolbar_visible) {
// Visually clamp two conflicting margins: window controls & toolbar
@@ -98,16 +98,17 @@
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_VERTICAL_TAB_STRIP_REGION_VIEW_H_
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -51,7 +51,7 @@
@@ -51,7 +51,8 @@
#include "ui/views/view_utils.h"
namespace {
-constexpr int kRegionVerticalPadding = 5;
+constexpr int kRegionVerticalPadding = 3;
+constexpr int kBottomContainerGap = 2;
} // namespace
VerticalTabStripRegionView::VerticalTabStripRegionView(
@@ -85,15 +85,13 @@ VerticalTabStripRegionView::VerticalTabS
@@ -85,15 +86,13 @@ VerticalTabStripRegionView::VerticalTabS
views::FlexSpecification(views::MinimumFlexSizeRule::kPreferred,
views::MaximumFlexSizeRule::kUnbounded));
@@ -124,7 +125,7 @@
resize_animation_.SetTweenType(gfx::Tween::Type::EASE_IN_OUT_EMPHASIZED);
resize_animation_.Reset(!state_controller_->IsCollapsed());
@@ -404,6 +402,15 @@ void VerticalTabStripRegionView::SetExcl
@@ -404,6 +403,15 @@ void VerticalTabStripRegionView::SetExcl
top_button_container_->SetExclusionWidthForLayout(exclusion_width);
}
@@ -140,20 +141,23 @@
VerticalPinnedTabContainerView*
VerticalTabStripRegionView::GetPinnedTabsContainer() {
return tab_strip_view_->GetPinnedTabsContainer();
@@ -426,9 +433,9 @@ views::View* VerticalTabStripRegionView:
@@ -425,10 +433,11 @@ views::View* VerticalTabStripRegionView:
views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToZero,
views::MaximumFlexSizeRule::kPreferred));
tab_strip_view_->SetProperty(views::kMarginsKey,
gfx::Insets::VH(kRegionVerticalPadding, 0));
- gfx::Insets::VH(kRegionVerticalPadding, 0));
- std::optional<size_t> separator_index = GetIndexOf(top_button_separator_);
- CHECK(separator_index.has_value());
- ReorderChildView(tab_strip_view_, separator_index.value() + 1);
+ gfx::Insets::TLBR(kRegionVerticalPadding, 0,
+ kBottomContainerGap, 0));
+ std::optional<size_t> top_container_index = GetIndexOf(top_button_container_);
+ CHECK(top_container_index.has_value());
+ ReorderChildView(tab_strip_view_, top_container_index.value() + 1);
return tab_strip_view_;
}
@@ -438,6 +445,23 @@ void VerticalTabStripRegionView::ClearTa
@@ -438,6 +447,23 @@ void VerticalTabStripRegionView::ClearTa
RemoveChildViewT(std::exchange(tab_strip_view_, nullptr));
}
@@ -177,7 +181,7 @@
void VerticalTabStripRegionView::OnCollapsedStateChanged(
tabs::VerticalTabStripStateController* state_controller) {
if (target_collapse_state_.collapsed != state_controller->IsCollapsed()) {
@@ -453,8 +477,7 @@ void VerticalTabStripRegionView::OnColla
@@ -453,16 +479,15 @@ void VerticalTabStripRegionView::OnColla
state_controller_->IsCollapsed()
? LayoutConstant::kVerticalTabStripCollapsedPadding
: LayoutConstant::kVerticalTabStripUncollapsedPadding);
@@ -187,16 +191,17 @@
top_button_container_->SetProperty(
views::kMarginsKey,
gfx::Insets::TLBR(0, padding, kRegionVerticalPadding, padding));
@@ -462,7 +485,7 @@ void VerticalTabStripRegionView::OnColla
bottom_button_container_->SetProperty(
views::kMarginsKey,
gfx::Insets::TLBR(kRegionVerticalPadding, padding, 0, padding));
- gfx::Insets::TLBR(kRegionVerticalPadding, padding, 0, padding));
+ gfx::Insets::TLBR(kBottomContainerGap, padding, 0, padding));
- flex_layout_->SetInteriorMargin(gfx::Insets::VH(padding, 0));
+ UpdateInteriorMargin();
if (tab_strip_view_) {
tab_strip_view_->SetCollapsedState(state_controller->IsCollapsed());
@@ -503,9 +526,6 @@ void VerticalTabStripRegionView::ResizeT
@@ -503,9 +528,6 @@ void VerticalTabStripRegionView::ResizeT
}
void VerticalTabStripRegionView::UpdateBackgroundColors() {
@@ -208,16 +213,17 @@
bool VerticalTabStripRegionView::IsFrameActive() const {
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_top_container.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_top_container.cc
@@ -18,7 +18,7 @@
@@ -18,7 +18,8 @@
#include "ui/views/view_class_properties.h"
namespace {
-constexpr int kTopButtonPadding = 4;
+constexpr int kTopButtonPadding = 3;
+constexpr int kCollapsedTopButtonPadding = 2;
} // namespace
VerticalTabStripTopContainer::VerticalTabStripTopContainer(
@@ -38,12 +38,6 @@ VerticalTabStripTopContainer::VerticalTa
@@ -38,12 +39,6 @@ VerticalTabStripTopContainer::VerticalTa
collapse_button_ = AddChildButtonFor(kActionToggleCollapseVertical);
collapse_button_->SetProperty(views::kElementIdentifierKey,
kVerticalTabStripCollapseButtonElementId);
@@ -230,7 +236,7 @@
}
VerticalTabStripTopContainer::~VerticalTabStripTopContainer() = default;
@@ -64,11 +58,6 @@ views::ProposedLayout VerticalTabStripTo
@@ -64,11 +59,6 @@ views::ProposedLayout VerticalTabStripTo
CHECK(collapse_button_);
container_buttons.push_back(collapse_button_);
@@ -242,7 +248,16 @@
if (state_controller_->IsCollapsed()) {
// If the vertical tab strip is collapsed, then lay out the buttons
// vertically in reverse order from top-to-bottom.
@@ -88,52 +77,40 @@ views::ProposedLayout VerticalTabStripTo
@@ -77,7 +67,7 @@ views::ProposedLayout VerticalTabStripTo
total_height += container_button->GetPreferredSize().height();
}
- total_height += (container_buttons.size() - 1) * kTopButtonPadding;
+ total_height += (container_buttons.size() - 1) * kCollapsedTopButtonPadding;
if (total_height > host_size.height()) {
host_size.set_height(total_height);
@@ -88,52 +78,40 @@ views::ProposedLayout VerticalTabStripTo
for (views::LabelButton* container_button :
base::Reversed(container_buttons)) {
const gfx::Size pref_size = container_button->GetPreferredSize();
@@ -258,7 +273,7 @@
views::SizeBounds(pref_size));
- current_y += pref_size.height() + kTopButtonPadding;
+ current_y += button_size + kTopButtonPadding;
+ current_y += button_size + kCollapsedTopButtonPadding;
}
} else {
- // If the vertical tab strip is uncollapsed, then lay out the buttons
@@ -308,7 +323,7 @@
}
}
@@ -171,10 +148,6 @@ bool VerticalTabStripTopContainer::IsPos
@@ -171,10 +149,6 @@ bool VerticalTabStripTopContainer::IsPos
return false;
}
@@ -319,7 +334,7 @@
return true;
}
@@ -185,7 +158,11 @@ void VerticalTabStripTopContainer::SetTo
@@ -185,7 +159,11 @@ void VerticalTabStripTopContainer::SetTo
void VerticalTabStripTopContainer::SetExclusionWidthForLayout(
const int exclusion_width) {
@@ -333,6 +348,22 @@
BEGIN_METADATA(VerticalTabStripTopContainer)
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_view.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_view.cc
@@ -144,12 +144,12 @@ VerticalTabView::VerticalTabView(TabColl
TabChildConfig(close_button_, kIconDesignWidth, kDefaultPadding,
/*align_leading=*/false,
/*expand=*/false),
- TabChildConfig(alert_indicator_, kIconDesignWidth, kDefaultPadding,
- /*align_leading=*/false,
- /*expand=*/false),
TabChildConfig(icon_, kIconDesignWidth, kHorizontalInset,
/*align_leading=*/true,
/*expand=*/false),
+ TabChildConfig(alert_indicator_, kIconDesignWidth, kDefaultPadding,
+ /*align_leading=*/true,
+ /*expand=*/false),
TabChildConfig(title_, kTitleMinWidth, kDefaultPadding,
/*align_leading=*/true,
/*expand=*/true)};
@@ -343,6 +343,7 @@ void VerticalTabView::RemovedFromWidget(
void VerticalTabView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
@@ -341,7 +372,23 @@
}
void VerticalTabView::OnThemeChanged() {
@@ -542,7 +543,15 @@ void VerticalTabView::UpdateAlertIndicat
@@ -528,6 +529,9 @@ void VerticalTabView::UpdateAlertIndicat
alert_indicator_->UpdateAlertIndicatorAnimation();
bool alert_indicator_visible =
alert_indicator_->showing_alert_state().has_value();
+ const auto* controller = collection_node_ ? collection_node_->GetController()
+ : nullptr;
+ const bool is_collapsed = controller && controller->IsCollapsed();
#if BUILDFLAG(ENABLE_GLIC)
if (glic_tab_underline_view_ && (alert_indicator_->showing_alert_state() ==
@@ -538,11 +542,20 @@ void VerticalTabView::UpdateAlertIndicat
}
#endif
alert_indicator_->SetVisible(alert_indicator_visible);
- icon_->SetVisible(!pinned_ || !alert_indicator_visible);
+ const bool should_hide_icon_for_alert = pinned_ || is_collapsed;
+ icon_->SetVisible(!alert_indicator_visible || !should_hide_icon_for_alert);
}
void VerticalTabView::UpdateCloseButtonVisibility() {
@@ -500,13 +547,15 @@
std::unique_ptr<BottomContainerButton> container_button =
std::make_unique<BottomContainerButton>();
actions::ActionItem* action_item =
@@ -81,28 +60,23 @@ BottomContainerButton* VerticalTabStripB
@@ -81,28 +60,25 @@ BottomContainerButton* VerticalTabStripB
action_view_controller_->CreateActionViewRelationship(
container_button.get(), action_item->GetAsWeakPtr());
+ container_button->SetText(l10n_util::GetStringUTF16(string_id));
+ container_button->SetEnabledTextColors(
+ kColorToolbarButtonIconDisabled);
+ container_button->SetTextColor(views::Button::STATE_DISABLED,
+ kColorToolbarButtonIconDisabled);
+
+ container_button->SetBorder(views::CreateEmptyBorder(
+ gfx::Insets::VH(kBasePadding, kBasePadding * 2)));
@@ -538,7 +587,7 @@
bool VerticalTabStripBottomContainer::IsPositionInWindowCaption(
const gfx::Point& point) {
for (views::View* child : children()) {
@@ -133,42 +107,16 @@ void VerticalTabStripBottomContainer::Up
@@ -133,42 +109,16 @@ void VerticalTabStripBottomContainer::Up
? views::LayoutAlignment::kStretch
: views::LayoutAlignment::kStart);
@@ -647,15 +696,7 @@
std::vector<ContentsContainerView*> contents_container_views() const {
--- a/chrome/browser/ui/views/frame/multi_contents_view.cc
+++ b/chrome/browser/ui/views/frame/multi_contents_view.cc
@@ -48,6 +48,7 @@
namespace {
constexpr int kSnapDistance = 15;
+constexpr float kContentCornerRadius = 8.0f;
}
void MultiContentsView::ContentsSeparators::Reset() {
@@ -337,6 +338,11 @@ void MultiContentsView::OnResize(int res
@@ -337,6 +337,11 @@ void MultiContentsView::OnResize(int res
}
}
@@ -667,49 +708,31 @@
double MultiContentsView::CalculateRatioWithSnapPoints(
double end_width,
double total_width) const {
@@ -616,12 +622,29 @@ int MultiContentsView::GetMinViewWidth(g
}
@@ -617,11 +622,10 @@ int MultiContentsView::GetMinViewWidth(g
void MultiContentsView::UpdateContentsBorderAndOverlay() {
+ const bool is_vertical_tabs = browser_view_->ShouldDrawVerticalTabStrip();
+ const bool is_in_split = IsInSplitView();
+
+ const gfx::RoundedCornersF no_radii;
+ const gfx::RoundedCornersF leading_corner_radii =
+ gfx::RoundedCornersF{kContentCornerRadius, 0, 0, 0};
+
+ const gfx::RoundedCornersF& bg_radii =
+ (is_vertical_tabs && is_in_split) ? leading_corner_radii : no_radii;
+
+ SetBackgroundRadii(bg_radii);
+
for (auto* contents_container_view : contents_container_views_) {
const bool is_active =
contents_container_view->contents_view() == GetActiveContentsView();
- contents_container_view->UpdateBorderAndOverlay(
- IsInSplitView(), is_active,
- is_active && active_contents_view_highlighted_);
- const bool is_active =
- contents_container_view->contents_view() == GetActiveContentsView();
+ const bool is_first_view =
+ contents_container_view == contents_container_views_.front();
+ const bool round_leading_corner =
+ is_vertical_tabs && (!is_in_split || is_first_view);
+ const gfx::RoundedCornersF& contents_radii =
+ round_leading_corner ? leading_corner_radii : no_radii;
+
+ contents_container_view->UpdateBorderAndOverlay(contents_radii);
contents_container_view->UpdateBorderAndOverlay(
- IsInSplitView(), is_active,
- is_active && active_contents_view_highlighted_);
+ IsInSplitView(), is_first_view);
}
}
--- a/chrome/browser/ui/views/frame/contents_container_view.h
+++ b/chrome/browser/ui/views/frame/contents_container_view.h
@@ -25,6 +25,7 @@ class ActorOverlayWebView;
namespace gfx {
class Rect;
+class RoundedCornersF;
} // namespace gfx
namespace glic {
@@ -19,6 +19,7 @@
class BrowserView;
class ContentsContainerOutline;
class ContentsWebView;
+class LeadingCornerFillView;
class MultiContentsViewMiniToolbar;
class ScrimView;
class ActorOverlayWebView;
@@ -109,9 +110,7 @@ class ContentsContainerView : public vie
SkColor outline_color,
int font_size);
@@ -717,27 +740,215 @@
- void UpdateBorderAndOverlay(bool is_in_split,
- bool is_active,
- bool is_highlighted);
+ void UpdateBorderAndOverlay(const gfx::RoundedCornersF& contents_radii);
+ void UpdateBorderAndOverlay(bool is_in_split, bool is_first_view);
void ShowCaptureContentsBorder();
void HideCaptureContentsBorder();
@@ -131,7 +130,6 @@ class ContentsContainerView : public vie
void UpdateDevToolsDockedPlacement();
// views::View:
- void ChildVisibilityChanged(View* child) override;
void Layout(PassKey) override;
// views::ViewObserver:
@@ -173,6 +171,9 @@ class ContentsContainerView : public vie
// open.
raw_ptr<ScrimView> contents_scrim_view_ = nullptr;
+ // Overlay rounded corner used in vertical layout.
+ raw_ptr<LeadingCornerFillView> leading_corner_fill_view_ = nullptr;
+
// The view that contains the Glic Actor Overlay. The Actor Overlay is a UI
// overlay that is shown on top of the web contents.
raw_ptr<ActorOverlayWebView> actor_overlay_web_view_ = nullptr;
--- a/chrome/browser/ui/views/frame/contents_container_view.cc
+++ b/chrome/browser/ui/views/frame/contents_container_view.cc
@@ -148,10 +148,11 @@ std::vector<views::View*> ContentsContai
return accessible_panes;
@@ -7,12 +7,15 @@
#include <memory>
#include <optional>
+#include "base/i18n/rtl.h"
+#include "base/scoped_observation.h"
#include "chrome/browser/actor/ui/actor_overlay_web_view.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "chrome/browser/enterprise/watermark/watermark_view.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
+#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/read_anything/read_anything_immersive_overlay_view.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/view_ids.h"
@@ -28,13 +31,17 @@
#include "chrome/common/chrome_features.h"
#include "components/search/ntp_features.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/skia/include/core/SkPathBuilder.h"
+#include "third_party/skia/include/core/SkRRect.h"
#include "ui/accessibility/accessibility_features.h"
+#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
-#include "ui/views/border.h"
+#include "ui/gfx/geometry/skia_conversions.h"
+#include "ui/gfx/scoped_canvas.h"
#include "ui/views/layout/delegating_layout_manager.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/proposed_layout.h"
@@ -42,6 +49,7 @@
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
+#include "ui/views/widget/widget_observer.h"
#if BUILDFLAG(ENABLE_GLIC)
#include "chrome/browser/glic/browser_ui/context_sharing_border_view.h"
@@ -58,6 +66,94 @@ constexpr int kNewTabFooterSeparatorHeig
constexpr int kNewTabFooterHeight = 56;
} // namespace
+class LeadingCornerFillView final : public views::View,
+ public views::WidgetObserver {
+ METADATA_HEADER(LeadingCornerFillView, views::View)
+
+ public:
+ LeadingCornerFillView() {
+ SetPaintToLayer();
+ layer()->SetFillsBoundsOpaquely(false);
+ SetCanProcessEventsWithinSubtree(false);
+ SetVisible(false);
+ }
+
+ gfx::Size CalculatePreferredSize(const views::SizeBounds&) const override {
+ return gfx::Size(corner_radius_, corner_radius_);
+ }
+
+ void SetCornerRadius(int corner_radius) {
+ if (corner_radius_ == corner_radius) {
+ return;
+ }
+ corner_radius_ = corner_radius;
+ SetVisible(corner_radius_ > 0);
+ PreferredSizeChanged();
+ SchedulePaint();
+ }
+
+ void OnThemeChanged() override {
+ View::OnThemeChanged();
+ SchedulePaint();
+ }
+
+ void AddedToWidget() override {
+ View::AddedToWidget();
+ if (auto* widget = GetWidget()) {
+ widget_observation_.Observe(widget);
+ }
+ }
+
+ void RemovedFromWidget() override {
+ widget_observation_.Reset();
+ View::RemovedFromWidget();
+ }
+
+ void OnPaint(gfx::Canvas* canvas) override {
+ if (corner_radius_ <= 0) {
+ return;
+ }
+
+ const float corner_radius = static_cast<float>(corner_radius_);
+ const bool is_rtl = base::i18n::IsRTL();
+ const SkVector rounded_vector = {corner_radius, corner_radius};
+ const SkVector radii[4] = {
+ is_rtl ? SkVector{0, 0} : rounded_vector,
+ is_rtl ? rounded_vector : SkVector{0, 0},
+ {0, 0},
+ {0, 0},
+ };
+
+ const SkRect bounds = gfx::RectToSkRect(GetLocalBounds());
+ SkPathBuilder path;
+ path.addRect(bounds);
+ path.addRRect(SkRRect::MakeRectRadii(bounds, radii));
+ SkPath outer_corner_path = path.detach();
+ outer_corner_path.setFillType(SkPathFillType::kEvenOdd);
+
+ gfx::ScopedCanvas scoped_canvas(canvas);
+ canvas->ClipPath(outer_corner_path, /*anti_alias=*/true);
+ canvas->DrawColor(GetColorProvider()->GetColor(
+ GetWidget() && !GetWidget()->ShouldPaintAsActive()
+ ? ui::kColorFrameInactive
+ : ui::kColorFrameActive));
+ }
+
+ // views::WidgetObserver:
+ void OnWidgetActivationChanged(views::Widget* /*widget*/,
+ bool /*active*/) override {
+ SchedulePaint();
+ }
+
+ private:
+ int corner_radius_ = 0;
+ base::ScopedObservation<views::Widget, views::WidgetObserver>
+ widget_observation_{this};
+};
+
+BEGIN_METADATA(LeadingCornerFillView)
+END_METADATA
+
ContentsContainerView::ContentsContainerView(BrowserView* browser_view)
: browser_view_(browser_view),
web_contents_modal_dialog_host_(browser_view_, this) {
@@ -81,6 +177,8 @@ ContentsContainerView::ContentsContainer
contents_view_ = AddChildView(
std::make_unique<ContentsWebView>(browser_view->GetProfile()));
contents_view_->SetID(VIEW_ID_TAB_CONTAINER);
+ leading_corner_fill_view_ =
+ AddChildView(std::make_unique<LeadingCornerFillView>());
if (base::FeatureList::IsEnabled(ntp_features::kNtpFooter)) {
new_tab_footer_view_separator_ =
@@ -149,13 +247,15 @@ std::vector<views::View*> ContentsContai
}
-void ContentsContainerView::UpdateBorderAndOverlay(bool is_in_split,
void ContentsContainerView::UpdateBorderAndOverlay(bool is_in_split,
- bool is_active,
- bool is_highlighted) {
+void ContentsContainerView::UpdateBorderAndOverlay(
+ const gfx::RoundedCornersF& contents_radii) {
SetBorder(nullptr);
+ contents_view_->SetBackgroundRadii(contents_radii);
+ contents_view_->holder()->SetCornerRadii(contents_radii);
- SetBorder(nullptr);
-}
-
-void ContentsContainerView::ChildVisibilityChanged(View* child) {
- return;
+ bool is_first_view) {
+ const bool show_corner_fill =
+ browser_view_->ShouldDrawVerticalTabStrip() &&
+ (!is_in_split || is_first_view);
+ const int corner_radius =
+ show_corner_fill
+ ? GetLayoutConstant(LayoutConstant::kVerticalTabCornerRadius)
+ : 0;
+ leading_corner_fill_view_->SetCornerRadius(corner_radius);
}
void ContentsContainerView::ChildVisibilityChanged(View* child) {
void ContentsContainerView::Layout(PassKey pass_key) {
@@ -399,6 +499,14 @@ views::ProposedLayout ContentsContainerV
layouts.child_layouts.emplace_back(
contents_view_.get(), contents_view_->GetVisible(), contents_rect);
+ if (leading_corner_fill_view_) {
+ const gfx::Size corner_size = leading_corner_fill_view_->GetPreferredSize();
+ const gfx::Rect corner_bounds(contents_rect.origin(), corner_size);
+ layouts.child_layouts.emplace_back(
+ leading_corner_fill_view_.get(),
+ leading_corner_fill_view_->GetVisible(), corner_bounds);
+ }
+
#if BUILDFLAG(ENABLE_GLIC)
if (glic_border_) {
// |glic_border_| should not be seen over devtools.
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1251,10 +1251,19 @@ int BrowserView::GetTabStripHeight() con
@@ -0,0 +1,60 @@
--- a/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
@@ -127,12 +127,7 @@ bool BrowserViewLayoutDelegateImpl::IsIn
}
bool BrowserViewLayoutDelegateImpl::IsContentsSeparatorEnabled() const {
- // Web app windows manage their own separator.
- // TODO(crbug.com/40102629): Make PWAs set the visibility of the ToolbarView
- // based on whether it is visible instead of setting the height to 0px. This
- // will enable BrowserViewLayout to hide the contents separator on its own
- // using the same logic used by normal BrowserElementsViews.
- return !browser_view_->browser()->app_controller();
+ return false;
}
bool BrowserViewLayoutDelegateImpl::IsActiveTabSplit() const {
--- a/chrome/browser/ui/views/frame/multi_contents_view.cc
+++ b/chrome/browser/ui/views/frame/multi_contents_view.cc
@@ -659,38 +659,11 @@ void MultiContentsView::OnDragAndDropPre
InvalidateLayout();
}
-void MultiContentsView::SetShouldShowTopSeparator(bool should_show) {
- if (contents_separators_.should_show_top == should_show) {
- return;
- }
- contents_separators_.should_show_top = should_show;
+void MultiContentsView::SetShouldShowTopSeparator(bool should_show) {}
- // This can be called during BrowserView layout, so protect against creating a
- // layout loop.
- InvalidateLayout(/*avoid_propagate_during_layout=*/true);
-}
-
-void MultiContentsView::SetShouldShowLeadingSeparator(bool should_show) {
- if (contents_separators_.should_show_leading == should_show) {
- return;
- }
- contents_separators_.should_show_leading = should_show;
-
- // This can be called during BrowserView layout, so protect against creating a
- // layout loop.
- InvalidateLayout(/*avoid_propagate_during_layout=*/true);
-}
-
-void MultiContentsView::SetShouldShowTrailingSeparator(bool should_show) {
- if (contents_separators_.should_show_trailing == should_show) {
- return;
- }
- contents_separators_.should_show_trailing = should_show;
+void MultiContentsView::SetShouldShowLeadingSeparator(bool should_show) {}
- // This can be called during BrowserView layout, so protect against creating a
- // layout loop.
- InvalidateLayout(/*avoid_propagate_during_layout=*/true);
-}
+void MultiContentsView::SetShouldShowTrailingSeparator(bool should_show) {}
BEGIN_METADATA(MultiContentsView)
END_METADATA
@@ -0,0 +1,18 @@
--- a/chrome/browser/ui/views/frame/top_container_background.cc
+++ b/chrome/browser/ui/views/frame/top_container_background.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
+#include "chrome/browser/ui/views/frame/browser_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/grit/theme_resources.h"
@@ -32,7 +33,6 @@ std::pair<int, ui::ColorId> GetColorChoi
const views::View* view) {
switch (color_choice) {
case TopContainerBackground::ColorChoice::kToolbarColor:
- return {IDR_THEME_TOOLBAR, kColorToolbar};
case TopContainerBackground::ColorChoice::kFrameColor:
if (IsFrameActive(view)) {
return {IDR_THEME_FRAME, ui::kColorFrameActive};
-39
View File
@@ -1,39 +0,0 @@
--- a/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
@@ -127,6 +127,7 @@ bool BrowserViewLayoutDelegateImpl::IsIn
}
bool BrowserViewLayoutDelegateImpl::IsContentsSeparatorEnabled() const {
+ return false;
// Web app windows manage their own separator.
// TODO(crbug.com/40102629): Make PWAs set the visibility of the ToolbarView
// based on whether it is visible instead of setting the height to 0px. This
--- a/chrome/browser/ui/views/frame/top_container_background.cc
+++ b/chrome/browser/ui/views/frame/top_container_background.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
+#include "chrome/browser/ui/views/frame/browser_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/grit/theme_resources.h"
@@ -32,7 +33,6 @@ std::pair<int, ui::ColorId> GetColorChoi
const views::View* view) {
switch (color_choice) {
case TopContainerBackground::ColorChoice::kToolbarColor:
- return {IDR_THEME_TOOLBAR, kColorToolbar};
case TopContainerBackground::ColorChoice::kFrameColor:
if (IsFrameActive(view)) {
return {IDR_THEME_FRAME, ui::kColorFrameActive};
--- a/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
@@ -51,6 +51,8 @@ BrowserViewTabbedLayoutImpl::~BrowserVie
BrowserViewTabbedLayoutImpl::TopSeparatorType
BrowserViewTabbedLayoutImpl::GetTopSeparatorType() const {
+ return TopSeparatorType::kNone;
+
if (!delegate().IsToolbarVisible() && !delegate().IsBookmarkBarVisible()) {
return TopSeparatorType::kNone;
}
+3 -1
View File
@@ -292,7 +292,8 @@ helium/ui/thinner-infobar.patch
helium/ui/reduce-text-button-height.patch
helium/ui/smaller-window-grab-handle.patch
helium/ui/pwa-toolbar.patch
helium/ui/top-container.patch
helium/ui/remove-layout-separators.patch
helium/ui/top-container-background.patch
helium/ui/status-bubble.patch
helium/ui/clean-incognito-guest-ntp.patch
helium/ui/enable-fluent-scrollbar.patch
@@ -313,3 +314,4 @@ helium/ui/layout/vertical.patch
helium/ui/pdf-viewer.patch
helium/ui/hide-pip-live-caption-button.patch
helium/ui/disable-ink-ripple-effect.patch
+1 -1
View File
@@ -1 +1 @@
1
2
+43 -17
View File
@@ -5,12 +5,14 @@
# the terms of the GPL-3.0 license that can be found in the LICENSE file.
"""Script to replace instances of Chrome/Chromium with Helium"""
from concurrent.futures import ProcessPoolExecutor
from tarfile import TarInfo
from pathlib import Path
import argparse
import tarfile
import asyncio
import os
import re
import io
REPLACEMENT_REGEXES_STR = [
# stuff we don't want to replace
@@ -65,6 +67,7 @@ def parse_args():
group.add_argument('--unsub', action='store_true')
parser.add_argument('--backup-path', metavar='<tarball-path>', type=Path)
parser.add_argument('-t', metavar='source_tree', type=Path, required=True)
parser.add_argument('--workers', type=int, default=os.cpu_count())
args = parser.parse_args()
@@ -106,13 +109,13 @@ def get_substitutable_files(tree):
yield from map(lambda filename, root=root: root / filename, filter(is_substitutable, files))
async def substitute_file(tree, path, tarball=None):
def substitute_file(args):
"""
Replaces strings in a particular file,
if there is anything to replace.
Replaces strings in a particular file, and returns
(arcname, original_content) if file was modified, otherwise None.
"""
path, tree, save_original = args
arcname = str(path.relative_to(tree))
text = None
with open(path, 'r', encoding='utf-8') as file:
text = file.read()
@@ -120,11 +123,14 @@ async def substitute_file(tree, path, tarball=None):
replaced = replace(text)
if text != replaced:
print(f"Replaced strings in {arcname}")
if tarball:
tarball.add(path, arcname=arcname, recursive=False)
with open(path, 'w', encoding='utf-8') as file:
file.write(replaced)
if save_original:
return (arcname, text)
return None
def do_unsubstitution(tree, tarpath):
"""Reverts name substitutions from the backup tarball"""
@@ -133,17 +139,37 @@ def do_unsubstitution(tree, tarpath):
tarpath.unlink()
async def do_substitution(tree, tarpath):
def maybe_make_tarball(tar_path, modified_files):
"""
Creates a backup tarball if requested by arguments.
"""
if tar_path is None:
return
with tarfile.open(str(tar_path), 'w:gz') as tar:
for arcname, content in modified_files:
content = content.encode('utf-8')
tarinfo = TarInfo(name=arcname)
tarinfo.size = len(content)
tar.addfile(tarinfo, io.BytesIO(content))
def do_substitution(tree, tarpath, workers):
"""Performs name substitutions on all candidate files"""
with tarfile.open(str(tarpath), 'w:gz') if tarpath else open(os.devnull, 'w',
encoding="utf-8") as cache_tar:
pending_substitutions = map(
lambda path: substitute_file(tree, path, cache_tar if tarpath else None),
get_substitutable_files(tree))
await asyncio.gather(*pending_substitutions)
files = list(get_substitutable_files(tree))
print(f"Found {len(files)} files to process")
with ProcessPoolExecutor(max_workers=workers) as executor:
save_original = tarpath is not None
file_args = [(path, tree, save_original) for path in files]
results = executor.map(substitute_file, file_args)
modified_files = [r for r in results if r is not None]
maybe_make_tarball(tarpath, modified_files)
print(f"Modified {len(modified_files)} files")
async def main():
def main():
"""CLI entrypoint"""
replacement_sanity()
args = parse_args()
@@ -154,10 +180,10 @@ async def main():
if args.sub:
if args.backup_path is not None and args.backup_path.exists():
raise FileExistsError("unsub tarball already exists, aborting")
await do_substitution(args.t, args.backup_path)
do_substitution(args.t, args.backup_path, args.workers)
elif args.unsub and args.backup_path:
do_unsubstitution(args.t, args.backup_path)
if __name__ == '__main__':
asyncio.run(main())
main()