New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 773640 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 1
Type: Bug



Sign in to add a comment

When leaving the stack view, the omnibox' width is incorrect.

Project Member Reported by jif@chromium.org, Oct 11 2017

Issue description

To reproduce the problem:
(1) On iPhone, enable the "Safe area compatible toolbar" experimental flag.
(2) Relaunch chrome.
(3) Visit a website (e.g. wikipedia).
(4) Enter the Stack View.
(5) Exit the Stack View.

Notice how the omnibox is incorrectly sized.

 
Screen Shot 2017-10-11 at 13.36.46.png
162 KB View Download

Comment 1 by jif@chromium.org, Oct 11 2017

Components: UI>Browser>Omnibox

Comment 2 by jif@chromium.org, Oct 13 2017

Labels: Hotlist-iOS11 Hotlist-iPhoneX M-63
Owner: jif@chromium.org
Status: Started (was: Available)
M-63
Hotlist-iOS11
Hotlist-iPhoneX

Comment 3 by jif@chromium.org, Oct 13 2017

Adding:

- (void)setBounds:(CGRect)bounds {
  if (bounds.size.width != 0)
    [super setBounds:bounds];
}

to the toolbar_view.mm fixes the problem.

Comment 4 by jif@chromium.org, Oct 13 2017

The omnibox is a (roughly) a subview of the toolbar. It resizes itself with autoresizing masks:

[-(fixed leading margin)-[omnibox]-(fixed trailing margin)-]

The problem happens because when the width of the toolbar is set to 0, UIKit changes "fixed leading margin" and "fixed trailing margin" to 0 to avoid having the width of the omnibox be negative. Afterwards, when the toolbar is sized correctly, the omnibox' margins are incorrect.

I don't understand why the stackview animation results in the bounds of the toolbar being set to 0.

Comment 5 by jif@chromium.org, Oct 13 2017

If I comment out the line doing the reparenting of the toolbarview:

    [_activeCardSet.displayView
        insertSubview:self.transitionToolbarController.view
         aboveSubview:_activeCardSet.currentCard.view];

the "setBounds:CGRectZero" is not called.

Comment 6 by cma...@chromium.org, Oct 19 2017

Hey jif@ are you making some progress on this iPhoneX issue?

Comment 7 by jif@chromium.org, Oct 20 2017

Cc: sczs@chromium.org linds...@chromium.org kkhorimoto@chromium.org jif@chromium.org
 Issue 773394  has been merged into this issue.

Comment 8 by jif@chromium.org, Oct 20 2017

This is the main thing I'm working on.

Comment 10 by jif@chromium.org, Oct 24 2017

Labels: -Pri-3 ReleaseBlock-Stable Pri-1
@jif should I change the status to fixed?
Project Member

Comment 13 by bugdroid1@chromium.org, Oct 25 2017

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

commit bead99874c0f63f1ddf66963cd1af613b4a6531e
Author: Jean-François Geyelin <jif@chromium.org>
Date: Wed Oct 25 11:52:07 2017

[iOS] Prevent the omnibox from being squashed.

The toolbar contains subviews positioned with autoresizing masks.
The margins used by the autoresizing masks get squashed if the
toolbar's width is set to 0. The toolbar's width is set to 0 when
the toolbar is moved out of the view hierarchy.

In order to prevent this, this CL adds a constraint on the minimal
toolbar width.

To have this constraint stick around required *not* removing
all of the toolbar's constraints when the toolbar changed superview
(i.e. *not* calling |[self removeConstraints:self.constraints];| from
|-willMoveToSuperview:|).

In turn, not automatically removing constraints meant that the
constraint on the height of the toolbar (unlike the
leading/trailing/top constraints which were attached to anchors and
thus automatically removed when the view is reparented) was not
getting automatically removed when the toolbar was reparented.
This is why this CL moves the ownership of the height constraint
out of the BVC/NTP, and into the ToolbarController.

This CL also makes the StackView's toolbar be positioned with
autolayout (and respond to safe area changes).

Bug:  773640 
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I2e9b3a59bf80f53c22285aff1595f79df54daefe
Reviewed-on: https://chromium-review.googlesource.com/733163
Commit-Queue: Jean-François Geyelin <jif@chromium.org>
Reviewed-by: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511420}
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/browser_view_controller.mm
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/stack_view/BUILD.gn
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/stack_view/stack_view_controller.mm
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/toolbar/toolbar_controller.h
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/toolbar/toolbar_controller.mm
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/toolbar/toolbar_view.h
[modify] https://crrev.com/bead99874c0f63f1ddf66963cd1af613b4a6531e/ios/chrome/browser/ui/toolbar/toolbar_view.mm

Comment 14 by jif@chromium.org, Oct 25 2017

Status: Fixed (was: Started)
Labels: Merge-TBD
[Auto-generated comment by a script] We noticed that this issue is targeted for M-63; it appears the fix may have landed after branch point, meaning a merge might be required. Please confirm if a merge is required here - if so add Merge-Request-63 label, otherwise remove Merge-TBD label. Thanks.
Status: Verified (was: Fixed)
Verified on M64.0.3250.0 canary
Device: iPhone7plus, iPhoneX simulator
Omnibox looks good after entering and exiting the TabSwitcher.

Verified by enabling the flag from chrome://flags.
Project Member

Comment 17 by bugdroid1@chromium.org, Oct 27 2017

Labels: merge-merged-3239
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/29cb5aca7204e1d8b3a3149d203e7599d8d1e028

commit 29cb5aca7204e1d8b3a3149d203e7599d8d1e028
Author: Jean-François Geyelin <jif@chromium.org>
Date: Fri Oct 27 14:16:01 2017

[iOS] Prevent the omnibox from being squashed.

The toolbar contains subviews positioned with autoresizing masks.
The margins used by the autoresizing masks get squashed if the
toolbar's width is set to 0. The toolbar's width is set to 0 when
the toolbar is moved out of the view hierarchy.

In order to prevent this, this CL adds a constraint on the minimal
toolbar width.

To have this constraint stick around required *not* removing
all of the toolbar's constraints when the toolbar changed superview
(i.e. *not* calling |[self removeConstraints:self.constraints];| from
|-willMoveToSuperview:|).

In turn, not automatically removing constraints meant that the
constraint on the height of the toolbar (unlike the
leading/trailing/top constraints which were attached to anchors and
thus automatically removed when the view is reparented) was not
getting automatically removed when the toolbar was reparented.
This is why this CL moves the ownership of the height constraint
out of the BVC/NTP, and into the ToolbarController.

This CL also makes the StackView's toolbar be positioned with
autolayout (and respond to safe area changes).

Bug:  773640 
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I2e9b3a59bf80f53c22285aff1595f79df54daefe
Reviewed-on: https://chromium-review.googlesource.com/733163
Commit-Queue: Jean-François Geyelin <jif@chromium.org>
Reviewed-by: Mark Cogan <marq@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#511420}(cherry picked from commit bead99874c0f63f1ddf66963cd1af613b4a6531e)
Reviewed-on: https://chromium-review.googlesource.com/741562
Reviewed-by: Jean-François Geyelin <jif@chromium.org>
Cr-Commit-Position: refs/branch-heads/3239@{#262}
Cr-Branched-From: adb61db19020ed8ecee5e91b1a0ea4c924ae2988-refs/heads/master@{#508578}
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/browser_view_controller.mm
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/ntp/new_tab_page_header_view.mm
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/stack_view/BUILD.gn
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/stack_view/stack_view_controller.mm
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/toolbar/toolbar_controller.h
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/toolbar/toolbar_controller.mm
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/toolbar/toolbar_view.h
[modify] https://crrev.com/29cb5aca7204e1d8b3a3149d203e7599d8d1e028/ios/chrome/browser/ui/toolbar/toolbar_view.mm

Labels: -Merge-TBD

Sign in to add a comment