Commit c45bd761 authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

[iOS] Prevent omnibox focusing animation when the popup is up.

Prevents the focusing animation when the popup is displayed.
Also resets alpha levels of the edit and steady view post animation to
ensure correct behaviour if the non-animated focusing/defocusing is
triggered multiple times rapidly (more of a theoretical scenario).

Bug: 866882
TBR: marq@chromium.org
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ib00aa7d4a5ffe871260b4272ad9b2ca8494ba952
Reviewed-on: https://chromium-review.googlesource.com/1151347
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579737}
parent 2b3d2237
...@@ -7,9 +7,13 @@ ...@@ -7,9 +7,13 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
// Notification sent when the location bar becomes first responder. // Notification sent when the location bar becomes first responder. In UI
// Refresh, it is not repeatedly sent if the omnibox is refocused while the
// popup is still open.
extern NSString* const kLocationBarBecomesFirstResponderNotification; extern NSString* const kLocationBarBecomesFirstResponderNotification;
// Notification sent when the location bar resigns first responder. // Notification sent when the location bar resigns first responder. Not sent
// when the omnibox resigns first responder while the popup is still open (i.e.
// when the popup is scrolled).
extern NSString* const kLocationBarResignsFirstResponderNotification; extern NSString* const kLocationBarResignsFirstResponderNotification;
#endif // IOS_CHROME_BROWSER_UI_LOCATION_BAR_NOTIFICATION_NAMES_H_ #endif // IOS_CHROME_BROWSER_UI_LOCATION_BAR_NOTIFICATION_NAMES_H_
...@@ -431,9 +431,17 @@ void OmniboxViewIOS::OnDidBeginEditing() { ...@@ -431,9 +431,17 @@ void OmniboxViewIOS::OnDidBeginEditing() {
UpdateRightDecorations(); UpdateRightDecorations();
// The controller looks at the current pre-edit state, so the call to // Before UI Refresh, The controller looks at the current pre-edit state, so
// OnSetFocus() must come after entering pre-edit. // the call to OnSetFocus() must come after entering pre-edit. In UI Refresh,
controller_->OnSetFocus(); // |controller_| is only forwarding the call to the BVC. This should only
// happen when the omnibox is being focused and it starts showing the popup;
// if the popup was already open, no need to call this.
if (IsUIRefreshPhase1Enabled()) {
if (!popup_was_open_before_editing_began)
controller_->OnSetFocus();
} else {
controller_->OnSetFocus();
}
} }
void OmniboxViewIOS::OnDidEndEditing() { void OmniboxViewIOS::OnDidEndEditing() {
......
...@@ -21,7 +21,8 @@ class WebOmniboxEditController : public OmniboxEditController { ...@@ -21,7 +21,8 @@ class WebOmniboxEditController : public OmniboxEditController {
// The autocomplete edit lost focus. // The autocomplete edit lost focus.
virtual void OnKillFocus() = 0; virtual void OnKillFocus() = 0;
// The autocomplete got focus. // The autocomplete got focus. In UI Refresh, this is not called if the popup
// was already open when the omnibox is refocused.
virtual void OnSetFocus() = 0; virtual void OnSetFocus() = 0;
protected: protected:
......
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
[self.locationBarAnimatee setEditViewHidden:NO]; [self.locationBarAnimatee setEditViewHidden:NO];
[self.locationBarAnimatee setSteadyViewHidden:YES]; [self.locationBarAnimatee setSteadyViewHidden:YES];
[self.locationBarAnimatee resetTransforms]; [self.locationBarAnimatee resetTransforms];
[self.locationBarAnimatee setSteadyViewFaded:NO];
[self.locationBarAnimatee setEditViewFaded:NO];
self.isAnimating = NO; self.isAnimating = NO;
}; };
...@@ -124,6 +126,8 @@ ...@@ -124,6 +126,8 @@
[self.locationBarAnimatee setSteadyViewHidden:NO]; [self.locationBarAnimatee setSteadyViewHidden:NO];
[self.locationBarAnimatee resetTransforms]; [self.locationBarAnimatee resetTransforms];
self.isAnimating = NO; self.isAnimating = NO;
[self.locationBarAnimatee setSteadyViewFaded:NO];
[self.locationBarAnimatee setEditViewFaded:NO];
}; };
if (animated) { if (animated) {
......
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