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

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

Issue 2751833004: Reland "Add display::GetDisplayNearestView" (Closed)
Patch Set: 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
« no previous file with comments | « ui/message_center/views/toast_contents_view.cc ('k') | ui/views/mus/screen_mus.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 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 const gfx::Point& press_pt, 1063 const gfx::Point& press_pt,
1064 OSExchangeData* data) { 1064 OSExchangeData* data) {
1065 const base::string16& selected_text(GetSelectedText()); 1065 const base::string16& selected_text(GetSelectedText());
1066 data->SetString(selected_text); 1066 data->SetString(selected_text);
1067 Label label(selected_text, GetFontList()); 1067 Label label(selected_text, GetFontList());
1068 label.SetBackgroundColor(GetBackgroundColor()); 1068 label.SetBackgroundColor(GetBackgroundColor());
1069 label.SetSubpixelRenderingEnabled(false); 1069 label.SetSubpixelRenderingEnabled(false);
1070 gfx::Size size(label.GetPreferredSize()); 1070 gfx::Size size(label.GetPreferredSize());
1071 gfx::NativeView native_view = GetWidget()->GetNativeView(); 1071 gfx::NativeView native_view = GetWidget()->GetNativeView();
1072 display::Display display = 1072 display::Display display =
1073 display::Screen::GetScreen()->GetDisplayNearestWindow(native_view); 1073 display::Screen::GetScreen()->GetDisplayNearestView(native_view);
1074 size.SetToMin(gfx::Size(display.size().width(), height())); 1074 size.SetToMin(gfx::Size(display.size().width(), height()));
1075 label.SetBoundsRect(gfx::Rect(size)); 1075 label.SetBoundsRect(gfx::Rect(size));
1076 label.SetEnabledColor(GetTextColor()); 1076 label.SetEnabledColor(GetTextColor());
1077 1077
1078 SkBitmap bitmap; 1078 SkBitmap bitmap;
1079 float raster_scale = ScaleFactorForDragFromWidget(GetWidget()); 1079 float raster_scale = ScaleFactorForDragFromWidget(GetWidget());
1080 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1080 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1081 // Desktop Linux Aura does not yet support transparency in drag images. 1081 // Desktop Linux Aura does not yet support transparency in drag images.
1082 SkColor color = GetBackgroundColor(); 1082 SkColor color = GetBackgroundColor();
1083 #else 1083 #else
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 cursor_blink_timer_.Stop(); 2095 cursor_blink_timer_.Stop();
2096 } 2096 }
2097 2097
2098 void Textfield::OnCursorBlinkTimerFired() { 2098 void Textfield::OnCursorBlinkTimerFired() {
2099 DCHECK(ShouldBlinkCursor()); 2099 DCHECK(ShouldBlinkCursor());
2100 cursor_view_.SetVisible(!cursor_view_.visible()); 2100 cursor_view_.SetVisible(!cursor_view_.visible());
2101 UpdateCursorViewPosition(); 2101 UpdateCursorViewPosition();
2102 } 2102 }
2103 2103
2104 } // namespace views 2104 } // namespace views
OLDNEW
« no previous file with comments | « ui/message_center/views/toast_contents_view.cc ('k') | ui/views/mus/screen_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698