Commit a81a6a11 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Fix layout for UIToolBar items in the shell app.

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I5a0254977d3bcfeb6256adaab7d4b8dbb8bace04
Reviewed-on: https://chromium-review.googlesource.com/965262Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: Hiroshi Ichikawa <ichikawa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543582}
parent 970b653d
...@@ -27,10 +27,10 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibiltyIdentifier = ...@@ -27,10 +27,10 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibiltyIdentifier =
@property(nonatomic, strong) UIView* containerView; @property(nonatomic, strong) UIView* containerView;
// Text field used for navigating to URLs. // Text field used for navigating to URLs.
@property(nonatomic, strong) UITextField* field; @property(nonatomic, strong) UITextField* field;
// Toolbar button to navigate backwards. // Button to navigate backwards.
@property(nonatomic, strong) UIBarButtonItem* backButton; @property(nonatomic, strong) UIButton* backButton;
// Toolbar button to navigate forwards. // Button to navigate forwards.
@property(nonatomic, strong) UIBarButtonItem* forwardButton; @property(nonatomic, strong) UIButton* forwardButton;
// Toolbar containing navigation buttons and |field|. // Toolbar containing navigation buttons and |field|.
@property(nonatomic, strong) UIToolbar* toolbar; @property(nonatomic, strong) UIToolbar* toolbar;
// Handles the autofill of the content displayed in |webView|. // Handles the autofill of the content displayed in |webView|.
...@@ -103,35 +103,46 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibiltyIdentifier = ...@@ -103,35 +103,46 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibiltyIdentifier =
[_field setAccessibilityLabel:kWebViewShellAddressFieldAccessibilityLabel]; [_field setAccessibilityLabel:kWebViewShellAddressFieldAccessibilityLabel];
// Set up the toolbar buttons. // Set up the toolbar buttons.
self.backButton = [[UIBarButtonItem alloc] self.backButton = [[UIButton alloc] init];
initWithImage:[UIImage imageNamed:@"toolbar_back"] [_backButton setImage:[UIImage imageNamed:@"toolbar_back"]
style:UIBarButtonItemStylePlain forState:UIControlStateNormal];
target:self [_backButton addTarget:self
action:@selector(back)]; action:@selector(back)
forControlEvents:UIControlEventTouchUpInside];
[_backButton setAccessibilityLabel:kWebViewShellBackButtonAccessibilityLabel]; [_backButton setAccessibilityLabel:kWebViewShellBackButtonAccessibilityLabel];
[_backButton.widthAnchor constraintEqualToConstant:44].active = YES;
self.forwardButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"toolbar_forward"] self.forwardButton = [[UIButton alloc] init];
style:UIBarButtonItemStylePlain [_forwardButton setImage:[UIImage imageNamed:@"toolbar_forward"]
target:self forState:UIControlStateNormal];
action:@selector(forward)]; [_forwardButton addTarget:self
action:@selector(forward)
forControlEvents:UIControlEventTouchUpInside];
[_forwardButton [_forwardButton
setAccessibilityLabel:kWebViewShellForwardButtonAccessibilityLabel]; setAccessibilityLabel:kWebViewShellForwardButtonAccessibilityLabel];
[_forwardButton.widthAnchor constraintEqualToConstant:44].active = YES;
UIBarButtonItem* stop = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"toolbar_stop"] UIButton* stopButton = [[UIButton alloc] init];
style:UIBarButtonItemStylePlain [stopButton setImage:[UIImage imageNamed:@"toolbar_stop"]
target:self forState:UIControlStateNormal];
action:@selector(stopLoading)]; [stopButton addTarget:self
action:@selector(stopLoading)
UIBarButtonItem* menu = [[UIBarButtonItem alloc] forControlEvents:UIControlEventTouchUpInside];
initWithImage:[UIImage imageNamed:@"toolbar_more_horiz"] [stopButton.widthAnchor constraintEqualToConstant:44].active = YES;
style:UIBarButtonItemStylePlain
target:self UIButton* menuButton = [[UIButton alloc] init];
action:@selector(showMenu)]; [menuButton setImage:[UIImage imageNamed:@"toolbar_more_horiz"]
forState:UIControlStateNormal];
[menuButton addTarget:self
action:@selector(showMenu)
forControlEvents:UIControlEventTouchUpInside];
[menuButton.widthAnchor constraintEqualToConstant:44].active = YES;
[_toolbar setItems:@[ [_toolbar setItems:@[
_backButton, _forwardButton, stop, menu, [[UIBarButtonItem alloc] initWithCustomView:_backButton],
[[UIBarButtonItem alloc] initWithCustomView:_forwardButton],
[[UIBarButtonItem alloc] initWithCustomView:stopButton],
[[UIBarButtonItem alloc] initWithCustomView:menuButton],
[[UIBarButtonItem alloc] initWithCustomView:_field] [[UIBarButtonItem alloc] initWithCustomView:_field]
]]; ]];
......
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