Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Side by Side Diff: chrome/browser/chromeos/login/textfield_with_margin.cc

Issue 5473001: [cros] Use same textfield settings across existing/new user pods and screen lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/textfield_with_margin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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() {
20 } 22 }
21 23
22 void TextfieldWithMargin::Layout() { 24 void TextfieldWithMargin::Layout() {
23 int margin = GetPreferredSize().height() * kTextMarginRate; 25 int margin = GetPreferredSize().height() * kTextMarginRate;
24 SetHorizontalMargins(margin, margin); 26 SetHorizontalMargins(margin, margin);
25 SetVerticalMargins(kVerticalMargin, kVerticalMargin); 27 SetVerticalMargins(kVerticalMargin, kVerticalMargin);
26 views::Textfield::Layout(); 28 views::Textfield::Layout();
27 } 29 }
28 30
31 void TextfieldWithMargin::ViewHierarchyChanged(bool is_add,
32 views::View *parent,
33 views::View *child) {
34 Textfield::ViewHierarchyChanged(is_add, parent, child);
35 if (is_add && child == this) {
36 CorrectTextfieldFontSize(this);
altimofeev 2010/12/01 18:21:36 Why correction is done here? AFAIK textfield updat
whywhat 2010/12/01 18:27:47 I guess it worked but the idea is to move it to on
Nikita (slow) 2010/12/01 18:29:16 Ok, I've found out that I was missing second const
37 }
38 }
39
29 } // namespace chromeos 40 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/textfield_with_margin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698