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

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

Issue 60683003: A number of paint optimizations to improve overall paint times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove SetImageByResourceID and use BackedBySameObjectAs Created 7 years, 1 month 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
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 const gfx::Font& Textfield::GetPrimaryFont() const { 284 const gfx::Font& Textfield::GetPrimaryFont() const {
285 return font_list_.GetPrimaryFont(); 285 return font_list_.GetPrimaryFont();
286 } 286 }
287 287
288 void Textfield::SetFont(const gfx::Font& font) { 288 void Textfield::SetFont(const gfx::Font& font) {
289 SetFontList(gfx::FontList(font)); 289 SetFontList(gfx::FontList(font));
290 } 290 }
291 291
292 void Textfield::SetHorizontalMargins(int left, int right) { 292 void Textfield::SetHorizontalMargins(int left, int right) {
293 if (horizontal_margins_were_set_ &&
294 left == margins_.left() && right == margins_.right()) {
295 return;
296 }
293 margins_.Set(margins_.top(), left, margins_.bottom(), right); 297 margins_.Set(margins_.top(), left, margins_.bottom(), right);
294 horizontal_margins_were_set_ = true; 298 horizontal_margins_were_set_ = true;
295 if (native_wrapper_) 299 if (native_wrapper_)
296 native_wrapper_->UpdateHorizontalMargins(); 300 native_wrapper_->UpdateHorizontalMargins();
297 PreferredSizeChanged(); 301 PreferredSizeChanged();
298 } 302 }
299 303
300 void Textfield::SetVerticalMargins(int top, int bottom) { 304 void Textfield::SetVerticalMargins(int top, int bottom) {
305 if (vertical_margins_were_set_ &&
306 top == margins_.top() && bottom == margins_.bottom()) {
307 return;
308 }
301 margins_.Set(top, margins_.left(), bottom, margins_.right()); 309 margins_.Set(top, margins_.left(), bottom, margins_.right());
302 vertical_margins_were_set_ = true; 310 vertical_margins_were_set_ = true;
303 if (native_wrapper_) 311 if (native_wrapper_)
304 native_wrapper_->UpdateVerticalMargins(); 312 native_wrapper_->UpdateVerticalMargins();
305 PreferredSizeChanged(); 313 PreferredSizeChanged();
306 } 314 }
307 315
308 void Textfield::RemoveBorder() { 316 void Textfield::RemoveBorder() {
309 if (!draw_border_) 317 if (!draw_border_)
310 return; 318 return;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( 591 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper(
584 Textfield* field) { 592 Textfield* field) {
585 #if defined(OS_WIN) && !defined(USE_AURA) 593 #if defined(OS_WIN) && !defined(USE_AURA)
586 if (!Textfield::IsViewsTextfieldEnabled()) 594 if (!Textfield::IsViewsTextfieldEnabled())
587 return new NativeTextfieldWin(field); 595 return new NativeTextfieldWin(field);
588 #endif 596 #endif
589 return new NativeTextfieldViews(field); 597 return new NativeTextfieldViews(field);
590 } 598 }
591 599
592 } // namespace views 600 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/image_view.cc ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698