Commit 186999ee authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Fix touch handling for links at bottom of page.

This CL updates the |-hitTest:withEvent:| implementation for the toolbar
container view such that touches are ignored when they occur within the
container, but not on an actual toolbar.  This allows touches to reach
the web content area when the toolbars are collapsed and the content is
laid out behind the container.

Bug: 889884
Change-Id: Ifbb6aff819784c692da9fdd649febfe51688e9f7
Reviewed-on: https://chromium-review.googlesource.com/c/1259882Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597216}
parent 05f1f237
......@@ -356,6 +356,29 @@ NSString* const kBrowserViewControllerSnackbarCategory =
} // namespace
#pragma mark - ToolbarContainerView
// TODO(crbug.com/880672): This is a temporary solution. This logic should be
// handled by ToolbarContainerViewController.
@interface ToolbarContainerView : UIView
@end
@implementation ToolbarContainerView
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent*)event {
// Don't receive events that don't occur within a subview. This is necessary
// because the container view overlaps with web content and the default
// behavior will intercept touches meant for the web page when the toolbars
// are collapsed.
for (UIView* subview in self.subviews) {
if (CGRectContainsPoint(subview.frame, point))
return [super hitTest:point withEvent:event];
}
return nil;
}
@end
#pragma mark - HeaderDefinition helper
// Class used to define a header, an object displayed at the top of the browser.
......@@ -2431,7 +2454,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
if (self.secondaryToolbarCoordinator) {
// Create the container view for the secondary toolbar and add it to the
// hierarchy
UIView* container = [[UIView alloc] init];
UIView* container = [[ToolbarContainerView alloc] init];
container.translatesAutoresizingMaskIntoConstraints = NO;
[container
addSubview:self.secondaryToolbarCoordinator.viewController.view];
......
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