Commit 3d5cdeff authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[iOS][Password Check] Fix ObjCCastStrict crash on Password Details

Since Password Details uses not only TableViewTextEditCell
ObjCCastStrict should be called every time.

Bug: 1112354
Change-Id: I3afcf962842ab9db711f7c5bcb1b14ca00d3a795
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2320172
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794978}
parent ada5164b
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
// Returns the indexPath for the currently focused text field when in edit mode. // Returns the indexPath for the currently focused text field when in edit mode.
- (NSIndexPath*)indexPathForCurrentTextField; - (NSIndexPath*)indexPathForCurrentTextField;
// Returns whether cell at indexPath is editCell.
- (BOOL)isItemAtIndexPathTextEditCell:(NSIndexPath*)cellPath;
@end @end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_EDIT_TABLE_VIEW_CONTROLLER_PROTECTED_H_ #endif // IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_EDIT_TABLE_VIEW_CONTROLLER_PROTECTED_H_
...@@ -160,13 +160,17 @@ ...@@ -160,13 +160,17 @@
return [self.tableView indexPathForCell:_currentEditingCell]; return [self.tableView indexPathForCell:_currentEditingCell];
} }
- (BOOL)isItemAtIndexPathTextEditCell:(NSIndexPath*)cellPath {
return YES;
}
- (void)moveToAnotherCellWithOffset:(NSInteger)offset { - (void)moveToAnotherCellWithOffset:(NSInteger)offset {
NSIndexPath* cellPath = [self indexPathForCurrentTextField]; NSIndexPath* cellPath = [self indexPathForCurrentTextField];
DCHECK(cellPath); DCHECK(cellPath);
NSIndexPath* nextCellPath = [self indexForCellPathWithOffset:offset NSIndexPath* nextCellPath = [self indexForCellPathWithOffset:offset
fromPath:cellPath]; fromPath:cellPath];
if (!nextCellPath) { if (!nextCellPath || ![self isItemAtIndexPathTextEditCell:nextCellPath]) {
[[_currentEditingCell textField] resignFirstResponder]; [[_currentEditingCell textField] resignFirstResponder];
} else { } else {
TableViewTextEditCell* nextCell = TableViewTextEditCell* nextCell =
......
...@@ -415,6 +415,19 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) { ...@@ -415,6 +415,19 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) {
[self reloadData]; [self reloadData];
} }
- (BOOL)isItemAtIndexPathTextEditCell:(NSIndexPath*)cellPath {
NSInteger itemType = [self.tableViewModel itemTypeForIndexPath:cellPath];
switch (static_cast<ItemType>(itemType)) {
case ItemTypePassword:
return YES;
case ItemTypeWebsite:
case ItemTypeUsername:
case ItemTypeChangePasswordButton:
case ItemTypeChangePasswordRecommendation:
return NO;
}
}
#pragma mark - Actions #pragma mark - Actions
// Called when the user tapped on the show/hide button near password. // Called when the user tapped on the show/hide button near password.
......
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