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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 void View::OnPaintBorder(gfx::Canvas* canvas) { | 1142 void View::OnPaintBorder(gfx::Canvas* canvas) { |
1142 if (border_.get()) { | 1143 if (border_.get()) { |
1143 TRACE_EVENT2("views", "View::OnPaintBorder", | 1144 TRACE_EVENT2("views", "View::OnPaintBorder", |
1144 "width", canvas->sk_canvas()->getDevice()->width(), | 1145 "width", canvas->sk_canvas()->getDevice()->width(), |
1145 "height", canvas->sk_canvas()->getDevice()->height()); | 1146 "height", canvas->sk_canvas()->getDevice()->height()); |
1146 border_->Paint(*this, canvas); | 1147 border_->Paint(*this, canvas); |
1147 } | 1148 } |
1148 } | 1149 } |
1149 | 1150 |
1150 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { | 1151 void View::OnPaintFocusBorder(gfx::Canvas* canvas) { |
1151 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 1152 if (focus_border_.get() && |
| 1153 HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
1152 TRACE_EVENT2("views", "views::OnPaintFocusBorder", | 1154 TRACE_EVENT2("views", "views::OnPaintFocusBorder", |
1153 "width", canvas->sk_canvas()->getDevice()->width(), | 1155 "width", canvas->sk_canvas()->getDevice()->width(), |
1154 "height", canvas->sk_canvas()->getDevice()->height()); | 1156 "height", canvas->sk_canvas()->getDevice()->height()); |
1155 canvas->DrawFocusRect(GetLocalBounds()); | 1157 focus_border_->Paint(*this, canvas); |
1156 } | 1158 } |
1157 } | 1159 } |
1158 | 1160 |
1159 // Accelerated Painting -------------------------------------------------------- | 1161 // Accelerated Painting -------------------------------------------------------- |
1160 | 1162 |
1161 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { | 1163 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { |
1162 // This method should not have the side-effect of creating the layer. | 1164 // This method should not have the side-effect of creating the layer. |
1163 if (layer()) | 1165 if (layer()) |
1164 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); | 1166 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); |
1165 } | 1167 } |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 gfx::Point widget_location(event.location()); | 2122 gfx::Point widget_location(event.location()); |
2121 ConvertPointToWidget(this, &widget_location); | 2123 ConvertPointToWidget(this, &widget_location); |
2122 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2124 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
2123 return true; | 2125 return true; |
2124 #else | 2126 #else |
2125 return false; | 2127 return false; |
2126 #endif // !defined(OS_MACOSX) | 2128 #endif // !defined(OS_MACOSX) |
2127 } | 2129 } |
2128 | 2130 |
2129 } // namespace views | 2131 } // namespace views |
OLD | NEW |