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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months 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 | « ui/views/controls/textfield/textfield.h ('k') | ui/views/controls/throbber.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 return initiating_drag_; 474 return initiating_drag_;
475 } 475 }
476 476
477 //////////////////////////////////////////////////////////////////////////////// 477 ////////////////////////////////////////////////////////////////////////////////
478 // Textfield, View overrides: 478 // Textfield, View overrides:
479 479
480 int Textfield::GetBaseline() const { 480 int Textfield::GetBaseline() const {
481 return GetInsets().top() + GetRenderText()->GetBaseline(); 481 return GetInsets().top() + GetRenderText()->GetBaseline();
482 } 482 }
483 483
484 gfx::Size Textfield::GetPreferredSize() { 484 gfx::Size Textfield::GetPreferredSize() const {
485 const gfx::Insets& insets = GetInsets(); 485 const gfx::Insets& insets = GetInsets();
486 return gfx::Size(GetFontList().GetExpectedTextWidth(default_width_in_chars_) + 486 return gfx::Size(GetFontList().GetExpectedTextWidth(default_width_in_chars_) +
487 insets.width(), GetFontList().GetHeight() + insets.height()); 487 insets.width(), GetFontList().GetHeight() + insets.height());
488 } 488 }
489 489
490 const char* Textfield::GetClassName() const { 490 const char* Textfield::GetClassName() const {
491 return kViewClassName; 491 return kViewClassName;
492 } 492 }
493 493
494 gfx::NativeCursor Textfield::GetCursor(const ui::MouseEvent& event) { 494 gfx::NativeCursor Textfield::GetCursor(const ui::MouseEvent& event) {
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 const size_t length = selection_clipboard_text.length(); 1681 const size_t length = selection_clipboard_text.length();
1682 range = gfx::Range(range.start() + length, range.end() + length); 1682 range = gfx::Range(range.start() + length, range.end() + length);
1683 } 1683 }
1684 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); 1684 model_->MoveCursorTo(gfx::SelectionModel(range, affinity));
1685 UpdateAfterChange(true, true); 1685 UpdateAfterChange(true, true);
1686 OnAfterUserAction(); 1686 OnAfterUserAction();
1687 } 1687 }
1688 } 1688 }
1689 1689
1690 } // namespace views 1690 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/controls/throbber.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698