OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/login/textfield_with_margin.h" | 5 #include "chrome/browser/chromeos/login/textfield_with_margin.h" |
6 | 6 |
| 7 #include "chrome/browser/chromeos/login/helper.h" |
| 8 |
7 namespace { | 9 namespace { |
8 | 10 |
9 // Holds ratio of the margin to the preferred text height. | 11 // Holds ratio of the margin to the preferred text height. |
10 const double kTextMarginRate = 0.33; | 12 const double kTextMarginRate = 0.33; |
11 | 13 |
12 // Size of each vertical margin (top, bottom). | 14 // Size of each vertical margin (top, bottom). |
13 const int kVerticalMargin = 3; | 15 const int kVerticalMargin = 3; |
14 | 16 |
15 } // namespace | 17 } // namespace |
16 | 18 |
17 namespace chromeos { | 19 namespace chromeos { |
18 | 20 |
19 TextfieldWithMargin::TextfieldWithMargin() { | 21 TextfieldWithMargin::TextfieldWithMargin() { |
| 22 CorrectTextfieldFontSize(this); |
| 23 } |
| 24 |
| 25 TextfieldWithMargin::TextfieldWithMargin(views::Textfield::StyleFlags style) |
| 26 : Textfield(style) { |
| 27 CorrectTextfieldFontSize(this); |
20 } | 28 } |
21 | 29 |
22 void TextfieldWithMargin::Layout() { | 30 void TextfieldWithMargin::Layout() { |
23 int margin = GetPreferredSize().height() * kTextMarginRate; | 31 int margin = GetPreferredSize().height() * kTextMarginRate; |
24 SetHorizontalMargins(margin, margin); | 32 SetHorizontalMargins(margin, margin); |
25 SetVerticalMargins(kVerticalMargin, kVerticalMargin); | 33 SetVerticalMargins(kVerticalMargin, kVerticalMargin); |
26 views::Textfield::Layout(); | 34 views::Textfield::Layout(); |
27 } | 35 } |
28 | 36 |
29 } // namespace chromeos | 37 } // namespace chromeos |
OLD | NEW |