| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 NSRect fieldRect = [field convertRect:[field bounds] toView:clipView]; | 137 NSRect fieldRect = [field convertRect:[field bounds] toView:clipView]; |
| 138 | 138 |
| 139 // If the entire field is already visible, let's not scroll. | 139 // If the entire field is already visible, let's not scroll. |
| 140 NSRect documentRect = [clipView documentVisibleRect]; | 140 NSRect documentRect = [clipView documentVisibleRect]; |
| 141 documentRect = [[clipView documentView] convertRect:documentRect | 141 documentRect = [[clipView documentView] convertRect:documentRect |
| 142 toView:clipView]; | 142 toView:clipView]; |
| 143 if (NSContainsRect(documentRect, fieldRect)) | 143 if (NSContainsRect(documentRect, fieldRect)) |
| 144 return; | 144 return; |
| 145 | 145 |
| 146 NSPoint scrollPoint = [clipView constrainScrollPoint: | 146 NSPoint scrollPoint = [clipView constrainScrollPoint: |
| 147 NSMakePoint(NSMinX(fieldRect), NSMinY(fieldRect) - bottomPadding)]; | 147 NSMakePoint(0, NSMinY(fieldRect) - bottomPadding)]; |
| 148 [clipView scrollToPoint:scrollPoint]; | 148 [clipView scrollToPoint:scrollPoint]; |
| 149 [scrollView_ reflectScrolledClipView:clipView]; | 149 [scrollView_ reflectScrolledClipView:clipView]; |
| 150 [self updateErrorBubble]; | 150 [self updateErrorBubble]; |
| 151 } | 151 } |
| 152 | 152 |
| 153 - (void)updateErrorBubble { | 153 - (void)updateErrorBubble { |
| 154 if (!delegate_->ShouldShowErrorBubble()) { | 154 if (!delegate_->ShouldShowErrorBubble()) { |
| 155 [errorBubbleController_ close]; | 155 [errorBubbleController_ close]; |
| 156 } | 156 } |
| 157 } | 157 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 | 281 |
| 282 selectedField = field; | 282 selectedField = field; |
| 283 selectedFieldOrigin = fieldOrigin; | 283 selectedFieldOrigin = fieldOrigin; |
| 284 } | 284 } |
| 285 | 285 |
| 286 return selectedField; | 286 return selectedField; |
| 287 } | 287 } |
| 288 | 288 |
| 289 @end | 289 @end |
| OLD | NEW |