Commit cd68a26c authored by Joel Riley's avatar Joel Riley Committed by Chromium LUCI CQ

Move focus rings and highlight layers under accessibility bubbles.

Will allow Select-to-speak panel UI to appear above focus ring and highlight layers. This also avoids the need to create more window containers.

Bug: 1143814
Change-Id: I1c4fce614404c6cabd0336eed2ab6fa7ac1d4c48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568547
Commit-Queue: Joel Riley <joelriley@google.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833155}
parent ae6c3d56
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ash/accessibility/accessibility_cursor_ring_layer.h" #include "ash/accessibility/accessibility_cursor_ring_layer.h"
#include "ash/public/cpp/accessibility_focus_ring_info.h" #include "ash/public/cpp/accessibility_focus_ring_info.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -110,7 +111,9 @@ TEST_F(AccessibilityFocusRingControllerTest, FocusRingWorksOnMultipleDisplays) { ...@@ -110,7 +111,9 @@ TEST_F(AccessibilityFocusRingControllerTest, FocusRingWorksOnMultipleDisplays) {
controller->GetFocusRingGroupForTesting("catsRCute") controller->GetFocusRingGroupForTesting("catsRCute")
->focus_layers_for_testing(); ->focus_layers_for_testing();
EXPECT_EQ(1u, layers.size()); EXPECT_EQ(1u, layers.size());
EXPECT_EQ(root_windows[0], layers[0]->root_window()); aura::Window* window0_container = Shell::GetContainer(
root_windows[0], kShellWindowId_AccessibilityPanelContainer);
EXPECT_EQ(window0_container, layers[0]->root_window());
// The focus ring has some padding, so just check the center point is where // The focus ring has some padding, so just check the center point is where
// we would expect it. // we would expect it.
EXPECT_EQ(layers[0]->layer()->GetTargetBounds().CenterPoint(), EXPECT_EQ(layers[0]->layer()->GetTargetBounds().CenterPoint(),
...@@ -127,7 +130,9 @@ TEST_F(AccessibilityFocusRingControllerTest, FocusRingWorksOnMultipleDisplays) { ...@@ -127,7 +130,9 @@ TEST_F(AccessibilityFocusRingControllerTest, FocusRingWorksOnMultipleDisplays) {
moved_layers = controller->GetFocusRingGroupForTesting("catsRCute") moved_layers = controller->GetFocusRingGroupForTesting("catsRCute")
->focus_layers_for_testing(); ->focus_layers_for_testing();
EXPECT_EQ(1u, moved_layers.size()); EXPECT_EQ(1u, moved_layers.size());
EXPECT_EQ(root_windows[1], moved_layers[0]->root_window()); aura::Window* window1_container = Shell::GetContainer(
root_windows[1], kShellWindowId_AccessibilityPanelContainer);
EXPECT_EQ(window1_container, moved_layers[0]->root_window());
EXPECT_EQ(moved_layers[0]->layer()->GetTargetBounds().CenterPoint(), EXPECT_EQ(moved_layers[0]->layer()->GetTargetBounds().CenterPoint(),
gfx::Rect(100, 50, 10, 10).CenterPoint()); gfx::Rect(100, 50, 10, 10).CenterPoint());
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/accessibility/accessibility_focus_ring_layer.h" #include "ash/accessibility/accessibility_focus_ring_layer.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/bind.h" #include "base/bind.h"
#include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPaint.h"
...@@ -100,6 +101,8 @@ void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) { ...@@ -100,6 +101,8 @@ void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) {
display::Display display = display::Display display =
display::Screen::GetScreen()->GetDisplayMatching(bounds); display::Screen::GetScreen()->GetDisplayMatching(bounds);
aura::Window* root_window = Shell::GetRootWindowForDisplayId(display.id()); aura::Window* root_window = Shell::GetRootWindowForDisplayId(display.id());
aura::Window* container = Shell::GetContainer(
root_window, kShellWindowId_AccessibilityPanelContainer);
if (SkColorGetA(background_color_) > 0) { if (SkColorGetA(background_color_) > 0) {
bounds = display.bounds(); bounds = display.bounds();
...@@ -107,8 +110,8 @@ void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) { ...@@ -107,8 +110,8 @@ void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) {
int inset = kGradientWidth; int inset = kGradientWidth;
bounds.Inset(-inset, -inset, -inset, -inset); bounds.Inset(-inset, -inset, -inset, -inset);
} }
::wm::ConvertRectFromScreen(root_window, &bounds); ::wm::ConvertRectFromScreen(container, &bounds);
CreateOrUpdateLayer(root_window, "AccessibilityFocusRing", bounds); CreateOrUpdateLayer(container, "AccessibilityFocusRing", bounds);
} }
void AccessibilityFocusRingLayer::SetAppearance(FocusRingType type, void AccessibilityFocusRingLayer::SetAppearance(FocusRingType type,
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/accessibility/accessibility_highlight_layer.h" #include "ash/accessibility/accessibility_highlight_layer.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkPath.h"
...@@ -49,8 +50,10 @@ void AccessibilityHighlightLayer::Set(const std::vector<gfx::Rect>& rects, ...@@ -49,8 +50,10 @@ void AccessibilityHighlightLayer::Set(const std::vector<gfx::Rect>& rects,
display::Display display = display::Display display =
display::Screen::GetScreen()->GetDisplayMatching(bounds); display::Screen::GetScreen()->GetDisplayMatching(bounds);
aura::Window* root_window = Shell::GetRootWindowForDisplayId(display.id()); aura::Window* root_window = Shell::GetRootWindowForDisplayId(display.id());
::wm::ConvertRectFromScreen(root_window, &bounds); aura::Window* container = Shell::GetContainer(
CreateOrUpdateLayer(root_window, "AccessibilityHighlight", bounds); root_window, kShellWindowId_AccessibilityPanelContainer);
::wm::ConvertRectFromScreen(container, &bounds);
CreateOrUpdateLayer(container, "AccessibilityHighlight", bounds);
} }
bool AccessibilityHighlightLayer::CanAnimate() const { bool AccessibilityHighlightLayer::CanAnimate() const {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "ash/accessibility/focus_ring_controller.h" #include "ash/accessibility/focus_ring_controller.h"
#include "ash/accessibility/focus_ring_layer.h" #include "ash/accessibility/focus_ring_layer.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "ash/system/tray/actionable_view.h" #include "ash/system/tray/actionable_view.h"
#include "ash/system/tray/tray_background_view.h" #include "ash/system/tray/tray_background_view.h"
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
...@@ -83,7 +85,9 @@ void FocusRingController::UpdateFocusRing() { ...@@ -83,7 +85,9 @@ void FocusRingController::UpdateFocusRing() {
// Update the focus ring layer. // Update the focus ring layer.
if (!focus_ring_layer_) if (!focus_ring_layer_)
focus_ring_layer_.reset(new FocusRingLayer(this)); focus_ring_layer_.reset(new FocusRingLayer(this));
focus_ring_layer_->Set(root_window, view_bounds); aura::Window* container = Shell::GetContainer(
root_window, kShellWindowId_AccessibilityPanelContainer);
focus_ring_layer_->Set(container, view_bounds);
} }
void FocusRingController::OnDeviceScaleFactorChanged() { void FocusRingController::OnDeviceScaleFactorChanged() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment