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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 //////////////////////////////////////////////////////////////////////////////// | 999 //////////////////////////////////////////////////////////////////////////////// |
1000 // Textfield, DragController overrides: | 1000 // Textfield, DragController overrides: |
1001 | 1001 |
1002 void Textfield::WriteDragDataForView(View* sender, | 1002 void Textfield::WriteDragDataForView(View* sender, |
1003 const gfx::Point& press_pt, | 1003 const gfx::Point& press_pt, |
1004 OSExchangeData* data) { | 1004 OSExchangeData* data) { |
1005 const base::string16& selected_text(GetSelectedText()); | 1005 const base::string16& selected_text(GetSelectedText()); |
1006 data->SetString(selected_text); | 1006 data->SetString(selected_text); |
1007 Label label(selected_text, GetFontList()); | 1007 Label label(selected_text, GetFontList()); |
1008 label.SetBackgroundColor(GetBackgroundColor()); | 1008 label.SetBackgroundColor(GetBackgroundColor()); |
1009 label.set_subpixel_rendering_enabled(false); | 1009 label.SetSubpixelRenderingEnabled(false); |
1010 gfx::Size size(label.GetPreferredSize()); | 1010 gfx::Size size(label.GetPreferredSize()); |
1011 gfx::NativeView native_view = GetWidget()->GetNativeView(); | 1011 gfx::NativeView native_view = GetWidget()->GetNativeView(); |
1012 gfx::Display display = gfx::Screen::GetScreenFor(native_view)-> | 1012 gfx::Display display = gfx::Screen::GetScreenFor(native_view)-> |
1013 GetDisplayNearestWindow(native_view); | 1013 GetDisplayNearestWindow(native_view); |
1014 size.SetToMin(gfx::Size(display.size().width(), height())); | 1014 size.SetToMin(gfx::Size(display.size().width(), height())); |
1015 label.SetBoundsRect(gfx::Rect(size)); | 1015 label.SetBoundsRect(gfx::Rect(size)); |
1016 scoped_ptr<gfx::Canvas> canvas( | 1016 scoped_ptr<gfx::Canvas> canvas( |
1017 GetCanvasForDragImage(GetWidget(), label.size())); | 1017 GetCanvasForDragImage(GetWidget(), label.size())); |
1018 label.SetEnabledColor(GetTextColor()); | 1018 label.SetEnabledColor(GetTextColor()); |
1019 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1019 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
(...skipping 758 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 |