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

[iOS] Rename OmniboxTextfieldIOS' clearButton method.

UITextField appears to use an internal, undocumented and unprefixed -clearButton
method.  This conflicts with our -clearButton method causing unexpected
behavior.

Bug: None
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I54434cd143bef76975f7aea1ffe811dc9135eed1
Reviewed-on: https://chromium-review.googlesource.com/962442
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549535}
parent 166aae48
...@@ -298,26 +298,26 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; ...@@ -298,26 +298,26 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation";
completionAnimator:(UIViewPropertyAnimator*)completionAnimator { completionAnimator:(UIViewPropertyAnimator*)completionAnimator {
// Hide the rightView button so its not visibile on its initial layout // Hide the rightView button so its not visibile on its initial layout
// while the expan animation is happening. // while the expan animation is happening.
self.clearButton.hidden = YES; self.clearButtonView.hidden = YES;
self.clearButton.alpha = 0; self.clearButtonView.alpha = 0;
self.clearButton.frame = self.clearButtonView.frame =
CGRectLayoutOffset([self rightViewRectForBounds:self.bounds], CGRectLayoutOffset([self rightViewRectForBounds:self.bounds],
[self clearButtonAnimationOffset]); [self clearButtonAnimationOffset]);
[completionAnimator addAnimations:^{ [completionAnimator addAnimations:^{
self.clearButton.hidden = NO; self.clearButtonView.hidden = NO;
self.clearButton.alpha = 1.0; self.clearButtonView.alpha = 1.0;
self.clearButton.frame = CGRectLayoutOffset( self.clearButtonView.frame = CGRectLayoutOffset(
self.clearButton.frame, -[self clearButtonAnimationOffset]); self.clearButtonView.frame, -[self clearButtonAnimationOffset]);
}]; }];
} }
- (void)addContractOmniboxAnimations:(UIViewPropertyAnimator*)animator { - (void)addContractOmniboxAnimations:(UIViewPropertyAnimator*)animator {
[animator addAnimations:^{ [animator addAnimations:^{
self.clearButton.alpha = 0; self.clearButtonView.alpha = 0;
self.clearButton.frame = CGRectLayoutOffset(self.clearButton.frame, self.clearButtonView.frame = CGRectLayoutOffset(
kToolbarButtonAnimationOffset); self.clearButtonView.frame, kToolbarButtonAnimationOffset);
}]; }];
[animator addCompletion:^(UIViewAnimatingPosition finalPosition) { [animator addCompletion:^(UIViewAnimatingPosition finalPosition) {
[self resetClearButton]; [self resetClearButton];
...@@ -969,7 +969,9 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; ...@@ -969,7 +969,9 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation";
} }
// Accesses the clear button view when it's available; correctly resolves RTL. // Accesses the clear button view when it's available; correctly resolves RTL.
- (UIView*)clearButton { // This method must not be named -clearButton, because that conflicts with an
// internal UITextField method.
- (UIView*)clearButtonView {
if ([self isTextFieldLTR]) { if ([self isTextFieldLTR]) {
return self.rightView; return self.rightView;
} else { } else {
......
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