Skip to content

Commit

Permalink
[M-102] Fill extra tab space when close button is hidden
Browse files Browse the repository at this point in the history
As part of the tab strip improvements experiments, when the close button is hidden for tabs at the edge of the tab strip, the title of the tab should expand to fill up the empty space. This is already happening for 108dp experiment. This CL adds this behavior for the 156dp experiment.

(cherry picked from commit e11409a)

Bug: 1318563
Change-Id: I844814659362506997ec5da7abeda680238a565a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3601385
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Reviewed-by: Sirisha Kavuluru <skavuluru@google.com>
Commit-Queue: Gaurav Jayasawal <gauravjj@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#995377}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3607439
Cr-Commit-Position: refs/branch-heads/5005@{#182}
Cr-Branched-From: 5b4d945-refs/heads/main@{#992738}
  • Loading branch information
Gaurav Jayasawal authored and Chromium LUCI CQ committed Apr 26, 2022
1 parent 3405c19 commit 578714e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chrome/browser/android/compositor/layer/tab_handle_layer.cc
Expand Up @@ -20,6 +20,7 @@
namespace android {

const char TAB_WIDTH_SMALL[] = "108";
const char TAB_WIDTH_MEDIUM[] = "156";
const char TAB_STRIP_IMPROVEMENTS_FEATURE_PARAMETER[] = "min_tab_width";

// static
Expand Down Expand Up @@ -136,13 +137,15 @@ void TabHandleLayer::SetProperties(
const float padding_left = tab_handle_resource->padding().x();

float close_width = close_button_->bounds().width();
// For the 108dp min_tab_width experiment, if close button is not shown, fill
// For the min_tab_width experiments, if close button is not shown, fill
// the remaining space with the title text
if (base::FeatureList::IsEnabled(chrome::android::kTabStripImprovements)) {
std::string tab_width_param = base::GetFieldTrialParamValueByFeature(
chrome::android::kTabStripImprovements,
TAB_STRIP_IMPROVEMENTS_FEATURE_PARAMETER);
if (tab_width_param == TAB_WIDTH_SMALL && close_button_alpha == 0.f)
bool is_tab_width_experiment = (tab_width_param == TAB_WIDTH_SMALL ||
tab_width_param == TAB_WIDTH_MEDIUM);
if (is_tab_width_experiment && close_button_alpha == 0.f)
close_width = 0.f;
}

Expand Down

0 comments on commit 578714e

Please sign in to comment.