Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1081)

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2252833003: [ios] Use range.length instead of range.location for substring matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 } 1605 }
1606 1606
1607 // Set the specified recognizer to take priority over any recognizers in the 1607 // Set the specified recognizer to take priority over any recognizers in the
1608 // view that have a description containing the specified text fragment. 1608 // view that have a description containing the specified text fragment.
1609 + (void)requireGestureRecognizerToFail:(UIGestureRecognizer*)recognizer 1609 + (void)requireGestureRecognizerToFail:(UIGestureRecognizer*)recognizer
1610 inView:(UIView*)view 1610 inView:(UIView*)view
1611 containingDescription:(NSString*)fragment { 1611 containingDescription:(NSString*)fragment {
1612 for (UIGestureRecognizer* iRecognizer in [view gestureRecognizers]) { 1612 for (UIGestureRecognizer* iRecognizer in [view gestureRecognizers]) {
1613 if (iRecognizer != recognizer) { 1613 if (iRecognizer != recognizer) {
1614 NSString* description = [iRecognizer description]; 1614 NSString* description = [iRecognizer description];
1615 if ([description rangeOfString:fragment].location != NSNotFound) { 1615 if ([description rangeOfString:fragment].length) {
1616 [iRecognizer requireGestureRecognizerToFail:recognizer]; 1616 [iRecognizer requireGestureRecognizerToFail:recognizer];
1617 // requireGestureRecognizerToFail: doesn't retain the recognizer, so it 1617 // requireGestureRecognizerToFail: doesn't retain the recognizer, so it
1618 // is possible for |iRecognizer| to outlive |recognizer| and end up with 1618 // is possible for |iRecognizer| to outlive |recognizer| and end up with
1619 // a dangling pointer. Add a retaining associative reference to ensure 1619 // a dangling pointer. Add a retaining associative reference to ensure
1620 // that the lifetimes work out. 1620 // that the lifetimes work out.
1621 // Note that normally using the value as the key wouldn't make any 1621 // Note that normally using the value as the key wouldn't make any
1622 // sense, but here it's fine since nothing needs to look up the value. 1622 // sense, but here it's fine since nothing needs to look up the value.
1623 objc_setAssociatedObject(view, recognizer, recognizer, 1623 objc_setAssociatedObject(view, recognizer, recognizer,
1624 OBJC_ASSOCIATION_RETAIN_NONATOMIC); 1624 OBJC_ASSOCIATION_RETAIN_NONATOMIC);
1625 } 1625 }
(...skipping 4039 matching lines...) Expand 10 before | Expand all | Expand 10 after
5665 } 5665 }
5666 5666
5667 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5667 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5668 } 5668 }
5669 5669
5670 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5670 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5671 return [action.request valueForHTTPHeaderField:@"Referer"]; 5671 return [action.request valueForHTTPHeaderField:@"Referer"];
5672 } 5672 }
5673 5673
5674 @end 5674 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698