Commit d9db2d44 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Clip the content of the popup menu to its bounds

This CL clips the content of the popup menu's table view to its bounds,
making sure its content, including the selection highlight respect the
bounds set by the rounded corners.

Bug: 850511
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I516224790aed23fd88387ac3236d36861697cde3
Reviewed-on: https://chromium-review.googlesource.com/1110129
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569289}
parent 6b396491
......@@ -16,4 +16,7 @@ extern const CGFloat kSelectedItemBackgroundAlpha;
// Duration of the highlight animation of the popup menu.
extern const CGFloat kHighlightAnimationDuration;
// Radius for the rounded corner of the popup menu.
extern const CGFloat kPopupMenuCornerRadius;
#endif // IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONSTANTS_H_
......@@ -15,3 +15,5 @@ NSString* const kPopupMenuNavigationTableViewId =
const CGFloat kSelectedItemBackgroundAlpha = 0.05;
const CGFloat kHighlightAnimationDuration = 0.5;
const CGFloat kPopupMenuCornerRadius = 13;
......@@ -74,6 +74,9 @@ const CGFloat kScrollIndicatorVerticalInsets = 11;
self.tableView.tableHeaderView = [[UIView alloc]
initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width,
0.01f)];
self.view.layer.cornerRadius = kPopupMenuCornerRadius;
self.view.layer.masksToBounds = YES;
}
- (void)viewDidAppear:(BOOL)animated {
......
......@@ -6,6 +6,7 @@
#import "ios/chrome/browser/ui/commands/browser_commands.h"
#import "ios/chrome/browser/ui/image_util/image_util.h"
#import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h"
#import "ios/chrome/browser/ui/util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -16,7 +17,6 @@
namespace {
const CGFloat kImageMargin = 196;
const CGFloat kCornerRadius = 13;
const CGFloat kBackgroundGreyScale = 0.98;
const CGFloat kBackgroundAlpha = 0.65;
} // namespace
......@@ -77,7 +77,7 @@ const CGFloat kBackgroundAlpha = 0.65;
UIVisualEffectView* blur =
[[UIVisualEffectView alloc] initWithEffect:blurEffect];
blur.translatesAutoresizingMaskIntoConstraints = NO;
blur.layer.cornerRadius = kCornerRadius;
blur.layer.cornerRadius = kPopupMenuCornerRadius;
blur.clipsToBounds = YES;
blur.backgroundColor =
[UIColor colorWithWhite:kBackgroundGreyScale alpha:kBackgroundAlpha];
......@@ -93,7 +93,7 @@ const CGFloat kBackgroundAlpha = 0.65;
shadow.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_contentContainer.layer.cornerRadius = kCornerRadius;
_contentContainer.layer.cornerRadius = kPopupMenuCornerRadius;
_contentContainer.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_contentContainer];
}
......
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