Commit 1cb37a37 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Cleanup CRWTouchTrackingRecognizer delegates name

This CL changes the names of the touch tracking recognizers delegates
name. The gesture recognizer has two delegates:
 1. The UIGestureRecognizerDelegate (self.delegate)
 2. The CRWTouchTrackingDelegate (self.touchTrackingDelegate)
Prior to this CL, 1. was called using self.delegate and 2. was called
using _delegate. This was very confusing as the reader could expect
_delegate to be the ivar associated with self.delegate, not with
self.touchTrackingDelegate.

This CL cleans this by changing _delegate into _touchTrackingDelegate.

Bug: none
Change-Id: I24331d455f8cea61c117ea698e06f26fbc13ca6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732083
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683622}
parent 72d656f1
......@@ -24,7 +24,8 @@
@property(nonatomic, weak) id<CRWTouchTrackingDelegate> touchTrackingDelegate;
// Designated initializer for CRWTouchTrackingRecognizer.
- (id)initWithDelegate:(id<CRWTouchTrackingDelegate>)delegate;
- (id)initWithTouchTrackingDelegate:
(id<CRWTouchTrackingDelegate>)touchTrackingDelegate;
@end
......
......@@ -8,18 +8,15 @@
#error "This file requires ARC support."
#endif
@interface CRWTouchTrackingRecognizer () <UIGestureRecognizerDelegate> {
id<CRWTouchTrackingDelegate> __weak _delegate;
}
@interface CRWTouchTrackingRecognizer () <UIGestureRecognizerDelegate>
@end
@implementation CRWTouchTrackingRecognizer
@synthesize touchTrackingDelegate = _delegate;
- (id)initWithDelegate:(id<CRWTouchTrackingDelegate>)delegate {
- (id)initWithTouchTrackingDelegate:
(id<CRWTouchTrackingDelegate>)touchTrackingDelegate {
if ((self = [super init])) {
_delegate = delegate;
_touchTrackingDelegate = touchTrackingDelegate;
self.delegate = self;
}
return self;
......@@ -34,7 +31,7 @@
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesBegan:touches withEvent:event];
[_delegate touched:YES];
[self.touchTrackingDelegate touched:YES];
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
......@@ -44,12 +41,12 @@
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesEnded:touches withEvent:event];
self.state = UIGestureRecognizerStateFailed;
[_delegate touched:NO];
[self.touchTrackingDelegate touched:NO];
}
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesCancelled:touches withEvent:event];
[_delegate touched:NO];
[self.touchTrackingDelegate touched:NO];
}
#pragma mark -
......
......@@ -539,7 +539,7 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
- (CRWTouchTrackingRecognizer*)touchTrackingRecognizer {
if (!_touchTrackingRecognizer) {
_touchTrackingRecognizer =
[[CRWTouchTrackingRecognizer alloc] initWithDelegate:self];
[[CRWTouchTrackingRecognizer alloc] initWithTouchTrackingDelegate:self];
}
return _touchTrackingRecognizer;
}
......
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