| 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 namespace { | 7 namespace { |
| 8 | 8 |
| 9 // Holds ratio of the margin to the preferred text height. | 9 // Holds ratio of the margin to the preferred text height. |
| 10 const double kTextMarginRate = 0.33; | 10 const double kTextMarginRate = 0.33; |
| 11 | 11 |
| 12 // Size of each vertical margin (top, bottom). |
| 13 const int kVerticalMargin = 3; |
| 14 |
| 12 } // namespace | 15 } // namespace |
| 13 | 16 |
| 14 namespace chromeos { | 17 namespace chromeos { |
| 15 | 18 |
| 19 TextfieldWithMargin::TextfieldWithMargin() { |
| 20 } |
| 21 |
| 16 void TextfieldWithMargin::Layout() { | 22 void TextfieldWithMargin::Layout() { |
| 17 int margin = GetPreferredSize().height() * kTextMarginRate; | 23 int margin = GetPreferredSize().height() * kTextMarginRate; |
| 18 SetHorizontalMargins(margin, margin); | 24 SetHorizontalMargins(margin, margin); |
| 25 SetVerticalMargins(kVerticalMargin, kVerticalMargin); |
| 19 views::Textfield::Layout(); | 26 views::Textfield::Layout(); |
| 20 } | 27 } |
| 21 | 28 |
| 22 } // namespace chromeos | 29 } // namespace chromeos |
| OLD | NEW |