summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_text_field_mac.mm
blob: 3b19da03636c55b524ed88253548c5753f98d563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "chrome/browser/autofill/autofill_text_field_mac.h"

@implementation AutoFillTextField

// Override NSResponder method for when the text field may gain focus.  We
// call |scrollRectToVisible| to ensure that this text field is visible within
// the scrolling area.
- (BOOL)becomeFirstResponder {
  // Vertical inset is negative to indicate "outset".  Provides some visual
  // space above and below when tabbing between fields.
  const CGFloat kVerticalInset = -40.0;
  BOOL becoming = [super becomeFirstResponder];
  if (becoming) {
    [self scrollRectToVisible:NSInsetRect([self bounds], 0.0, kVerticalInset)];
  }
  return becoming;
}

@end