Use a custom frame view class for browser windows

Desktop / Chromium - Sidney San Martín [] - 9 August 2017 10:40 EDT

This replaces swizzling and repositioning of views in the window frame (e.g. moving the traffic light buttons to be centered in the tab strip). It's meant to fail gracefully:

- The entry point is a single undocumented method (+[NSWindow frameViewClassForStyleMask:])- On 10.10+, the overridden undocumented methods are all getters for simple
values (BOOL, CGFloat, and NSPoint).
- The new code doesn't call any undocumented methods (other than super).

Window frame customization is difficult to test in an automated way, but a manual test looks roughly like this (I skip some tests on some OSs, e.g. I didn't put Accessibility Inspector on each test system):

- Launch Chrome.
- Verify that everything looks generally right.
- Verify that the window buttons are in the same place as shipping Chrome.- If NSVisualEffectView is available, verify that things look right when I move a window around behind the browser window.
- Verify that the window buttons respond on hover.
- Verify that the window buttons can be clicked.
- Close the window, open a new one, repeat the above checks.
- Resize the window, repeat the above checks.- Bring the window into and out of fullscreen a couple of times and verify that the animations look the same as the current ones.
- Repeat the above with "Always Show Toolbar In Full Screen" turned on/off.
- Open an Incognito window.
- Verify that the inactive window buttons are visible.
- Verify that the inactive window buttons respond on hover.- Verify that the inactive window buttons can be clicked, but don't bring the window to the front on mouse down.
- Repeat all of the above checks for the incognito window.- On 10.9, pay special attention to the positions of the profile picker and fullscreen button.- Navigate here: data:text/html,
- Click the page to open a popup window. Repeat all of the above checks.- Turn on VoiceOver. Verify that you can navigate to and activate the window buttons. Turn off VoiceOver.- Launch Accessibility Inspector. Click the crosshair button in the toolbar and verify that you can use the mouse to target the window buttons.- On newer OSs, launch Chrome in RTL: -NSForceRightToLeftWritingDirection YES-AppleTextDirection YES --force-ui-direction=rtl --enable-features=MacRTL- On 10.12+, verify that the window buttons are on the right side of the window.
- Repeat for each of macOS 10.{9..13}.

Bug: 605219, 651287 Change-Id: Iee9b3b03ad677255b5df50c26742551347d7d4d8 Reviewed-on:

1f71c6e Use a custom frame view class for browser windows.
chrome/browser/ui/ | 6 +-
.../ui/cocoa/ | 11 +-
.../ui/cocoa/ | 10 +-
.../cocoa/ | 2 +-
chrome/browser/ui/cocoa/chrome_browser_window.h | 4 +-
chrome/browser/ui/cocoa/custom_frame_view.h | 26 --
chrome/browser/ui/cocoa/ | 111 -------
.../browser/ui/cocoa/ | 45 ---
chrome/browser/ui/cocoa/framed_browser_window.h | 36 +--
chrome/browser/ui/cocoa/ | 357 +--------------------
.../ui/cocoa/ | 213 +-----------
chrome/browser/ui/cocoa/full_size_content_window.h | 46 ---
.../browser/ui/cocoa/ | 209 ------------
chrome/browser/ui/cocoa/tabbed_browser_window.h | 16 +
chrome/browser/ui/cocoa/ | 207 ++++++++++++
.../ui/cocoa/ | 138 ++++++++
.../browser/ui/cocoa/tabs/ | 24 +-
chrome/test/ | 2 +-
18 files changed, 409 insertions(+), 1054 deletions(-)


  • Share