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

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

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: test GetDisplayNearestView 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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 const gfx::Point& press_pt, 1057 const gfx::Point& press_pt,
1058 OSExchangeData* data) { 1058 OSExchangeData* data) {
1059 const base::string16& selected_text(GetSelectedText()); 1059 const base::string16& selected_text(GetSelectedText());
1060 data->SetString(selected_text); 1060 data->SetString(selected_text);
1061 Label label(selected_text, GetFontList()); 1061 Label label(selected_text, GetFontList());
1062 label.SetBackgroundColor(GetBackgroundColor()); 1062 label.SetBackgroundColor(GetBackgroundColor());
1063 label.SetSubpixelRenderingEnabled(false); 1063 label.SetSubpixelRenderingEnabled(false);
1064 gfx::Size size(label.GetPreferredSize()); 1064 gfx::Size size(label.GetPreferredSize());
1065 gfx::NativeView native_view = GetWidget()->GetNativeView(); 1065 gfx::NativeView native_view = GetWidget()->GetNativeView();
1066 display::Display display = 1066 display::Display display =
1067 display::Screen::GetScreen()->GetDisplayNearestWindow(native_view); 1067 display::Screen::GetScreen()->GetDisplayNearestView(native_view);
1068 size.SetToMin(gfx::Size(display.size().width(), height())); 1068 size.SetToMin(gfx::Size(display.size().width(), height()));
1069 label.SetBoundsRect(gfx::Rect(size)); 1069 label.SetBoundsRect(gfx::Rect(size));
1070 label.SetEnabledColor(GetTextColor()); 1070 label.SetEnabledColor(GetTextColor());
1071 1071
1072 SkBitmap bitmap; 1072 SkBitmap bitmap;
1073 float raster_scale = ScaleFactorForDragFromWidget(GetWidget()); 1073 float raster_scale = ScaleFactorForDragFromWidget(GetWidget());
1074 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1074 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1075 // Desktop Linux Aura does not yet support transparency in drag images. 1075 // Desktop Linux Aura does not yet support transparency in drag images.
1076 SkColor color = GetBackgroundColor(); 1076 SkColor color = GetBackgroundColor();
1077 #else 1077 #else
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 cursor_blink_timer_.Stop(); 2085 cursor_blink_timer_.Stop();
2086 } 2086 }
2087 2087
2088 void Textfield::OnCursorBlinkTimerFired() { 2088 void Textfield::OnCursorBlinkTimerFired() {
2089 DCHECK(ShouldBlinkCursor()); 2089 DCHECK(ShouldBlinkCursor());
2090 cursor_view_.SetVisible(!cursor_view_.visible()); 2090 cursor_view_.SetVisible(!cursor_view_.visible());
2091 UpdateCursorView(); 2091 UpdateCursorView();
2092 } 2092 }
2093 2093
2094 } // namespace views 2094 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698