Closed Bug 1045000 Opened 10 years ago Closed 10 years ago

Focusing a minimized browser window causes 2 animations

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal
Points:
3

Tracking

()

VERIFIED FIXED
mozilla34
Iteration:
34.3

People

(Reporter: florian, Assigned: enndeakin)

References

Details

Attachments

(2 files, 1 obsolete file)

Steps to reproduce:
1. In about:config, set devtools.chrome.enabled to true
2. In the main browser window's menubar: Tools -> Web Developer -> Scratchpad
3. In the scratchpad's menubar: Environment -> Browser
4. Paste this in the scratch pad:
let win = Services.ww.openWindow(null, "chrome://browser/content/browser.xul", "", "", null);
win.addEventListener("load", function() {
  setTimeout(function() {
    win.minimize();
      win.focus();
  }, 2000);
});
5. Select the pasted code and press Command+R to execute it.

Expected behavior:
A window opens, 2 seconds later it is minimized and then restored.

Actual behavior:
When the window is restored, the 'restore' animation happens, then the window disappears, and the animation that happens for new windows (when pressing Command+N on a browser window) happens.

Note: It's possible to workaround the issue with this JS code:
if (win.windowState == win.STATE_MINIMIZED)
  win.restore();
else
  win.focus();
but this really seems like a platform issue.

The code above is a reduced test case from bug 1042542.
Blocks: 1037430
This issue also happens with the downloads panel. Open the panel and then try to minimize the window and you'll get the behaviour above.
Flags: firefox-backlog?
Flags: firefox-backlog? → firefox-backlog+
This seems to fix the flickering issue.
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
This part fixes when panels unminimize the window when they are closed.
Hi Neil, can you provide a point value and if the bug should be marked as [qa+] or [qa-] for verificaiton.
Iteration: --- → 34.2
QA Whiteboard: [qa?]
Flags: needinfo?(enndeakin)
This can be tested using both of:

1. The steps in the initial comment.

2. These steps:
 - Open a new tab and load some page.
 - Click on the blank area of the page such that no specific element is focused
 - Open the downloads panel from the toolbar
 - Minimize the window

The window should stay minimized and not flicker.
Points: --- → 3
QA Whiteboard: [qa?] → [qa+]
Flags: needinfo?(enndeakin)
Attachment #8471010 - Flags: review?(smichaud)
Attachment #8471013 - Flags: review?(dao)
Comment on attachment 8471013 [details] [diff] [review]
Part 2: fix panels unminimizing when they are closed

Can we just not set _prevFocus to a window in the first place? The popupshowing handler already has a branch using document.activeElement. If we used that instead of document.commandDispatcher.focusedWindow, the content area would be focused without the window being restored if minimized.
Attachment #8471013 - Flags: review?(dao) → review-
Attachment #8471010 - Attachment is patch: true
Comment on attachment 8471010 [details] [diff] [review]
Part 1: call deminiaturize first when focusing

Weird that this is necessary, but I can't see any harm in it.

(Note that I haven't tested this patch.)
Attachment #8471010 - Flags: review?(smichaud) → review+
Like so?
Attachment #8471013 - Attachment is obsolete: true
Attachment #8475202 - Flags: review?(dao)
Attachment #8475202 - Flags: review?(dao) → review+
Iteration: 34.2 → 34.3
QA Whiteboard: [qa+]
Flags: qe-verify+
https://hg.mozilla.org/mozilla-central/rev/cee63e83abfb
https://hg.mozilla.org/mozilla-central/rev/01a1476ba31b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Reproduced with Nightly 2014-07-28 with str from comment 0 and comment 5.
Verified as fixed with Firefox 34 beta 7 (Build ID: 20141106201515) on Mac OS X 10.9.5.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: