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

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

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « views/controls/textfield/native_textfield_win.cc ('k') | views/drag_utils.cc » ('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) 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 "views/controls/textfield/textfield.h" 5 #include "views/controls/textfield/textfield.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #endif 9 #endif
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 native_wrapper_->GetView()->Layout(); 218 native_wrapper_->GetView()->Layout();
219 } 219 }
220 } 220 }
221 221
222 gfx::Size Textfield::GetPreferredSize() { 222 gfx::Size Textfield::GetPreferredSize() {
223 gfx::Insets insets; 223 gfx::Insets insets;
224 if (draw_border_ && native_wrapper_) 224 if (draw_border_ && native_wrapper_)
225 insets = native_wrapper_->CalculateInsets(); 225 insets = native_wrapper_->CalculateInsets();
226 return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) + 226 return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) +
227 insets.width(), 227 insets.width(),
228 num_lines_ * font_.height() + insets.height()); 228 num_lines_ * font_.GetHeight() + insets.height());
229 } 229 }
230 230
231 bool Textfield::IsFocusable() const { 231 bool Textfield::IsFocusable() const {
232 return IsEnabled() && !read_only_; 232 return IsEnabled() && !read_only_;
233 } 233 }
234 234
235 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { 235 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) {
236 SelectAll(); 236 SelectAll();
237 } 237 }
238 238
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 GDK_CONTROL_MASK; 355 GDK_CONTROL_MASK;
356 } 356 }
357 357
358 bool Textfield::Keystroke::IsShiftHeld() const { 358 bool Textfield::Keystroke::IsShiftHeld() const {
359 return (event_.state & gtk_accelerator_get_default_mod_mask()) == 359 return (event_.state & gtk_accelerator_get_default_mod_mask()) ==
360 GDK_SHIFT_MASK; 360 GDK_SHIFT_MASK;
361 } 361 }
362 #endif 362 #endif
363 363
364 } // namespace views 364 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/textfield/native_textfield_win.cc ('k') | views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698