Fix notification expand button focus ring
We need to disable the focus ring outset because of the limited space. Also, added a pixel test. Bug: 325486058 Change-Id: Ifdd246b619d7826c923ac93126d90946d02847e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5468631 Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org> Reviewed-by: Andre Le <leandre@chromium.org> Cr-Commit-Position: refs/heads/main@{#1291063}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
b48d144d0f
commit
2b2c2ce7fe
ash/system/notification_center/views
@ -83,6 +83,7 @@ AshNotificationExpandButton::AshNotificationExpandButton() {
|
||||
message_center_utils::InitLayerForAnimations(image_);
|
||||
|
||||
views::FocusRing::Get(this)->SetColorId(ui::kColorAshFocusRing);
|
||||
views::FocusRing::Get(this)->SetOutsetFocusRingDisabled(true);
|
||||
|
||||
SetPaintToLayer(ui::LAYER_SOLID_COLOR);
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
@ -93,8 +94,9 @@ AshNotificationExpandButton::AshNotificationExpandButton() {
|
||||
AshNotificationExpandButton::~AshNotificationExpandButton() = default;
|
||||
|
||||
void AshNotificationExpandButton::SetExpanded(bool expanded) {
|
||||
if (expanded_ == expanded)
|
||||
if (expanded_ == expanded) {
|
||||
return;
|
||||
}
|
||||
|
||||
previous_bounds_ = GetContentsBounds();
|
||||
|
||||
@ -139,8 +141,9 @@ void AshNotificationExpandButton::UpdateIcons() {
|
||||
void AshNotificationExpandButton::AnimateExpandCollapse() {
|
||||
// If the button is not used for grouped notification, there's no animation to
|
||||
// perform here.
|
||||
if (!total_grouped_notifications_)
|
||||
if (!total_grouped_notifications_) {
|
||||
return;
|
||||
}
|
||||
|
||||
int bounds_animation_duration;
|
||||
gfx::Tween::Type bounds_animation_tween_type;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "ash/system/notification_center/message_popup_animation_waiter.h"
|
||||
#include "ash/system/notification_center/notification_center_test_api.h"
|
||||
#include "ash/system/notification_center/notification_center_tray.h"
|
||||
#include "ash/system/notification_center/views/ash_notification_expand_button.h"
|
||||
#include "ash/system/notification_center/views/ash_notification_view.h"
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "ash/test/ash_test_util.h"
|
||||
@ -214,6 +215,21 @@ TEST_F(AshNotificationViewPixelTest, InlineReply) {
|
||||
"inline_reply_focused", /*revision_number=*/0, notification_view));
|
||||
}
|
||||
|
||||
// Tests the focus ring for the expand button in AshNotificationView.
|
||||
TEST_F(AshNotificationViewPixelTest, ExpandButtonFocusRing) {
|
||||
const std::string id = test_api()->AddNotification();
|
||||
test_api()->ToggleBubble();
|
||||
|
||||
auto* notification_view = views::AsViewClass<AshNotificationView>(
|
||||
test_api()->GetNotificationViewForId(id));
|
||||
while (!notification_view->expand_button_for_test()->HasFocus()) {
|
||||
PressAndReleaseKey(ui::VKEY_TAB);
|
||||
}
|
||||
|
||||
EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
|
||||
"expand_button_focus_ring", /*revision_number=*/0, notification_view));
|
||||
}
|
||||
|
||||
TEST_F(AshNotificationViewPixelTest, NotificationViewFocusRing) {
|
||||
const std::string id = test_api()->AddNotification();
|
||||
test_api()->ToggleBubble();
|
||||
|
Reference in New Issue
Block a user