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/view.h" | 5 #include "ui/views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 : owned_by_client_(false), | 100 : owned_by_client_(false), |
101 id_(0), | 101 id_(0), |
102 group_(-1), | 102 group_(-1), |
103 parent_(NULL), | 103 parent_(NULL), |
104 visible_(true), | 104 visible_(true), |
105 enabled_(true), | 105 enabled_(true), |
106 notify_enter_exit_on_child_(false), | 106 notify_enter_exit_on_child_(false), |
107 registered_for_visible_bounds_notification_(false), | 107 registered_for_visible_bounds_notification_(false), |
108 clip_insets_(0, 0, 0, 0), | 108 clip_insets_(0, 0, 0, 0), |
109 needs_layout_(true), | 109 needs_layout_(true), |
| 110 focus_border_(FocusBorder::CreateDashedFocusBorder()), |
110 flip_canvas_on_paint_for_rtl_ui_(false), | 111 flip_canvas_on_paint_for_rtl_ui_(false), |
111 paint_to_layer_(false), | 112 paint_to_layer_(false), |
112 accelerator_registration_delayed_(false), | 113 accelerator_registration_delayed_(false), |
113 accelerator_focus_manager_(NULL), | 114 accelerator_focus_manager_(NULL), |
114 registered_accelerator_count_(0), | 115 registered_accelerator_count_(0), |
115 next_focusable_view_(NULL), | 116 next_focusable_view_(NULL), |
116 previous_focusable_view_(NULL), | 117 previous_focusable_view_(NULL), |
117 focusable_(false), | 118 focusable_(false), |
118 accessibility_focusable_(false), | 119 accessibility_focusable_(false), |
119 context_menu_controller_(NULL), | 120 context_menu_controller_(NULL), |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 void View::OnPaintBorder(gfx::Canvas* canvas) { | 1135 void View::OnPaintBorder(gfx::Canvas* canvas) { |
1135 if (border_.get()) { | 1136 if (border_.get()) { |
1136 TRACE_EVENT2("views", "View::OnPaintBorder", | 1137 TRACE_EVENT2("views", "View::OnPaintBorder", |
1137 "width", canvas->sk_canvas()->getDevice()->width(), | 1138 "width", canvas->sk_canvas()->getDevice()->width(), |
1138 "height", canvas->sk_canvas()->getDevice()->height()); | 1139 "height", canvas->sk_canvas()->getDevice()->height()); |
1139 border_->Paint(*this, canvas); | 1140 border_->Paint(*this, canvas); |
1140 } | 1141 } |
1141 } | 1142 } |
1142 | 1143 |
1143 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { | 1144 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { |
1144 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 1145 if (focus_border_.get() && |
| 1146 HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
1145 TRACE_EVENT2("views", "views::OnPaintFocusBorder", | 1147 TRACE_EVENT2("views", "views::OnPaintFocusBorder", |
1146 "width", canvas->sk_canvas()->getDevice()->width(), | 1148 "width", canvas->sk_canvas()->getDevice()->width(), |
1147 "height", canvas->sk_canvas()->getDevice()->height()); | 1149 "height", canvas->sk_canvas()->getDevice()->height()); |
1148 canvas->DrawFocusRect(GetLocalBounds()); | 1150 focus_border_->Paint(*this, canvas); |
1149 } | 1151 } |
1150 } | 1152 } |
1151 | 1153 |
1152 // Accelerated Painting -------------------------------------------------------- | 1154 // Accelerated Painting -------------------------------------------------------- |
1153 | 1155 |
1154 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { | 1156 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { |
1155 // This method should not have the side-effect of creating the layer. | 1157 // This method should not have the side-effect of creating the layer. |
1156 if (layer()) | 1158 if (layer()) |
1157 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); | 1159 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); |
1158 } | 1160 } |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 gfx::Point widget_location(event.location()); | 2115 gfx::Point widget_location(event.location()); |
2114 ConvertPointToWidget(this, &widget_location); | 2116 ConvertPointToWidget(this, &widget_location); |
2115 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2117 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
2116 return true; | 2118 return true; |
2117 #else | 2119 #else |
2118 return false; | 2120 return false; |
2119 #endif // !defined(OS_MACOSX) | 2121 #endif // !defined(OS_MACOSX) |
2120 } | 2122 } |
2121 | 2123 |
2122 } // namespace views | 2124 } // namespace views |
OLD | NEW |