Commit 6ba6fba3 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Fixed New Download Manager view height.

Setting layoutMargins on iOS 10 had no effect, so the view did not have
any padding (the view hight was the same as statusLabel.heightAnchor).

Setting directionalLayoutMargins only added top and bottom margins,
not left and right, so using directionalLayoutMargins was not super
useful either.

This CL simply adds shadow height constant to
view.layoutMarginsGuide.topAnchor, which looks cleaner (no OS version
conditions and actually work on iOS 10).

Bug: 813979
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I574651f8ce459e57667550a67bf68d6e038d74e3
Reviewed-on: https://chromium-review.googlesource.com/927605Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539319}
parent 24724751
......@@ -95,14 +95,6 @@ NSString* GetSizeString(long long size_in_bytes) {
AddNamedGuide(kActionButtonGuide, self.view);
ConstrainNamedGuideToView(kActionButtonGuide, self.actionButton);
if (@available(iOS 11, *)) {
self.view.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(
kElementMargin, kElementMargin, kElementMargin, kElementMargin);
} else {
self.view.layoutMargins = UIEdgeInsetsMake(kElementMargin, kElementMargin,
kElementMargin, kElementMargin);
}
}
- (void)updateViewConstraints {
......@@ -132,13 +124,16 @@ NSString* GetSizeString(long long size_in_bytes) {
// download controls row constraints.
UIView* downloadRow = self.downloadControlsRow;
UIButton* actionButton = self.actionButton;
// Account for bottom white pixel on shadow image.
CGFloat shadowHeight = CGRectGetHeight(shadow.frame) - 1;
[NSLayoutConstraint activateConstraints:@[
[downloadRow.leadingAnchor
constraintEqualToAnchor:view.layoutMarginsGuide.leadingAnchor],
[downloadRow.trailingAnchor
constraintEqualToAnchor:view.layoutMarginsGuide.trailingAnchor],
[downloadRow.topAnchor
constraintEqualToAnchor:view.layoutMarginsGuide.topAnchor],
constraintEqualToAnchor:view.layoutMarginsGuide.topAnchor
constant:shadowHeight],
[downloadRow.heightAnchor
constraintEqualToAnchor:actionButton.heightAnchor],
]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment