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

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

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 years, 9 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
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 } 1060 }
1061 1061
1062 //////////////////////////////////////////////////////////////////////////////// 1062 ////////////////////////////////////////////////////////////////////////////////
1063 // Textfield, DragController overrides: 1063 // Textfield, DragController overrides:
1064 1064
1065 void Textfield::WriteDragDataForView(View* sender, 1065 void Textfield::WriteDragDataForView(View* sender,
1066 const gfx::Point& press_pt, 1066 const gfx::Point& press_pt,
1067 OSExchangeData* data) { 1067 OSExchangeData* data) {
1068 const base::string16& selected_text(GetSelectedText()); 1068 const base::string16& selected_text(GetSelectedText());
1069 data->SetString(selected_text); 1069 data->SetString(selected_text);
1070 Label label(selected_text, GetFontList()); 1070 Label label(selected_text, {GetFontList()});
1071 label.SetBackgroundColor(GetBackgroundColor()); 1071 label.SetBackgroundColor(GetBackgroundColor());
1072 label.SetSubpixelRenderingEnabled(false); 1072 label.SetSubpixelRenderingEnabled(false);
1073 gfx::Size size(label.GetPreferredSize()); 1073 gfx::Size size(label.GetPreferredSize());
1074 gfx::NativeView native_view = GetWidget()->GetNativeView(); 1074 gfx::NativeView native_view = GetWidget()->GetNativeView();
1075 display::Display display = 1075 display::Display display =
1076 display::Screen::GetScreen()->GetDisplayNearestView(native_view); 1076 display::Screen::GetScreen()->GetDisplayNearestView(native_view);
1077 size.SetToMin(gfx::Size(display.size().width(), height())); 1077 size.SetToMin(gfx::Size(display.size().width(), height()));
1078 label.SetBoundsRect(gfx::Rect(size)); 1078 label.SetBoundsRect(gfx::Rect(size));
1079 label.SetEnabledColor(GetTextColor()); 1079 label.SetEnabledColor(GetTextColor());
1080 1080
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 cursor_blink_timer_.Stop(); 2098 cursor_blink_timer_.Stop();
2099 } 2099 }
2100 2100
2101 void Textfield::OnCursorBlinkTimerFired() { 2101 void Textfield::OnCursorBlinkTimerFired() {
2102 DCHECK(ShouldBlinkCursor()); 2102 DCHECK(ShouldBlinkCursor());
2103 cursor_view_.SetVisible(!cursor_view_.visible()); 2103 cursor_view_.SetVisible(!cursor_view_.visible());
2104 UpdateCursorViewPosition(); 2104 UpdateCursorViewPosition();
2105 } 2105 }
2106 2106
2107 } // namespace views 2107 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698