Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 1915363002: Rename gfx::Display/Screen to display::Display/Screen in views/wm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanups Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar_button.cc ('k') | ui/views/corewm/tooltip_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "ui/accessibility/ax_view_state.h" 12 #include "ui/accessibility/ax_view_state.h"
13 #include "ui/base/clipboard/scoped_clipboard_writer.h" 13 #include "ui/base/clipboard/scoped_clipboard_writer.h"
14 #include "ui/base/cursor/cursor.h" 14 #include "ui/base/cursor/cursor.h"
15 #include "ui/base/default_style.h" 15 #include "ui/base/default_style.h"
16 #include "ui/base/dragdrop/drag_drop_types.h" 16 #include "ui/base/dragdrop/drag_drop_types.h"
17 #include "ui/base/dragdrop/drag_utils.h" 17 #include "ui/base/dragdrop/drag_utils.h"
18 #include "ui/base/ime/input_method.h" 18 #include "ui/base/ime/input_method.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/base/touch/selection_bound.h" 20 #include "ui/base/touch/selection_bound.h"
21 #include "ui/base/ui_base_switches_util.h" 21 #include "ui/base/ui_base_switches_util.h"
22 #include "ui/compositor/canvas_painter.h" 22 #include "ui/compositor/canvas_painter.h"
23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 23 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
24 #include "ui/display/display.h"
25 #include "ui/display/screen.h"
24 #include "ui/events/base_event_utils.h" 26 #include "ui/events/base_event_utils.h"
25 #include "ui/events/event.h" 27 #include "ui/events/event.h"
26 #include "ui/events/keycodes/keyboard_codes.h" 28 #include "ui/events/keycodes/keyboard_codes.h"
27 #include "ui/gfx/canvas.h" 29 #include "ui/gfx/canvas.h"
28 #include "ui/gfx/display.h"
29 #include "ui/gfx/geometry/insets.h" 30 #include "ui/gfx/geometry/insets.h"
30 #include "ui/gfx/screen.h"
31 #include "ui/native_theme/native_theme.h" 31 #include "ui/native_theme/native_theme.h"
32 #include "ui/strings/grit/ui_strings.h" 32 #include "ui/strings/grit/ui_strings.h"
33 #include "ui/views/background.h" 33 #include "ui/views/background.h"
34 #include "ui/views/controls/focusable_border.h" 34 #include "ui/views/controls/focusable_border.h"
35 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
36 #include "ui/views/controls/menu/menu_runner.h" 36 #include "ui/views/controls/menu/menu_runner.h"
37 #include "ui/views/controls/native/native_view_host.h" 37 #include "ui/views/controls/native/native_view_host.h"
38 #include "ui/views/controls/textfield/textfield_controller.h" 38 #include "ui/views/controls/textfield/textfield_controller.h"
39 #include "ui/views/drag_utils.h" 39 #include "ui/views/drag_utils.h"
40 #include "ui/views/metrics.h" 40 #include "ui/views/metrics.h"
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 void Textfield::WriteDragDataForView(View* sender, 1092 void Textfield::WriteDragDataForView(View* sender,
1093 const gfx::Point& press_pt, 1093 const gfx::Point& press_pt,
1094 OSExchangeData* data) { 1094 OSExchangeData* data) {
1095 const base::string16& selected_text(GetSelectedText()); 1095 const base::string16& selected_text(GetSelectedText());
1096 data->SetString(selected_text); 1096 data->SetString(selected_text);
1097 Label label(selected_text, GetFontList()); 1097 Label label(selected_text, GetFontList());
1098 label.SetBackgroundColor(GetBackgroundColor()); 1098 label.SetBackgroundColor(GetBackgroundColor());
1099 label.SetSubpixelRenderingEnabled(false); 1099 label.SetSubpixelRenderingEnabled(false);
1100 gfx::Size size(label.GetPreferredSize()); 1100 gfx::Size size(label.GetPreferredSize());
1101 gfx::NativeView native_view = GetWidget()->GetNativeView(); 1101 gfx::NativeView native_view = GetWidget()->GetNativeView();
1102 gfx::Display display = 1102 display::Display display =
1103 gfx::Screen::GetScreen()->GetDisplayNearestWindow(native_view); 1103 display::Screen::GetScreen()->GetDisplayNearestWindow(native_view);
1104 size.SetToMin(gfx::Size(display.size().width(), height())); 1104 size.SetToMin(gfx::Size(display.size().width(), height()));
1105 label.SetBoundsRect(gfx::Rect(size)); 1105 label.SetBoundsRect(gfx::Rect(size));
1106 std::unique_ptr<gfx::Canvas> canvas( 1106 std::unique_ptr<gfx::Canvas> canvas(
1107 GetCanvasForDragImage(GetWidget(), label.size())); 1107 GetCanvasForDragImage(GetWidget(), label.size()));
1108 label.SetEnabledColor(GetTextColor()); 1108 label.SetEnabledColor(GetTextColor());
1109 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1109 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1110 // Desktop Linux Aura does not yet support transparency in drag images. 1110 // Desktop Linux Aura does not yet support transparency in drag images.
1111 canvas->DrawColor(GetBackgroundColor()); 1111 canvas->DrawColor(GetBackgroundColor());
1112 #endif 1112 #endif
1113 label.Paint(ui::CanvasPainter(canvas.get(), 1.f).context()); 1113 label.Paint(ui::CanvasPainter(canvas.get(), 1.f).context());
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 RequestFocus(); 1913 RequestFocus();
1914 model_->MoveCursorTo(mouse); 1914 model_->MoveCursorTo(mouse);
1915 if (!selection_clipboard_text.empty()) { 1915 if (!selection_clipboard_text.empty()) {
1916 model_->InsertText(selection_clipboard_text); 1916 model_->InsertText(selection_clipboard_text);
1917 UpdateAfterChange(true, true); 1917 UpdateAfterChange(true, true);
1918 } 1918 }
1919 OnAfterUserAction(); 1919 OnAfterUserAction();
1920 } 1920 }
1921 1921
1922 } // namespace views 1922 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar_button.cc ('k') | ui/views/corewm/tooltip_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698