OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.h" | 5 #import "ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 // Make a defensive copy of |match.contents|, as CopyToOmnibox() will trigger | 649 // Make a defensive copy of |match.contents|, as CopyToOmnibox() will trigger |
650 // a new round of autocomplete and modify |_currentResult|. | 650 // a new round of autocomplete and modify |_currentResult|. |
651 base::string16 contents(match.contents); | 651 base::string16 contents(match.contents); |
652 _popupView->CopyToOmnibox(contents); | 652 _popupView->CopyToOmnibox(contents); |
653 } | 653 } |
654 | 654 |
655 #pragma mark - | 655 #pragma mark - |
656 #pragma mark UIScrollViewDelegate | 656 #pragma mark UIScrollViewDelegate |
657 | 657 |
658 - (void)scrollViewDidScroll:(UIScrollView*)scrollView { | 658 - (void)scrollViewDidScroll:(UIScrollView*)scrollView { |
659 // Setting the top inset of the scrollView to |kTopAndBottomPadding| causes a | 659 // TODO(crbug.com/733650): Default to the dragging check once it's been tested |
660 // one time scrollViewDidScroll to |-kTopAndBottomPadding|. It's easier to | 660 // on trunk. |
661 // just ignore this one scroll tick. | 661 if (base::ios::IsRunningOnIOS11OrLater()) { |
662 if (scrollView.contentOffset.y == 0 - kTopAndBottomPadding) | 662 if (!scrollView.dragging) |
663 return; | 663 return; |
| 664 } else { |
| 665 // Setting the top inset of the scrollView to |kTopAndBottomPadding| causes |
| 666 // a one time scrollViewDidScroll to |-kTopAndBottomPadding|. It's easier |
| 667 // to just ignore this one scroll tick. |
| 668 if (scrollView.contentOffset.y == 0 - kTopAndBottomPadding) |
| 669 return; |
| 670 } |
664 | 671 |
665 _popupView->DidScroll(); | 672 _popupView->DidScroll(); |
666 for (OmniboxPopupMaterialRow* row in _rows) { | 673 for (OmniboxPopupMaterialRow* row in _rows) { |
667 row.highlighted = NO; | 674 row.highlighted = NO; |
668 } | 675 } |
669 } | 676 } |
670 | 677 |
671 // Set text alignment for popup cells. | 678 // Set text alignment for popup cells. |
672 - (void)setTextAlignment:(NSTextAlignment)alignment { | 679 - (void)setTextAlignment:(NSTextAlignment)alignment { |
673 _alignment = alignment; | 680 _alignment = alignment; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 // The delete button never disappears if you don't call this after a tap. | 793 // The delete button never disappears if you don't call this after a tap. |
787 // It doesn't seem to be required anywhere else. | 794 // It doesn't seem to be required anywhere else. |
788 [_rows[indexPath.row] prepareForReuse]; | 795 [_rows[indexPath.row] prepareForReuse]; |
789 const AutocompleteMatch& match = | 796 const AutocompleteMatch& match = |
790 ((const AutocompleteResult&)_currentResult).match_at(indexPath.row); | 797 ((const AutocompleteResult&)_currentResult).match_at(indexPath.row); |
791 _popupView->DeleteMatch(match); | 798 _popupView->DeleteMatch(match); |
792 } | 799 } |
793 } | 800 } |
794 | 801 |
795 @end | 802 @end |
OLD | NEW |