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

Fixed sidebar show option is not applied properly when it's changed #8878

Merged
merged 1 commit into from
May 20, 2021
Merged
Changes from all commits
Commits
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
19 changes: 17 additions & 2 deletions browser/ui/views/sidebar/sidebar_container_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,27 @@ bool SidebarContainerView::ShouldShowSidebar() const {
}

void SidebarContainerView::OnMouseEntered(const ui::MouseEvent& event) {
const auto show_option = GetSidebarService(browser_)->GetSidebarShowOption();
const bool autohide_sidebar =
show_option == ShowSidebarOption::kShowOnMouseOver ||
show_option == ShowSidebarOption::kShowOnClick;

// When user select to non-autohide option like "Never" option,
// hide timer is scheduled but this view can get mouse event when context
// menu is hidden. In this case, this should not be cancelled.
if (!autohide_sidebar)
return;

// Cancel hide schedule when mouse entered again quickly.
if (sidebar_hide_timer_.IsRunning())
sidebar_hide_timer_.Stop();
sidebar_hide_timer_.Stop();
}

void SidebarContainerView::OnMouseExited(const ui::MouseEvent& event) {
// When context menu is shown, this view can get this exited callback.
// In that case, ignore this callback because mouse is still in this view.
if (IsMouseHovered())
return;

const auto show_option = GetSidebarService(browser_)->GetSidebarShowOption();
const bool autohide_sidebar =
show_option == ShowSidebarOption::kShowOnMouseOver ||
Expand Down