New issue
Advanced search Search tips

Issue 697829 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug


Participants' hotlists:
MacViews-Task-Queue


Sign in to add a comment

MacViews: Widget::ShowInactive() could result in a Space switch

Reported by mbl...@yandex-team.ru, Mar 2 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 YaBrowser/17.3.1.407 (beta) Yowser/2.5 Safari/537.36

Steps to reproduce the problem:
1. You need two Spaces for the bug to reproduce, and there needs to be a Chromium window on each of them, and they need to be BOTH active on their respective space. 
2. Open a site that takes a while to load on one of Chromium windows (http://pikabu.ru works reliably for me), and either navigate to it or refresh the page if it's already open.
3. After navigation/refreshing QUICKLY switch the Space to the other one.
4. Ensure that Chromium window has focus on this space.

If you have performed this sufficiently quickly, the Space will be changed without an explicit action on your part.

What is the expected behavior?
Space should not change without explicit user action.

What went wrong?
StatusBubbleViews::StatusView is the culprit. It will call Widget::ShowInactive(), which will invoke [window_ orderWindow:NSWindowAbove relativeTo:parent_window_number], which will in turn switch the Space (if Chromium is the frontmost application, that's why a second active Chromium window is required in order to reproduce the issue).

StatusBubbleViews::StatusView performs weirdly: it could set Widget's opacity to 0, call ShowInactive() which is immediately followed by Hide().

It's possible to work-around the issue by checking parent NSWindow's -isOnActiveSpace before calling -orderWindow:relativeTo:, but it seems kludgy. A better solution would be for  StatusBubbleViews::StatusView to not call ShowInactive when it's not actually required.

Did this work before? N/A 

Chrome version: 58.0.3008.0  Channel: stable
OS Version: OS X 10.12.3
Flash Version:

 
StatusBubble is a small widget at bottom-left corner of the window, it shows hovered URL and current navigation status.

On Cocoa the StatusBubbleMac calls Attach() once, immediately after construction (the only exception is StatusBubbleMac::SwitchParentWindow(), which is performed when reparenting to/from fullscreen window).
Components: -UI Internals>Views>Desktop
Labels: Proj-MacViews
Components: UI>Browser>StatusBubble
Cc: tapted@chromium.org
Status: Assigned (was: Unconfirmed)
I think we can just set NSWindowCollectionBehaviorTransient for all windows that have parents. Does that help?

(or possibly some other NSWindowCollectionBehaviorFoo, or a combination - they're not documented particularly well).

NativeWidgetMacTest.NativeProperties can be updated to include a test.
Project Member

Comment 5 by bugdroid1@chromium.org, Mar 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c4668427a0d5fdd3b376adc871108f14803c6738

commit c4668427a0d5fdd3b376adc871108f14803c6738
Author: art-snake <art-snake@yandex-team.ru>
Date: Mon Mar 06 23:59:28 2017

MacViews: Don't switch Spaces when calling ShowInactive() for a child Widget.

StatusBubbleViews::StatusView could accidentally switch a Space.
It will call Widget::ShowInactive(), which will invoke
[window_ orderWindow:NSWindowAbove relativeTo:parent_window_number],
which will in turn switch the Space (if Chromium is the frontmost
application).

Transient collection behaviour stops NSWindows from triggering this.

BUG= 697829 

Review-Url: https://codereview.chromium.org/2735723003
Cr-Commit-Position: refs/heads/master@{#455003}

[modify] https://crrev.com/c4668427a0d5fdd3b376adc871108f14803c6738/ui/views/cocoa/bridged_native_widget.mm
[modify] https://crrev.com/c4668427a0d5fdd3b376adc871108f14803c6738/ui/views/widget/native_widget_mac_unittest.mm

Status: Fixed (was: Assigned)

Sign in to add a comment