New issue
Advanced search Search tips

Issue 722797 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 671916



Sign in to add a comment

DevToolsManagerDelegateTest fails on MacViews

Reported by alshaba...@yandex-team.ru, May 16 2017

Issue description

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

Steps to reproduce the problem:
Run tests
DevToolsManagerDelegateTest.MaximizedToFullscreenWindow 
DevToolsManagerDelegateTest.MaximizedToMinimizedWindow 
DevToolsManagerDelegateTest.NormalToMaximizedWindow 
DevToolsManagerDelegateTest.RestoreMaximizedWindow 
out of chrome/browser/devtools/devtools_sanity_interactive_browsertest.cc on MacViews.

What is the expected behavior?

What went wrong?
Tests are failing when checking browser()->window()->IsMaximized() which on MacViews always returns false (See NativeWidgetMac::IsMaximized).

Did this work before? N/A 

Chrome version: 57.0.2987.137  Channel: n/a
OS Version: OS X 10.12.4
Flash Version: Shockwave Flash 25.0 r0

NativeWidgetMac::IsMaximized behavior seems a bit weird.
BrowserWindowCocoa::IsMaximized for example, does
```
return ![window() isMiniaturized] && [window() isZoomed];
```
In chrome_native_app_window_views_mac.mm there is
```
bool NSWindowIsMaximized(NSWindow* window) {
  // -[NSWindow isZoomed] only works if the zoom button is enabled.
  if ([[window standardWindowButton:NSWindowZoomButton] isEnabled])
    return [window isZoomed];

  // We don't attempt to distinguish between a window that has been explicitly
  // maximized versus one that has just been dragged by the user to fill the
  // screen. This is the same behavior as -[NSWindow isZoomed] above.
  return NSEqualRects([window frame], [[window screen] visibleFrame]);
}
```
Why doesn't NativeWidgetMac::IsMaximized do something similar?
 
Components: Internals>Views>Desktop
Labels: Proj-MacViews
Status: Available (was: Unconfirmed)
Blocking: 671916
Labels: phase4
The answer is in the code

bool NativeWidgetMac::IsMaximized() const {
  // The window frame isn't altered on Mac unless going fullscreen. The green
  // "+" button just makes the window bigger. So, always false.
  return false;
}

i.e. IsMaximized is used to alter the window frame. On Mac, the window frame for regular and "zoomed" windows should be identical.

We need a considered fix for browser windows on Mac once we know the use cases. The Cocoa browser window has some strange code and comments like "// TODO(..): ugh." - we shouldn't just copy it.
Status: Fixed (was: Available)
MacViews triage: These tests pass now, but I don't know why.

Sign in to add a comment