| 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 label.SetBoundsRect(gfx::Rect(size)); | 1002 label.SetBoundsRect(gfx::Rect(size)); |
| 1003 scoped_ptr<gfx::Canvas> canvas( | 1003 scoped_ptr<gfx::Canvas> canvas( |
| 1004 GetCanvasForDragImage(GetWidget(), label.size())); | 1004 GetCanvasForDragImage(GetWidget(), label.size())); |
| 1005 label.SetEnabledColor(GetTextColor()); | 1005 label.SetEnabledColor(GetTextColor()); |
| 1006 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1006 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1007 // Desktop Linux Aura does not yet support transparency in drag images. | 1007 // Desktop Linux Aura does not yet support transparency in drag images. |
| 1008 canvas->DrawColor(background); | 1008 canvas->DrawColor(background); |
| 1009 #endif | 1009 #endif |
| 1010 label.Paint(canvas.get(), views::CullSet()); | 1010 label.Paint(canvas.get(), views::CullSet()); |
| 1011 const gfx::Vector2d kOffset(-15, 0); | 1011 const gfx::Vector2d kOffset(-15, 0); |
| 1012 drag_utils::SetDragImageOnDataObject(*canvas, label.size(), kOffset, data); | 1012 drag_utils::SetDragImageOnDataObject(*canvas, kOffset, data); |
| 1013 if (controller_) | 1013 if (controller_) |
| 1014 controller_->OnWriteDragData(data); | 1014 controller_->OnWriteDragData(data); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { | 1017 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { |
| 1018 int drag_operations = ui::DragDropTypes::DRAG_COPY; | 1018 int drag_operations = ui::DragDropTypes::DRAG_COPY; |
| 1019 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || | 1019 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || |
| 1020 !GetRenderText()->IsPointInSelection(p)) { | 1020 !GetRenderText()->IsPointInSelection(p)) { |
| 1021 drag_operations = ui::DragDropTypes::DRAG_NONE; | 1021 drag_operations = ui::DragDropTypes::DRAG_NONE; |
| 1022 } else if (sender == this && !read_only()) { | 1022 } else if (sender == this && !read_only()) { |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 const size_t length = selection_clipboard_text.length(); | 1760 const size_t length = selection_clipboard_text.length(); |
| 1761 range = gfx::Range(range.start() + length, range.end() + length); | 1761 range = gfx::Range(range.start() + length, range.end() + length); |
| 1762 } | 1762 } |
| 1763 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1763 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
| 1764 UpdateAfterChange(true, true); | 1764 UpdateAfterChange(true, true); |
| 1765 OnAfterUserAction(); | 1765 OnAfterUserAction(); |
| 1766 } | 1766 } |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 } // namespace views | 1769 } // namespace views |
| OLD | NEW |