overview: Enable overview new focus
This enables a new view based focus style that has a lot less custom logic than the existing way. The old code will remain until branch in case we want to disable. Fixes one last bug where activating a view will stack it on top. However, for overview items we want the view to remain underneath the actual window. Test: trybots Test: manual Bug: b:325335020 Change-Id: Ia0c7989174f518923e389a000896433348626ac0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5646323 Commit-Queue: Sammie Quon <sammiequon@chromium.org> Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Cr-Commit-Position: refs/heads/main@{#1320616}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
33bf00e335
commit
0d2c7ace7e
ash
accessibility
constants
wm
@ -513,6 +513,14 @@ TEST_F(DockedMagnifierTest, DisplaysWorkAreasOverviewMode) {
|
||||
}
|
||||
|
||||
TEST_F(DockedMagnifierTest, OverviewTabbing) {
|
||||
// In production code, `DockedMagnifierController::CenterOnPoint()` is called
|
||||
// via an extension function. This code path will not be triggered in ash unit
|
||||
// tests.
|
||||
if (features::IsOverviewNewFocusEnabled()) {
|
||||
GTEST_SKIP() << "Overview new focus uses `views::View::RequestFocus()` and "
|
||||
"has no custom magnifier logic anymore.";
|
||||
}
|
||||
|
||||
auto window = CreateTestWindow();
|
||||
controller()->SetEnabled(true);
|
||||
|
||||
|
@ -2294,7 +2294,7 @@ BASE_FEATURE(kOverviewDeskNavigation,
|
||||
|
||||
BASE_FEATURE(kOverviewNewFocus,
|
||||
"OverviewNewFocus",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Enables Jelly colors and components to appear in the Parent Access Widget
|
||||
// if jelly-colors is also enabled.
|
||||
|
@ -95,6 +95,31 @@ class ScopedActivatable : public views::WidgetObserver {
|
||||
observation_.Reset();
|
||||
}
|
||||
|
||||
void OnWidgetActivationChanged(views::Widget* widget, bool active) override {
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If an overview item received focus, we need to restack the original
|
||||
// window above the overview item widget, otherwise the overview backdrop
|
||||
// would end up covering the original window.
|
||||
auto* item_view =
|
||||
views::AsViewClass<OverviewItemView>(widget->GetContentsView());
|
||||
if (!item_view) {
|
||||
return;
|
||||
}
|
||||
|
||||
OverviewItemBase* item = item_view->GetOverviewItem();
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
aura::Window* parent = widget->GetNativeWindow()->parent();
|
||||
if (parent == item->GetWindow()->parent()) {
|
||||
parent->StackChildAbove(item->GetWindow(), widget->GetNativeWindow());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
base::ScopedObservation<views::Widget, views::WidgetObserver> observation_{
|
||||
this};
|
||||
|
@ -1053,16 +1053,8 @@ aura::Window* OverviewSession::GetFocusedWindow() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const views::Widget* item_widget = item_view->GetWidget();
|
||||
for (const std::unique_ptr<OverviewGrid>& overview_grid : grid_list_) {
|
||||
for (const auto& overview_item : overview_grid->window_list()) {
|
||||
if (overview_item->item_widget() == item_widget) {
|
||||
return overview_item->GetWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
OverviewItemBase* item = item_view->GetOverviewItem();
|
||||
return item ? item->GetWindow() : nullptr;
|
||||
}
|
||||
|
||||
void OverviewSession::SuspendReposition() {
|
||||
|
Reference in New Issue
Block a user