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 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 //////////////////////////////////////////////////////////////////////////////// | 997 //////////////////////////////////////////////////////////////////////////////// |
998 // Textfield, DragController overrides: | 998 // Textfield, DragController overrides: |
999 | 999 |
1000 void Textfield::WriteDragDataForView(View* sender, | 1000 void Textfield::WriteDragDataForView(View* sender, |
1001 const gfx::Point& press_pt, | 1001 const gfx::Point& press_pt, |
1002 OSExchangeData* data) { | 1002 OSExchangeData* data) { |
1003 const base::string16& selected_text(GetSelectedText()); | 1003 const base::string16& selected_text(GetSelectedText()); |
1004 data->SetString(selected_text); | 1004 data->SetString(selected_text); |
1005 Label label(selected_text, GetFontList()); | 1005 Label label(selected_text, GetFontList()); |
1006 label.SetBackgroundColor(GetBackgroundColor()); | 1006 label.SetBackgroundColor(GetBackgroundColor()); |
1007 label.set_subpixel_rendering_enabled(false); | 1007 label.SetSubpixelRenderingEnabled(false); |
1008 gfx::Size size(label.GetPreferredSize()); | 1008 gfx::Size size(label.GetPreferredSize()); |
1009 gfx::NativeView native_view = GetWidget()->GetNativeView(); | 1009 gfx::NativeView native_view = GetWidget()->GetNativeView(); |
1010 gfx::Display display = gfx::Screen::GetScreenFor(native_view)-> | 1010 gfx::Display display = gfx::Screen::GetScreenFor(native_view)-> |
1011 GetDisplayNearestWindow(native_view); | 1011 GetDisplayNearestWindow(native_view); |
1012 size.SetToMin(gfx::Size(display.size().width(), height())); | 1012 size.SetToMin(gfx::Size(display.size().width(), height())); |
1013 label.SetBoundsRect(gfx::Rect(size)); | 1013 label.SetBoundsRect(gfx::Rect(size)); |
1014 scoped_ptr<gfx::Canvas> canvas( | 1014 scoped_ptr<gfx::Canvas> canvas( |
1015 GetCanvasForDragImage(GetWidget(), label.size())); | 1015 GetCanvasForDragImage(GetWidget(), label.size())); |
1016 label.SetEnabledColor(GetTextColor()); | 1016 label.SetEnabledColor(GetTextColor()); |
1017 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1017 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 const size_t length = selection_clipboard_text.length(); | 1778 const size_t length = selection_clipboard_text.length(); |
1779 range = gfx::Range(range.start() + length, range.end() + length); | 1779 range = gfx::Range(range.start() + length, range.end() + length); |
1780 } | 1780 } |
1781 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1781 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1782 UpdateAfterChange(true, true); | 1782 UpdateAfterChange(true, true); |
1783 OnAfterUserAction(); | 1783 OnAfterUserAction(); |
1784 } | 1784 } |
1785 } | 1785 } |
1786 | 1786 |
1787 } // namespace views | 1787 } // namespace views |
OLD | NEW |