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

[pull] main from chromium:main #114

Merged
merged 26 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cdc18bb
Move base::BrokenClampThatShouldNotBeUsed() to the file that uses it.
leizleiz Dec 15, 2021
a559071
Roll Chrome Win32 PGO Profile
Dec 15, 2021
718f734
[MPArch] Fix FederatedAuthNavigationThrottle handling of fenced frames
cdesouza-chromium Dec 15, 2021
c44d568
Roll Catapult from 563885e399ba to b759738dea9a (3 revisions)
Dec 15, 2021
3e1d447
Updating trunk VERSION from 4767.0 to 4768.0
Dec 15, 2021
e905c8b
[Code Health] Modernize Value API in metrics_reporting_pref_helper.cc
chikamune-cr Dec 15, 2021
0ecaa65
Use StringPiece in GetKey and GetValue in QueryIterator
aakalugin Dec 15, 2021
cf016ce
Roll Skia from d337cf94a077 to 71f7880bb635 (1 revision)
Dec 15, 2021
8d63081
Add NonBlockingCommit feature flag and implementation
szager-chromium Dec 15, 2021
8384468
CCA: Migrate waitable_event.js to TypeScript
peter50216 Dec 15, 2021
71a3d8e
Revert "[CrOS Bluetooth] A11y in bluetooth pairing device list"
Dec 15, 2021
3f41b4f
accessibility_strings.gni: Replace static list of locales
mlcui-corp Dec 15, 2021
ed5f5dc
Remove CHECKs in DisplayResourceProvider
Dec 15, 2021
84265be
[Sheriff]: Disable a flaky test
hayatoito Dec 15, 2021
110c10e
Implement pref observer to show Tailored Security Sync UX
Dec 15, 2021
1ea17cf
Layout apps grid more evenly with recent apps
Dec 15, 2021
9f3aa46
[Sheriff]: Disable flaky tests
hayatoito Dec 15, 2021
c10ad80
Update V8 to version 9.9.4.
Dec 15, 2021
5c7850f
[Sheriff]: Disable a flaky test
hayatoito Dec 15, 2021
2ff3201
[unseasoned-pdf] Clamp remote scroll positions
kmoon-work Dec 15, 2021
9608caf
Roll src-internal from 41781a31dda1 to 8ec97804c2ef (6 revisions)
Dec 15, 2021
82cb7cf
ash: Add border and shadow to productivity launcher in clamshell mode
Dec 15, 2021
2a3e0b1
[skylab_tests] Update skylab tests cros img version
skylab-tests-roller Dec 15, 2021
526af3d
Roll Chrome Win64 PGO Profile
Dec 15, 2021
7098eb8
Roll Fuchsia Internal SDK from 7.20211214.2.1 to 7.20211214.3.1
Dec 15, 2021
413b776
Add a user initiated navigation metric to UserPerceivedPageVisit event.
Dec 15, 2021
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: 4 additions & 4 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling Skia
# and whatever else without interference from each other.
'skia_revision': 'd337cf94a077c9ddec8f1c7d99c04e2ed14cd553',
'skia_revision': '71f7880bb635810ca81e6cebaaaa25018499f2d7',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling V8
# and whatever else without interference from each other.
'v8_revision': 'b5bf62dafe52d10d65bfd2e378d658b5b3b04a5e',
'v8_revision': 'ceb9223e1ab1df795d5f3e69f9fae92bb8328e92',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling ANGLE
# and whatever else without interference from each other.
Expand Down Expand Up @@ -306,7 +306,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling catapult
# and whatever else without interference from each other.
'catapult_revision': '563885e399ba18672cd7d009a0c0f0a996d71f6b',
'catapult_revision': 'b759738dea9abafcbd0dc69553fd049a86e7b56b',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling libFuzzer
# and whatever else without interference from each other.
Expand Down Expand Up @@ -1700,7 +1700,7 @@ deps = {
Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'),

'src-internal': {
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@41781a31dda1a0a56f41d036cb5333fe84c40645',
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@8ec97804c2ef0925c3447d7915a8ec63f5181895',
'condition': 'checkout_src_internal',
},

Expand Down
28 changes: 24 additions & 4 deletions ash/app_list/views/app_list_bubble_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#include "ash/public/cpp/metrics_util.h"
#include "ash/public/cpp/shelf_config.h"
#include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/view_shadow.h"
#include "ash/search_box/search_box_constants.h"
#include "ash/style/ash_color_provider.h"
#include "ash/style/highlight_border.h"
#include "base/bind.h"
#include "base/check.h"
#include "base/check_op.h"
Expand Down Expand Up @@ -62,6 +64,9 @@ namespace {
// Folder view inset from the edge of the bubble.
constexpr int kFolderViewInset = 16;

// Elevation for the bubble's shadow.
constexpr int kShadowElevation = 3;

AppListConfig* GetAppListConfig() {
return AppListConfigProvider::Get().GetConfigForType(
AppListConfigType::kDense, /*can_create=*/true);
Expand Down Expand Up @@ -109,8 +114,8 @@ AppListBubbleView::AppListBubbleView(
DCHECK(drag_and_drop_host);

// Set up rounded corners and background blur, similar to TrayBubbleView.
// Layer color is set in OnThemeChanged().
SetPaintToLayer(ui::LAYER_SOLID_COLOR);
// Layer background is set in OnThemeChanged().
SetPaintToLayer();
layer()->SetRoundedCornerRadius(gfx::RoundedCornersF{kBubbleCornerRadius});
layer()->SetFillsBoundsOpaquely(false);
layer()->SetIsFastRoundedCorner(true);
Expand Down Expand Up @@ -216,6 +221,9 @@ void AppListBubbleView::InitFolderView(
}

void AppListBubbleView::StartShowAnimation() {
// For performance, don't animate the shadow.
view_shadow_.reset();

// Ensure layout is up-to-date before animating views.
if (needs_layout())
Layout();
Expand Down Expand Up @@ -264,6 +272,9 @@ void AppListBubbleView::StartHideAnimation(
base::OnceClosure on_animation_ended) {
on_hide_animation_ended_ = std::move(on_animation_ended);

// For performance, don't animate the shadow.
view_shadow_.reset();

// Ensure any in-progress animations have their cleanup callbacks called.
AbortAllAnimations();

Expand Down Expand Up @@ -388,8 +399,13 @@ bool AppListBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) {
void AppListBubbleView::OnThemeChanged() {
views::View::OnThemeChanged();

layer()->SetColor(AshColorProvider::Get()->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kTransparent80));
SetBackground(views::CreateRoundedRectBackground(
AshColorProvider::Get()->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kTransparent80),
kBubbleCornerRadius));
SetBorder(std::make_unique<HighlightBorder>(
kBubbleCornerRadius, HighlightBorder::Type::kHighlightBorder1,
/*use_light_colors=*/false));
}

void AppListBubbleView::Layout() {
Expand Down Expand Up @@ -530,6 +546,10 @@ void AppListBubbleView::OnShowAnimationEnded(const gfx::Rect& layer_bounds) {
// visible because the bounds won't change. If the animation was aborted, this
// is needed to reset state before starting the hide animation.
layer()->SetBounds(layer_bounds);

// Add a shadow.
view_shadow_ = std::make_unique<ViewShadow>(this, kShadowElevation);
view_shadow_->SetRoundedCornerRadius(kBubbleCornerRadius);
}

void AppListBubbleView::OnHideAnimationEnded(const gfx::Rect& layer_bounds) {
Expand Down
3 changes: 3 additions & 0 deletions ash/app_list/views/app_list_bubble_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AppListViewDelegate;
class FolderBackgroundView;
class SearchBoxView;
class SearchResultPageDialogController;
class ViewShadow;

// Contains the views for the bubble version of the launcher. It looks like a
// system tray bubble. It does not derive from TrayBubbleView because it takes
Expand Down Expand Up @@ -97,6 +98,7 @@ class ASH_EXPORT AppListBubbleView : public views::View,

AppListBubbleAppsPage* apps_page() { return apps_page_; }

ViewShadow* view_shadow_for_test() { return view_shadow_.get(); }
views::View* separator_for_test() { return separator_; }
bool showing_folder_for_test() { return showing_folder_; }
AppListBubbleAppsPage* apps_page_for_test() { return apps_page_; }
Expand Down Expand Up @@ -129,6 +131,7 @@ class ASH_EXPORT AppListBubbleView : public views::View,
std::unique_ptr<SearchResultPageDialogController>
search_page_dialog_controller_;

std::unique_ptr<ViewShadow> view_shadow_;
SearchBoxView* search_box_view_ = nullptr;
views::View* separator_ = nullptr;
AppListBubbleAppsPage* apps_page_ = nullptr;
Expand Down
41 changes: 34 additions & 7 deletions ash/app_list/views/app_list_bubble_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ using views::Widget;
namespace ash {
namespace {

constexpr int kBorderSize = 2;

SearchModel* GetSearchModel() {
return AppListModelProvider::Get()->search_model();
}
Expand Down Expand Up @@ -197,31 +199,32 @@ TEST_F(AppListBubbleViewTest, LayerConfiguration) {
EXPECT_FALSE(layer->fills_bounds_opaquely());
EXPECT_TRUE(layer->is_fast_rounded_corner());
EXPECT_EQ(layer->background_blur(), ColorProvider::kBackgroundBlurSigma);
EXPECT_EQ(layer->background_color(),
AshColorProvider::Get()->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kTransparent80));
}

// Tests some basic layout coordinates, because we don't have screenshot tests.
// See go/cros-launcher-spec for layout.
TEST_F(AppListBubbleViewTest, Layout) {
ShowAppList();

// The view has a background.
auto* app_list_bubble_view = GetAppListTestHelper()->GetBubbleView();
EXPECT_TRUE(app_list_bubble_view->background());

// Check the bounds of the search box search icon.
auto* search_box_view = GetSearchBoxView();
auto* search_icon = search_box_view->search_icon();
gfx::Rect search_icon_bounds =
search_icon->ConvertRectToWidget(search_icon->GetLocalBounds());
EXPECT_EQ("16,16 24x24", search_icon_bounds.ToString());
EXPECT_EQ("18,18 24x24", search_icon_bounds.ToString());

// Check height of search box view.
EXPECT_EQ(56, search_box_view->height());

// The separator is immediately under the search box.
gfx::Point separator_origin;
views::View::ConvertPointToWidget(GetSearchBoxSeparator(), &separator_origin);
EXPECT_EQ(0, separator_origin.x());
EXPECT_EQ(search_box_view->height(), separator_origin.y());
EXPECT_EQ(kBorderSize, separator_origin.x());
EXPECT_EQ(kBorderSize + search_box_view->height(), separator_origin.y());
}

TEST_F(AppListBubbleViewTest, OpeningBubbleTriggersAnimations) {
Expand Down Expand Up @@ -323,6 +326,28 @@ TEST_F(AppListBubbleViewTest, ShowAnimationDestroysAndRestoresGradientMask) {
EXPECT_TRUE(scroll_view->layer()->layer_mask_layer());
}

TEST_F(AppListBubbleViewTest, ShowAnimationDestroysAndRestoresShadow) {
// Enable animations.
base::test::ScopedFeatureList feature(
features::kProductivityLauncherAnimation);
ui::ScopedAnimationDurationScaleMode duration(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);

AddAppItems(20);
ShowAppList();

// Shadow is suppressed during show animation for performance.
auto* app_list_bubble_view = GetAppListTestHelper()->GetBubbleView();
EXPECT_FALSE(app_list_bubble_view->view_shadow_for_test());

// Finish the animation.
auto* apps_grid_view = GetAppsGridView();
WaitForLayerAnimation(apps_grid_view->layer());

// Shadow is restored.
EXPECT_TRUE(app_list_bubble_view->view_shadow_for_test());
}

TEST_F(AppListBubbleViewTest, ShowAnimationRecordsSmoothnessHistogram) {
base::HistogramTester histograms;

Expand Down Expand Up @@ -459,7 +484,9 @@ TEST_F(AppListBubbleViewTest, AssistantPageLayout) {
// Assistant fills the bubble view, so that any suggestion chips will appear
// at the bottom.
auto* app_list_bubble_view = GetAppListTestHelper()->GetBubbleView();
EXPECT_EQ(GetAssistantPage()->bounds(), app_list_bubble_view->bounds());
gfx::Rect expected_bounds = app_list_bubble_view->bounds();
expected_bounds.Inset(kBorderSize);
EXPECT_EQ(GetAssistantPage()->bounds(), expected_bounds);
}

TEST_F(AppListBubbleViewTest, SearchBoxCloseButton) {
Expand Down
13 changes: 8 additions & 5 deletions ash/app_list/views/apps_container_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ class AppsContainerView::ContinueContainer : public views::View {
ColorProvider::ContentLayerType::kSeparatorColor));
}

bool HasRecentApps() const {
return recent_apps_ && recent_apps_->GetVisible();
}

ContinueSectionView* continue_section() { return continue_section_; }
RecentAppsView* recent_apps() { return recent_apps_; }
views::View* separator() { return separator_; }
Expand Down Expand Up @@ -834,17 +838,16 @@ void AppsContainerView::Layout() {
// added margins.
grid_rect.Inset(-grid_insets);
scrollable_container_->SetBoundsRect(grid_rect);
bool first_page_offset_changed = false;
bool first_page_config_changed = false;
if (features::IsProductivityLauncherEnabled()) {
const int continue_container_height =
continue_container_->GetPreferredSize().height();
continue_container_->SetBoundsRect(
gfx::Rect(0, 0, grid_rect.width(), continue_container_height));
// Setting this offset prevents the app items in the grid from overlapping
// with the continue section.
first_page_offset_changed =
continue_container_height != apps_grid_view_->first_page_offset();
apps_grid_view_->set_first_page_offset(continue_container_height);
first_page_config_changed = apps_grid_view_->ConfigureFirstPagePadding(
continue_container_height, continue_container_->HasRecentApps());
}

// Make sure that UpdateTopLevelGridDimensions() happens after setting the
Expand All @@ -855,7 +858,7 @@ void AppsContainerView::Layout() {
const gfx::Rect apps_grid_bounds(grid_rect.size());
if (apps_grid_view_->bounds() != apps_grid_bounds) {
apps_grid_view_->SetBoundsRect(apps_grid_bounds);
} else if (first_page_offset_changed) {
} else if (first_page_config_changed) {
// Apps grid layout depends on the continue container bounds, so explicitly
// call layout to ensure apps grid view gets laid out even if its bounds do
// not change.
Expand Down
61 changes: 53 additions & 8 deletions ash/app_list/views/paged_apps_grid_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ int PagedAppsGridView::GetMaxRowsInPage(int page) const {
}

gfx::Vector2d PagedAppsGridView::GetGridCenteringOffset(int page) const {
const int y_offset = page == 0 ? first_page_offset_ : 0;
const int y_offset = page == 0 ? GetTotalTopPaddingOnFirstPage() : 0;
if (!cardified_state_)
return gfx::Vector2d(0, y_offset);
const gfx::Rect bounds = GetContentsBounds();
Expand Down Expand Up @@ -1235,8 +1235,9 @@ gfx::Rect PagedAppsGridView::BackgroundCardBounds(int new_page_index) {
(GetContentsBounds().width() - background_card_size.width()) / 2 +
extra_padding_for_cardified_state;

int y_offset = std::max(new_page_index == 0 ? first_page_offset_ : 0,
GetFadeoutMaskHeight());
int y_offset =
std::max(new_page_index == 0 ? GetTotalTopPaddingOnFirstPage() : 0,
GetFadeoutMaskHeight());
// The vertical padding should account for the fadeout mask.
const int vertical_padding =
y_offset + (GetContentsBounds().height() - y_offset -
Expand Down Expand Up @@ -1341,15 +1342,51 @@ void PagedAppsGridView::UpdateTilePadding() {

// NOTE: The padding on the first page can be different than other pages
// depending on `first_page_offset_` and `max_rows_on_first_page_`.
first_page_vertical_tile_padding_ =
calculate_tile_padding(content_size.height(), max_rows_on_first_page_,
tile_size.height(), first_page_offset_);
// When shown under recent apps, assume an extra row when calculating padding,
// as an extra leading tile padding will get added above the first row of apps
// (as a margin to recent apps container).
// Adjust `first_page_offset_` by removing space required for recent apps
// (assumes that recent apps tile size matches the apps grid tile size, and
// that recent apps container has a single row of apps) so padding is
// calculated assuming recent apps container is part of the apps grid.
if (shown_under_recent_apps_) {
first_page_vertical_tile_padding_ = calculate_tile_padding(
content_size.height(), max_rows_on_first_page_ + 1, tile_size.height(),
std::max(0, first_page_offset_ - tile_size.height()));
} else {
first_page_vertical_tile_padding_ =
calculate_tile_padding(content_size.height(), max_rows_on_first_page_,
tile_size.height(), first_page_offset_);
}
}

bool PagedAppsGridView::ConfigureFirstPagePadding(
int offset,
bool shown_under_recent_apps) {
if (offset == first_page_offset_ &&
shown_under_recent_apps == shown_under_recent_apps_) {
return false;
}
first_page_offset_ = offset;
shown_under_recent_apps_ = shown_under_recent_apps;
return true;
}

int PagedAppsGridView::CalculateFirstPageMaxRows(int available_height,
int preferred_rows) {
return CalculateMaxRows(available_height - first_page_offset_,
preferred_rows);
// When shown under recent apps, calculate max rows as if recent apps
// container is part of the grid, i.e. calculate number of rows as if grid
// allows for an extra row of apps.
const int space_for_recent_apps =
shown_under_recent_apps_ ? app_list_config()->grid_tile_height() : 0;
const int max_rows = CalculateMaxRows(
available_height -
std::max(0, first_page_offset_ - space_for_recent_apps),
preferred_rows);
// If `shown_under_recent_apps_`, subtract a row from the result of
// `CalculateMaxRows()` which was calculated assuming there's an extra row of
// apps added for recent apps.
return shown_under_recent_apps_ ? std::max(0, max_rows - 1) : max_rows;
}

int PagedAppsGridView::CalculateMaxRows(int available_height,
Expand Down Expand Up @@ -1383,4 +1420,12 @@ int PagedAppsGridView::CalculateMaxRows(int available_height,
return final_row_count;
}

int PagedAppsGridView::GetTotalTopPaddingOnFirstPage() const {
// Add the page offset that accommodates continue section content, and if
// shown under recent apps, additional tile padding above the first row of
// apps.
return first_page_offset_ +
(shown_under_recent_apps_ ? 2 * first_page_vertical_tile_padding_ : 0);
}

} // namespace ash
Loading