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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 GetDisplayNearestWindow(native_view); | 948 GetDisplayNearestWindow(native_view); |
949 size.SetToMin(gfx::Size(display.size().width(), height())); | 949 size.SetToMin(gfx::Size(display.size().width(), height())); |
950 label.SetBoundsRect(gfx::Rect(size)); | 950 label.SetBoundsRect(gfx::Rect(size)); |
951 scoped_ptr<gfx::Canvas> canvas( | 951 scoped_ptr<gfx::Canvas> canvas( |
952 GetCanvasForDragImage(GetWidget(), label.size())); | 952 GetCanvasForDragImage(GetWidget(), label.size())); |
953 label.SetEnabledColor(GetTextColor()); | 953 label.SetEnabledColor(GetTextColor()); |
954 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 954 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
955 // Desktop Linux Aura does not yet support transparency in drag images. | 955 // Desktop Linux Aura does not yet support transparency in drag images. |
956 canvas->DrawColor(background); | 956 canvas->DrawColor(background); |
957 #endif | 957 #endif |
958 label.Paint(canvas.get()); | 958 label.Paint(canvas.get(), views::CullSet()); |
959 const gfx::Vector2d kOffset(-15, 0); | 959 const gfx::Vector2d kOffset(-15, 0); |
960 drag_utils::SetDragImageOnDataObject(*canvas, label.size(), kOffset, data); | 960 drag_utils::SetDragImageOnDataObject(*canvas, label.size(), kOffset, data); |
961 if (controller_) | 961 if (controller_) |
962 controller_->OnWriteDragData(data); | 962 controller_->OnWriteDragData(data); |
963 } | 963 } |
964 | 964 |
965 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { | 965 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { |
966 int drag_operations = ui::DragDropTypes::DRAG_COPY; | 966 int drag_operations = ui::DragDropTypes::DRAG_COPY; |
967 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || | 967 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || |
968 !GetRenderText()->IsPointInSelection(p)) { | 968 !GetRenderText()->IsPointInSelection(p)) { |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 const size_t length = selection_clipboard_text.length(); | 1680 const size_t length = selection_clipboard_text.length(); |
1681 range = gfx::Range(range.start() + length, range.end() + length); | 1681 range = gfx::Range(range.start() + length, range.end() + length); |
1682 } | 1682 } |
1683 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1683 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1684 UpdateAfterChange(true, true); | 1684 UpdateAfterChange(true, true); |
1685 OnAfterUserAction(); | 1685 OnAfterUserAction(); |
1686 } | 1686 } |
1687 } | 1687 } |
1688 | 1688 |
1689 } // namespace views | 1689 } // namespace views |
OLD | NEW |