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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 label.SetEnabledColor(GetTextColor()); | 1090 label.SetEnabledColor(GetTextColor()); |
1091 | 1091 |
1092 SkBitmap bitmap; | 1092 SkBitmap bitmap; |
1093 float raster_scale = ScaleFactorForDragFromWidget(GetWidget()); | 1093 float raster_scale = ScaleFactorForDragFromWidget(GetWidget()); |
1094 SkColor color = SK_ColorTRANSPARENT; | 1094 SkColor color = SK_ColorTRANSPARENT; |
1095 #if defined(USE_X11) | 1095 #if defined(USE_X11) |
1096 // Fallback on the background color if the system doesn't support compositing. | 1096 // Fallback on the background color if the system doesn't support compositing. |
1097 if (!ui::XVisualManager::GetInstance()->ArgbVisualAvailable()) | 1097 if (!ui::XVisualManager::GetInstance()->ArgbVisualAvailable()) |
1098 color = GetBackgroundColor(); | 1098 color = GetBackgroundColor(); |
1099 #endif | 1099 #endif |
1100 label.Paint( | 1100 label.Paint(ui::PaintInfo( |
1101 ui::CanvasPainter(&bitmap, label.size(), raster_scale, color).context()); | 1101 ui::CanvasPainter(&bitmap, label.size(), raster_scale, color).context(), |
| 1102 label.size())); |
1102 const gfx::Vector2d kOffset(-15, 0); | 1103 const gfx::Vector2d kOffset(-15, 0); |
1103 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale)); | 1104 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale)); |
1104 data->provider().SetDragImage(image, kOffset); | 1105 data->provider().SetDragImage(image, kOffset); |
1105 if (controller_) | 1106 if (controller_) |
1106 controller_->OnWriteDragData(data); | 1107 controller_->OnWriteDragData(data); |
1107 } | 1108 } |
1108 | 1109 |
1109 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { | 1110 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { |
1110 int drag_operations = ui::DragDropTypes::DRAG_COPY; | 1111 int drag_operations = ui::DragDropTypes::DRAG_COPY; |
1111 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || | 1112 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 cursor_blink_timer_.Stop(); | 2115 cursor_blink_timer_.Stop(); |
2115 } | 2116 } |
2116 | 2117 |
2117 void Textfield::OnCursorBlinkTimerFired() { | 2118 void Textfield::OnCursorBlinkTimerFired() { |
2118 DCHECK(ShouldBlinkCursor()); | 2119 DCHECK(ShouldBlinkCursor()); |
2119 UpdateCursorViewPosition(); | 2120 UpdateCursorViewPosition(); |
2120 cursor_view_.SetVisible(!cursor_view_.visible()); | 2121 cursor_view_.SetVisible(!cursor_view_.visible()); |
2121 } | 2122 } |
2122 | 2123 |
2123 } // namespace views | 2124 } // namespace views |
OLD | NEW |