| 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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 label.SetEnabledColor(GetTextColor()); | 1108 label.SetEnabledColor(GetTextColor()); |
| 1109 | 1109 |
| 1110 SkBitmap bitmap; | 1110 SkBitmap bitmap; |
| 1111 float raster_scale = ScaleFactorForDragFromWidget(GetWidget()); | 1111 float raster_scale = ScaleFactorForDragFromWidget(GetWidget()); |
| 1112 SkColor color = SK_ColorTRANSPARENT; | 1112 SkColor color = SK_ColorTRANSPARENT; |
| 1113 #if defined(USE_X11) | 1113 #if defined(USE_X11) |
| 1114 // Fallback on the background color if the system doesn't support compositing. | 1114 // Fallback on the background color if the system doesn't support compositing. |
| 1115 if (!ui::XVisualManager::GetInstance()->ArgbVisualAvailable()) | 1115 if (!ui::XVisualManager::GetInstance()->ArgbVisualAvailable()) |
| 1116 color = GetBackgroundColor(); | 1116 color = GetBackgroundColor(); |
| 1117 #endif | 1117 #endif |
| 1118 label.Paint( | 1118 label.Paint(PaintInfo( |
| 1119 ui::CanvasPainter(&bitmap, label.size(), raster_scale, color).context()); | 1119 ui::CanvasPainter(&bitmap, label.size(), raster_scale, color, |
| 1120 GetWidget()->GetCompositor()->is_pixel_canvas()) |
| 1121 .context(), |
| 1122 label.size())); |
| 1120 const gfx::Vector2d kOffset(-15, 0); | 1123 const gfx::Vector2d kOffset(-15, 0); |
| 1121 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale)); | 1124 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale)); |
| 1122 data->provider().SetDragImage(image, kOffset); | 1125 data->provider().SetDragImage(image, kOffset); |
| 1123 if (controller_) | 1126 if (controller_) |
| 1124 controller_->OnWriteDragData(data); | 1127 controller_->OnWriteDragData(data); |
| 1125 } | 1128 } |
| 1126 | 1129 |
| 1127 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { | 1130 int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) { |
| 1128 int drag_operations = ui::DragDropTypes::DRAG_COPY; | 1131 int drag_operations = ui::DragDropTypes::DRAG_COPY; |
| 1129 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || | 1132 if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD || |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 cursor_blink_timer_.Stop(); | 2138 cursor_blink_timer_.Stop(); |
| 2136 } | 2139 } |
| 2137 | 2140 |
| 2138 void Textfield::OnCursorBlinkTimerFired() { | 2141 void Textfield::OnCursorBlinkTimerFired() { |
| 2139 DCHECK(ShouldBlinkCursor()); | 2142 DCHECK(ShouldBlinkCursor()); |
| 2140 UpdateCursorViewPosition(); | 2143 UpdateCursorViewPosition(); |
| 2141 cursor_view_.SetVisible(!cursor_view_.visible()); | 2144 cursor_view_.SetVisible(!cursor_view_.visible()); |
| 2142 } | 2145 } |
| 2143 | 2146 |
| 2144 } // namespace views | 2147 } // namespace views |
| OLD | NEW |