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

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

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: ExtendableEnum 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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 } 1052 }
1053 1053
1054 //////////////////////////////////////////////////////////////////////////////// 1054 ////////////////////////////////////////////////////////////////////////////////
1055 // Textfield, DragController overrides: 1055 // Textfield, DragController overrides:
1056 1056
1057 void Textfield::WriteDragDataForView(View* sender, 1057 void Textfield::WriteDragDataForView(View* sender,
1058 const gfx::Point& press_pt, 1058 const gfx::Point& press_pt,
1059 OSExchangeData* data) { 1059 OSExchangeData* data) {
1060 const base::string16& selected_text(GetSelectedText()); 1060 const base::string16& selected_text(GetSelectedText());
1061 data->SetString(selected_text); 1061 data->SetString(selected_text);
1062 Label label(selected_text, GetFontList()); 1062 Label label(selected_text, Label::CustomFont{GetFontList()});
1063 label.SetBackgroundColor(GetBackgroundColor()); 1063 label.SetBackgroundColor(GetBackgroundColor());
1064 label.SetSubpixelRenderingEnabled(false); 1064 label.SetSubpixelRenderingEnabled(false);
1065 gfx::Size size(label.GetPreferredSize()); 1065 gfx::Size size(label.GetPreferredSize());
1066 gfx::NativeView native_view = GetWidget()->GetNativeView(); 1066 gfx::NativeView native_view = GetWidget()->GetNativeView();
1067 display::Display display = 1067 display::Display display =
1068 display::Screen::GetScreen()->GetDisplayNearestWindow(native_view); 1068 display::Screen::GetScreen()->GetDisplayNearestWindow(native_view);
1069 size.SetToMin(gfx::Size(display.size().width(), height())); 1069 size.SetToMin(gfx::Size(display.size().width(), height()));
1070 label.SetBoundsRect(gfx::Rect(size)); 1070 label.SetBoundsRect(gfx::Rect(size));
1071 label.SetEnabledColor(GetTextColor()); 1071 label.SetEnabledColor(GetTextColor());
1072 1072
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 cursor_blink_timer_.Stop(); 2086 cursor_blink_timer_.Stop();
2087 } 2087 }
2088 2088
2089 void Textfield::OnCursorBlinkTimerFired() { 2089 void Textfield::OnCursorBlinkTimerFired() {
2090 DCHECK(ShouldBlinkCursor()); 2090 DCHECK(ShouldBlinkCursor());
2091 cursor_view_.SetVisible(!cursor_view_.visible()); 2091 cursor_view_.SetVisible(!cursor_view_.visible());
2092 UpdateCursorView(); 2092 UpdateCursorView();
2093 } 2093 }
2094 2094
2095 } // namespace views 2095 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698