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_section_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_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 "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 base::mac::ObjCCastStrict<AutofillTextField>(field); | 372 base::mac::ObjCCastStrict<AutofillTextField>(field); |
373 | 373 |
374 // This only applies to textfields. | 374 // This only applies to textfields. |
375 if (!textfield) | 375 if (!textfield) |
376 return; | 376 return; |
377 | 377 |
378 autofill::ServerFieldType type = [self fieldTypeForControl:field]; | 378 autofill::ServerFieldType type = [self fieldTypeForControl:field]; |
379 string16 fieldValue = base::SysNSStringToUTF16([textfield fieldValue]); | 379 string16 fieldValue = base::SysNSStringToUTF16([textfield fieldValue]); |
380 | 380 |
381 // Get the frame rectangle for the designated field, in screen coordinates. | 381 // Get the frame rectangle for the designated field, in screen coordinates. |
382 NSRect textFrameInScreen = [field convertRect:[field frame] toView:nil]; | 382 NSRect textFrameInScreen = [field convertRect:[field bounds] toView:nil]; |
383 textFrameInScreen.origin = | 383 textFrameInScreen.origin = |
384 [[field window] convertBaseToScreen:textFrameInScreen.origin]; | 384 [[field window] convertBaseToScreen:textFrameInScreen.origin]; |
385 | 385 |
386 // And adjust for gfx::Rect being flipped compared to OSX coordinates. | 386 // And adjust for gfx::Rect being flipped compared to OSX coordinates. |
387 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 387 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
388 textFrameInScreen.origin.y = | 388 textFrameInScreen.origin.y = |
389 NSMaxY([screen frame]) - NSMaxY(textFrameInScreen); | 389 NSMaxY([screen frame]) - NSMaxY(textFrameInScreen); |
390 gfx::Rect textFrameRect(NSRectToCGRect(textFrameInScreen)); | 390 gfx::Rect textFrameRect(NSRectToCGRect(textFrameInScreen)); |
391 | 391 |
392 delegate_->UserEditedOrActivatedInput(section_, | 392 delegate_->UserEditedOrActivatedInput(section_, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 614 |
615 - (void)activateFieldForInput:(const autofill::DetailInput&)input { | 615 - (void)activateFieldForInput:(const autofill::DetailInput&)input { |
616 if ([self detailInputForType:input.type] != &input) | 616 if ([self detailInputForType:input.type] != &input) |
617 return; | 617 return; |
618 | 618 |
619 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; | 619 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; |
620 [[field window] makeFirstResponder:field]; | 620 [[field window] makeFirstResponder:field]; |
621 } | 621 } |
622 | 622 |
623 @end | 623 @end |
OLD | NEW |