Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Issue 555243002: mac: Refactor browser_window_controller layout logic. (Closed)

Created:
6 years, 3 months ago by erikchen
Modified:
6 years, 3 months ago
Reviewers:
Robert Sesek, Andre
CC:
chromium-reviews, rohitrao (ping after 24h)
Base URL:
https://chromium.googlesource.com/chromium/src.git@fullscreen_layout
Project:
chromium
Visibility:
Public.

Description

mac: Refactor browser_window_controller layout logic. This CL has no intended major functional changes. This CL separates out the layout logic into its own class. This CL adds unit tests that aren't flaky, as they have no dependencies on AppKit internals. This CL is in preparation for further fullscreen refactoring and improvements. Changes from previous behavior: - The previous layout logic incorrectly ordered subviews. - The previous logic for infobar layout was very fragile. The size of the infobar container depended on the maximum arrow height, which was computed by the browser_window_controller, which in turn was dependent on the size of the infobar container. Minor rearragement of the the existing code would result in an infinite loop. - Previously, calculating the layout of the infobar required 2 stages. The frame of the infobar depended on the height of the top arrow. However, the height of the top arrow was computed by examining the frame of the infobar. The infobar would be laid out in a preliminary position. Then its frame would be adjusted to accomodate the top arrow height. - The new logic for laying out the infobar is much simpler. The infobar's frame always stretches all the way to the bottom of the location icon in the toolbar. - The BrowserWindowController is now the sole entity that determines the layout of the info bar. (Previously, the InfoBarContainerController would also try to adjust the layout of the info bar). - Fixed recently introduced bugs in browser_window_controller_browsertest.mm. - The download shelf was lazily loaded. This makes it difficult to test. The existing browser tests that used it were incorrect. Made a method to explicitly create the download shelf. - The location bar decorations were not being initialized with images. This meant that calling Layout() or GetPageInfoBubblePoint() immediately after initialization would produce the wrong behavior. This changes the logic to ensure that the class is in a consistent state after initialization. BUG=406656 Committed: https://crrev.com/4b45b7de6d8b9f44d75cd0718808aabb19dc3d76 Cr-Commit-Position: refs/heads/master@{#295305}

Patch Set 1 : More cleanup. #

Patch Set 2 : Comments from andresantoso. Renames, header file changes, no functional changes. #

Total comments: 10

Patch Set 3 : Comments from andresantoso, round 2. #

Total comments: 26

Patch Set 4 : Comments from rsesek. #

Total comments: 4

Patch Set 5 : Comments from rsesek, round 2. #

Patch Set 6 : Rebase against top of tree. #

Patch Set 7 : Rebase against top of tree. #

Patch Set 8 : Ensure location bar in consistent state after initialization. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+830 lines, -413 lines) Patch
M chrome/browser/ui/cocoa/browser_window_cocoa.mm View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller.mm View 1 2 3 4 5 4 chunks +22 lines, -2 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm View 1 2 3 5 chunks +23 lines, -6 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller_private.h View 1 2 3 4 5 5 chunks +29 lines, -43 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller_private.mm View 1 2 3 4 5 7 chunks +208 lines, -336 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller_unittest.mm View 1 2 3 5 chunks +12 lines, -7 lines 0 comments Download
A chrome/browser/ui/cocoa/browser_window_layout.h View 1 2 3 4 1 chunk +136 lines, -0 lines 0 comments Download
A chrome/browser/ui/cocoa/browser_window_layout.mm View 1 2 3 4 1 chunk +274 lines, -0 lines 0 comments Download
A chrome/browser/ui/cocoa/browser_window_layout_unittest.mm View 1 2 3 4 1 chunk +95 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/infobar_container_controller.h View 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm View 1 2 3 3 chunks +14 lines, -12 lines 0 comments Download
M chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_window_controller.mm View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/chrome_browser_ui.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 69 (35 generated)
erikchen
andresantoso: Please review.
6 years, 3 months ago (2014-09-10 03:16:07 UTC) #13
Andre
lgtm https://codereview.chromium.org/555243002/diff/210001/chrome/browser/ui/cocoa/browser_window_controller_private.mm File chrome/browser/ui/cocoa/browser_window_controller_private.mm (right): https://codereview.chromium.org/555243002/diff/210001/chrome/browser/ui/cocoa/browser_window_controller_private.mm#newcode887 chrome/browser/ui/cocoa/browser_window_controller_private.mm:887: NSMutableArray* subviews = [NSMutableArray array]; scoped_nsobject https://codereview.chromium.org/555243002/diff/210001/chrome/browser/ui/cocoa/browser_window_controller_private.mm#newcode905 chrome/browser/ui/cocoa/browser_window_controller_private.mm:905: ...
6 years, 3 months ago (2014-09-10 20:59:59 UTC) #14
Andre
LGTM with minor comments. But I'm not familiar with infobar code, so you may want ...
6 years, 3 months ago (2014-09-10 21:01:28 UTC) #15
erikchen
https://codereview.chromium.org/555243002/diff/210001/chrome/browser/ui/cocoa/browser_window_controller_private.mm File chrome/browser/ui/cocoa/browser_window_controller_private.mm (right): https://codereview.chromium.org/555243002/diff/210001/chrome/browser/ui/cocoa/browser_window_controller_private.mm#newcode887 chrome/browser/ui/cocoa/browser_window_controller_private.mm:887: NSMutableArray* subviews = [NSMutableArray array]; On 2014/09/10 20:59:59, Andre ...
6 years, 3 months ago (2014-09-10 23:17:35 UTC) #16
erikchen
rsesek: Please review.
6 years, 3 months ago (2014-09-10 23:17:59 UTC) #18
erikchen
Aside: This CL fixes multiple bugs introduced in https://codereview.chromium.org/435863002. Will coordinate with pkasting to figure ...
6 years, 3 months ago (2014-09-11 00:21:23 UTC) #19
Robert Sesek
This is fantastic cleanup -- BWCP lost 330 lines! I'm am confused by your other ...
6 years, 3 months ago (2014-09-11 03:11:14 UTC) #20
erikchen
rsesek: PTAL. I updated the CL description. Responses inline. On 2014/09/11 03:11:14, rsesek wrote: > ...
6 years, 3 months ago (2014-09-12 00:21:24 UTC) #24
erikchen
https://codereview.chromium.org/555243002/diff/230001/chrome/browser/ui/cocoa/browser_window_controller_private.mm File chrome/browser/ui/cocoa/browser_window_controller_private.mm (right): https://codereview.chromium.org/555243002/diff/230001/chrome/browser/ui/cocoa/browser_window_controller_private.mm#newcode805 chrome/browser/ui/cocoa/browser_window_controller_private.mm:805: [layout setFullscreenToolbarFraction:[presentationModeController_ On 2014/09/11 03:11:13, rsesek wrote: > nit: ...
6 years, 3 months ago (2014-09-12 00:21:30 UTC) #25
Robert Sesek
https://codereview.chromium.org/555243002/diff/230001/chrome/browser/ui/cocoa/browser_window_layout.h File chrome/browser/ui/cocoa/browser_window_layout.h (right): https://codereview.chromium.org/555243002/diff/230001/chrome/browser/ui/cocoa/browser_window_layout.h#newcode12 chrome/browser/ui/cocoa/browser_window_layout.h:12: namespace mac_browser { On 2014/09/12 00:21:29, erikchen wrote: > ...
6 years, 3 months ago (2014-09-12 15:40:00 UTC) #26
erikchen
rsesek: PTAL https://codereview.chromium.org/555243002/diff/230001/chrome/browser/ui/cocoa/browser_window_layout.h File chrome/browser/ui/cocoa/browser_window_layout.h (right): https://codereview.chromium.org/555243002/diff/230001/chrome/browser/ui/cocoa/browser_window_layout.h#newcode12 chrome/browser/ui/cocoa/browser_window_layout.h:12: namespace mac_browser { On 2014/09/12 15:40:00, rsesek ...
6 years, 3 months ago (2014-09-12 17:26:14 UTC) #28
Robert Sesek
LGTM!
6 years, 3 months ago (2014-09-12 17:43:49 UTC) #29
erikchen
\o/
6 years, 3 months ago (2014-09-12 17:48:58 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/350001
6 years, 3 months ago (2014-09-12 17:51:35 UTC) #32
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/4080) mac_chromium_compile_dbg on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg/builds/15068) mac_chromium_rel_swarming ...
6 years, 3 months ago (2014-09-12 18:52:15 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/350001
6 years, 3 months ago (2014-09-13 01:21:16 UTC) #36
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/4206) mac_chromium_compile_dbg on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg/builds/15262) mac_chromium_rel_swarming ...
6 years, 3 months ago (2014-09-13 01:27:26 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/390001
6 years, 3 months ago (2014-09-15 19:16:33 UTC) #43
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_swarming on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_swarming/builds/13807)
6 years, 3 months ago (2014-09-15 20:25:20 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/390001
6 years, 3 months ago (2014-09-15 23:32:06 UTC) #47
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_swarming on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_swarming/builds/13953)
6 years, 3 months ago (2014-09-16 01:39:46 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/390001
6 years, 3 months ago (2014-09-16 15:46:15 UTC) #51
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_swarming on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_swarming/builds/14180)
6 years, 3 months ago (2014-09-16 16:50:32 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/410001
6 years, 3 months ago (2014-09-16 17:16:56 UTC) #55
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_swarming on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_swarming/builds/14221)
6 years, 3 months ago (2014-09-16 19:20:22 UTC) #57
Robert Sesek
On 2014/09/16 19:20:22, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
6 years, 3 months ago (2014-09-16 21:09:04 UTC) #58
erikchen
rsesek: The error was legitimate. PTAL. Diff patch set 8 against patch set 7. I've ...
6 years, 3 months ago (2014-09-17 04:40:43 UTC) #61
Robert Sesek
On 2014/09/17 04:40:43, erikchen wrote: > rsesek: The error was legitimate. PTAL. > > Diff ...
6 years, 3 months ago (2014-09-17 16:41:59 UTC) #62
erikchen
Immediately after creation of the Toolbar. Layout actually gets called more than once.... Here's a ...
6 years, 3 months ago (2014-09-17 17:01:33 UTC) #63
Robert Sesek
Ok, LGTM. Also, does this have an attached BUG=? It probably should.
6 years, 3 months ago (2014-09-17 17:13:45 UTC) #64
erikchen
I'm attaching this to my fullscreen refactor bug, since this CL falls under the same ...
6 years, 3 months ago (2014-09-17 17:29:44 UTC) #65
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/555243002/470001
6 years, 3 months ago (2014-09-17 17:31:01 UTC) #67
commit-bot: I haz the power
Committed patchset #8 (id:470001) as 1537af73f2062cb0ac17f4a853612f5ef929f96f
6 years, 3 months ago (2014-09-17 18:26:59 UTC) #68
commit-bot: I haz the power
6 years, 3 months ago (2014-09-17 18:27:29 UTC) #69
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/4b45b7de6d8b9f44d75cd0718808aabb19dc3d76
Cr-Commit-Position: refs/heads/master@{#295305}

Powered by Google App Engine
This is Rietveld 408576698