Commit abc6bede authored by Caroline Rising's avatar Caroline Rising Committed by Commit Bot

Hide tab hover cards when keyboard focus is on the new tab button.

Bug: 910739, 965642
Change-Id: Ifd32508bab312dcb9ec9e9bcd86ac98b755725f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625844Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662896}
parent 91eac2e6
...@@ -139,7 +139,8 @@ class TabHoverCardBubbleView::WidgetFadeAnimationDelegate ...@@ -139,7 +139,8 @@ class TabHoverCardBubbleView::WidgetFadeAnimationDelegate
constexpr base::TimeDelta kFadeInDuration = constexpr base::TimeDelta kFadeInDuration =
base::TimeDelta::FromMilliseconds(200); base::TimeDelta::FromMilliseconds(200);
set_animation_state(FadeAnimationState::FADE_IN); set_animation_state(FadeAnimationState::FADE_IN);
widget_->SetOpacity(0.0f); // Widgets cannot be shown when visible and fully transparent.
widget_->SetOpacity(0.01f);
widget_->Show(); widget_->Show();
fade_animation_ = std::make_unique<gfx::LinearAnimation>(this); fade_animation_ = std::make_unique<gfx::LinearAnimation>(this);
fade_animation_->SetDuration(kFadeInDuration); fade_animation_->SetDuration(kFadeInDuration);
......
...@@ -841,6 +841,8 @@ TabStrip::~TabStrip() { ...@@ -841,6 +841,8 @@ TabStrip::~TabStrip() {
// but before moving the mouse. // but before moving the mouse.
RemoveMessageLoopObserver(); RemoveMessageLoopObserver();
new_tab_button_->RemoveObserver(this);
// The children (tabs) may callback to us from their destructor. Delete them // The children (tabs) may callback to us from their destructor. Delete them
// so that if they call back we aren't in a weird state. // so that if they call back we aren't in a weird state.
RemoveAllChildViews(true); RemoveAllChildViews(true);
...@@ -2037,6 +2039,7 @@ void TabStrip::Init() { ...@@ -2037,6 +2039,7 @@ void TabStrip::Init() {
new_tab_button_->SetEventTargeter( new_tab_button_->SetEventTargeter(
std::make_unique<views::ViewTargeter>(new_tab_button_)); std::make_unique<views::ViewTargeter>(new_tab_button_));
AddChildView(new_tab_button_); AddChildView(new_tab_button_);
new_tab_button_->AddObserver(this);
UpdateNewTabButtonBorder(); UpdateNewTabButtonBorder();
new_tab_button_bounds_.set_size(new_tab_button_->GetPreferredSize()); new_tab_button_bounds_.set_size(new_tab_button_->GetPreferredSize());
...@@ -2959,6 +2962,11 @@ void TabStrip::OnViewIsDeleting(views::View* observed_view) { ...@@ -2959,6 +2962,11 @@ void TabStrip::OnViewIsDeleting(views::View* observed_view) {
} }
} }
void TabStrip::OnViewFocused(views::View* observed_view) {
if (observed_view == new_tab_button_)
UpdateHoverCard(nullptr, false);
}
void TabStrip::OnTouchUiChanged() { void TabStrip::OnTouchUiChanged() {
UpdateNewTabButtonBorder(); UpdateNewTabButtonBorder();
new_tab_button_bounds_.set_size(new_tab_button_->GetPreferredSize()); new_tab_button_bounds_.set_size(new_tab_button_->GetPreferredSize());
......
...@@ -528,6 +528,7 @@ class TabStrip : public views::AccessiblePaneView, ...@@ -528,6 +528,7 @@ class TabStrip : public views::AccessiblePaneView,
// views::ViewObserver: // views::ViewObserver:
void OnViewIsDeleting(views::View* observed_view) override; void OnViewIsDeleting(views::View* observed_view) override;
void OnViewFocused(views::View* observed_view) override;
// views::WidgetObserver: // views::WidgetObserver:
void OnWidgetActivationChanged(views::Widget* widget, bool active) override; void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
......
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