Commit b052b8db authored by Eugene But's avatar Eugene But Committed by Commit Bot

Fix identityDisc tapping in landscape mode.

The bug appeared after crrev.com/1986242 because identityDisk is now
placed on toolbar. Toolbar sits underneath the doodle and doodle simply
covers the toolbar and steals the gesture.

This CL swaps z-index for toolbar and doodle and disables user
interactions for toolbar in landscape. This way the user can still tap
on that toolbar in portrait and tap on doodle in landscape.

Bug: 1046303
Change-Id: I76d49f9c440c1f4cf6be8ee24513ec78848b2b26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028741Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Auto-Submit: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737379}
parent 8601a564
...@@ -60,6 +60,7 @@ using base::UserMetricsAction; ...@@ -60,6 +60,7 @@ using base::UserMetricsAction;
@property(nonatomic, strong) UIButton* fakeOmnibox; @property(nonatomic, strong) UIButton* fakeOmnibox;
@property(nonatomic, strong) UIButton* accessibilityButton; @property(nonatomic, strong) UIButton* accessibilityButton;
@property(nonatomic, strong) UIButton* identityDiscButton; @property(nonatomic, strong) UIButton* identityDiscButton;
@property(nonatomic, strong) UIButton* fakeTapButton;
@property(nonatomic, strong) NSLayoutConstraint* doodleHeightConstraint; @property(nonatomic, strong) NSLayoutConstraint* doodleHeightConstraint;
@property(nonatomic, strong) NSLayoutConstraint* doodleTopMarginConstraint; @property(nonatomic, strong) NSLayoutConstraint* doodleTopMarginConstraint;
@property(nonatomic, strong) NSLayoutConstraint* fakeOmniboxWidthConstraint; @property(nonatomic, strong) NSLayoutConstraint* fakeOmniboxWidthConstraint;
...@@ -114,6 +115,10 @@ using base::UserMetricsAction; ...@@ -114,6 +115,10 @@ using base::UserMetricsAction;
if (IsSplitToolbarMode()) { if (IsSplitToolbarMode()) {
[self.toolbarDelegate setScrollProgressForTabletOmnibox:1]; [self.toolbarDelegate setScrollProgressForTabletOmnibox:1];
} }
// Fake Tap button only needs to work in portrait. Disable the button
// in landscape because in landscape the button covers logoView (which
// need to handle taps).
self.fakeTapButton.userInteractionEnabled = IsSplitToolbarMode();
}; };
[coordinator animateAlongsideTransition:transition completion:nil]; [coordinator animateAlongsideTransition:transition completion:nil];
...@@ -214,10 +219,11 @@ using base::UserMetricsAction; ...@@ -214,10 +219,11 @@ using base::UserMetricsAction;
if (!self.headerView) { if (!self.headerView) {
self.headerView = self.headerView =
base::mac::ObjCCastStrict<ContentSuggestionsHeaderView>(self.view); base::mac::ObjCCastStrict<ContentSuggestionsHeaderView>(self.view);
[self addFakeTapView];
[self addFakeOmnibox]; [self addFakeOmnibox];
[self.headerView addSubview:self.logoVendor.view]; [self.headerView addSubview:self.logoVendor.view];
// Fake Tap View has identity disc, which should render above the doodle.
[self addFakeTapView];
[self.headerView addSubview:self.fakeOmnibox]; [self.headerView addSubview:self.fakeOmnibox];
self.logoVendor.view.translatesAutoresizingMaskIntoConstraints = NO; self.logoVendor.view.translatesAutoresizingMaskIntoConstraints = NO;
self.fakeOmnibox.translatesAutoresizingMaskIntoConstraints = NO; self.fakeOmnibox.translatesAutoresizingMaskIntoConstraints = NO;
...@@ -302,14 +308,25 @@ using base::UserMetricsAction; ...@@ -302,14 +308,25 @@ using base::UserMetricsAction;
} }
} }
// On NTP in split toolbar mode the omnibox has different location (in the
// middle of the screen), but the users have muscle memory and still tap on area
// where omnibox is normally placed (the top area of NTP). Fake Tap Button is
// located in the same position where omnibox is normally placed and focuses the
// omnibox when tapped. Fake Tap Button user interactions are only enabled in
// split toolbar mode.
- (void)addFakeTapView { - (void)addFakeTapView {
UIButton* fakeTapButton = [[UIButton alloc] init]; UIView* toolbar = [[UIView alloc] init];
fakeTapButton.translatesAutoresizingMaskIntoConstraints = NO; toolbar.translatesAutoresizingMaskIntoConstraints = NO;
fakeTapButton.isAccessibilityElement = NO; self.fakeTapButton = [[UIButton alloc] init];
[self.headerView addToolbarView:fakeTapButton]; self.fakeTapButton.userInteractionEnabled = IsSplitToolbarMode();
[fakeTapButton addTarget:self self.fakeTapButton.isAccessibilityElement = NO;
action:@selector(fakeboxTapped) self.fakeTapButton.translatesAutoresizingMaskIntoConstraints = NO;
forControlEvents:UIControlEventTouchUpInside]; [toolbar addSubview:self.fakeTapButton];
[self.headerView addToolbarView:toolbar];
[self.fakeTapButton addTarget:self
action:@selector(fakeboxTapped)
forControlEvents:UIControlEventTouchUpInside];
AddSameConstraints(self.fakeTapButton, toolbar);
} }
- (void)addIdentityDisc { - (void)addIdentityDisc {
......
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