Commit 2daa0541 authored by Keren Zhu's avatar Keren Zhu Committed by Chromium LUCI CQ

Remove CanActivate() hack from screen capture notification UI

ScreenCaptureNotificationUIViews overrides CanActivate() so that the
widget is not activatable when it is hidden, and activable when visible.
This was a hack to fix the a display bug on Windows that lacks an
explanation on why it worked. See r256851.

This hack is causing issue on Mac that the button on the notification
widget will initially show in active style and change to inactive style
after a mouse hover.

Removing the hack solves the cosmetic issue on Mac. Manually tested on
Windows and didn't observe any issue in hiding/restoring the widget as
described in the comment and in r256851.

Details on why the hack caused the cosmetic issue:
1. CanActivate() is false during widget initialization. This will make
   native widget inactive but visual style active.
2. CanActivate() becomes true after initialization. When a mouse hover
   triggers repaint of the button in the widget, widget->IsActive()
   returns false because the native widget is inactive. Thus on Mac,
   the button is rendered in inactive style.

Bug: 1156580
Change-Id: Ic1e4d4bdbe3f29e6f65123880e5e9d373edb189b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596099Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838475}
parent 7ddf9d50
......@@ -87,7 +87,6 @@ class ScreenCaptureNotificationUIViews : public ScreenCaptureNotificationUI,
views::ClientView* CreateClientView(views::Widget* widget) override;
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView(
views::Widget* widget) override;
bool CanActivate() const override;
// views::ViewObserver:
void OnViewBoundsChanged(View* observed_view) override;
......@@ -249,13 +248,6 @@ ScreenCaptureNotificationUIViews::CreateNonClientFrameView(
return frame;
}
bool ScreenCaptureNotificationUIViews::CanActivate() const {
// When the window is visible, it can be activated so the mouse clicks
// can be sent to the window; when the window is minimized, we don't want it
// to activate, otherwise it sometimes does not show properly on Windows.
return GetWidget() && GetWidget()->IsVisible();
}
void ScreenCaptureNotificationUIViews::OnViewBoundsChanged(
View* observed_view) {
gfx::Rect client_rect = source_button_->bounds();
......
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