[iOS] Resize toolbar when the safe area changes

Desktop / Chromium - Jean-Fran├žois Geyelin [chromium.org] - 11 October 2017 07:34 EDT

This CL adds an experimental flag, and makes the Toolbar be resized when the Safe Area changes when the experimental flag is enabled.

The subviews of the Toolbar and WebToolbar are now bottom aligned, with a flexible top margin. This allows changing the height of the toolbar. The WebToolbar's clipping view is an exception: it can't be laid out with autoresizing masks because its frame must change according to its _superview's superview_ height. For reason I don't understand setting a constraint between the clipping
view's height and its superview's superview's height did not work.

The frame of the Toolbar is set by the owners of the Toolbar: the BVC or the NTPHeaderView. They both need to listen for when the safe area changes, so that they can update the height of the toolbar accordingly.

The Stack View and Pull To Action are not handled yet.

What it looks like after this CL: https://drive.google.com/open?id=0Bw-kA2pwDsU-TjBPZDlJODA4TEU

Bug: 770693 Change-Id: I5b2ff14934a14584e0d9b68b8b9ba8ee94ac6112 Reviewed-on: https://chromium-review.googlesource.com/698067 Commit-Queue: Jean-Fran├žois Geyelin

ed4cde7 [iOS] Resize toolbar when the safe area changes.
ios/chrome/browser/BUILD.gn | 1 +
ios/chrome/browser/about_flags.mm | 7 ++-
ios/chrome/browser/ios_chrome_flag_descriptions.cc | 5 ++
ios/chrome/browser/ios_chrome_flag_descriptions.h | 4 ++
ios/chrome/browser/ui/BUILD.gn | 2 +
ios/chrome/browser/ui/browser_view_controller.mm | 48 ++++++++++++++++-
ios/chrome/browser/ui/ntp/BUILD.gn | 1 +
.../browser/ui/ntp/new_tab_page_header_view.mm | 47 ++++++++++++++--
ios/chrome/browser/ui/toolbar/BUILD.gn | 11 ++++
ios/chrome/browser/ui/toolbar/toolbar_controller.h | 6 +++
.../browser/ui/toolbar/toolbar_controller.mm | 43 +++++++++++----
.../ui/toolbar/toolbar_controller_base_feature.h | 13 +++++
.../ui/toolbar/toolbar_controller_base_feature.mm | 8 +++
ios/chrome/browser/ui/toolbar/toolbar_view.mm | 8 +++
.../browser/ui/toolbar/web_toolbar_controller.mm | 62 ++++++++++++++++------
ios/chrome/browser/ui/ui_util.mm | 15 ++++--
16 files changed, 242 insertions(+), 39 deletions(-)

Upstream: git.chromium.org


  • Share