OLD | NEW |
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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 void Textfield::WriteDragDataForView(View* sender, | 1083 void Textfield::WriteDragDataForView(View* sender, |
1084 const gfx::Point& press_pt, | 1084 const gfx::Point& press_pt, |
1085 OSExchangeData* data) { | 1085 OSExchangeData* data) { |
1086 const base::string16& selected_text(GetSelectedText()); | 1086 const base::string16& selected_text(GetSelectedText()); |
1087 data->SetString(selected_text); | 1087 data->SetString(selected_text); |
1088 Label label(selected_text, GetFontList()); | 1088 Label label(selected_text, GetFontList()); |
1089 label.SetBackgroundColor(GetBackgroundColor()); | 1089 label.SetBackgroundColor(GetBackgroundColor()); |
1090 label.SetSubpixelRenderingEnabled(false); | 1090 label.SetSubpixelRenderingEnabled(false); |
1091 gfx::Size size(label.GetPreferredSize()); | 1091 gfx::Size size(label.GetPreferredSize()); |
1092 gfx::NativeView native_view = GetWidget()->GetNativeView(); | 1092 gfx::NativeView native_view = GetWidget()->GetNativeView(); |
1093 gfx::Display display = gfx::Screen::GetScreenFor(native_view)-> | 1093 gfx::Display display = |
1094 GetDisplayNearestWindow(native_view); | 1094 gfx::Screen::GetScreen()->GetDisplayNearestWindow(native_view); |
1095 size.SetToMin(gfx::Size(display.size().width(), height())); | 1095 size.SetToMin(gfx::Size(display.size().width(), height())); |
1096 label.SetBoundsRect(gfx::Rect(size)); | 1096 label.SetBoundsRect(gfx::Rect(size)); |
1097 scoped_ptr<gfx::Canvas> canvas( | 1097 scoped_ptr<gfx::Canvas> canvas( |
1098 GetCanvasForDragImage(GetWidget(), label.size())); | 1098 GetCanvasForDragImage(GetWidget(), label.size())); |
1099 label.SetEnabledColor(GetTextColor()); | 1099 label.SetEnabledColor(GetTextColor()); |
1100 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1100 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1101 // Desktop Linux Aura does not yet support transparency in drag images. | 1101 // Desktop Linux Aura does not yet support transparency in drag images. |
1102 canvas->DrawColor(GetBackgroundColor()); | 1102 canvas->DrawColor(GetBackgroundColor()); |
1103 #endif | 1103 #endif |
1104 label.Paint(ui::CanvasPainter(canvas.get(), 1.f).context()); | 1104 label.Paint(ui::CanvasPainter(canvas.get(), 1.f).context()); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 RequestFocus(); | 1893 RequestFocus(); |
1894 model_->MoveCursorTo(mouse); | 1894 model_->MoveCursorTo(mouse); |
1895 if (!selection_clipboard_text.empty()) { | 1895 if (!selection_clipboard_text.empty()) { |
1896 model_->InsertText(selection_clipboard_text); | 1896 model_->InsertText(selection_clipboard_text); |
1897 UpdateAfterChange(true, true); | 1897 UpdateAfterChange(true, true); |
1898 } | 1898 } |
1899 OnAfterUserAction(); | 1899 OnAfterUserAction(); |
1900 } | 1900 } |
1901 | 1901 |
1902 } // namespace views | 1902 } // namespace views |
OLD | NEW |