| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #ifndef NDEBUG | 8 #ifndef NDEBUG |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #endif | 10 #endif |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 | 258 |
| 259 void View::SetEnabled(bool state) { | 259 void View::SetEnabled(bool state) { |
| 260 if (enabled_ != state) { | 260 if (enabled_ != state) { |
| 261 enabled_ = state; | 261 enabled_ = state; |
| 262 SchedulePaint(); | 262 SchedulePaint(); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 bool View::IsFocusable() const { | 266 bool View::IsFocusable() const { |
| 267 return focusable_ && IsEnabled() && IsVisible(); | 267 return focusable_ && IsEnabled() && IsVisibleInRootView(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void View::SetFocusable(bool focusable) { | 270 void View::SetFocusable(bool focusable) { |
| 271 focusable_ = focusable; | 271 focusable_ = focusable; |
| 272 } | 272 } |
| 273 | 273 |
| 274 bool View::IsAccessibilityFocusable() const { | 274 bool View::IsAccessibilityFocusable() const { |
| 275 return (focusable_ || accessibility_focusable_) && IsEnabled() && IsVisible(); | 275 return (focusable_ || accessibility_focusable_) && IsEnabled() && |
| 276 IsVisibleInRootView(); |
| 276 } | 277 } |
| 277 | 278 |
| 278 FocusManager* View::GetFocusManager() { | 279 FocusManager* View::GetFocusManager() { |
| 279 Widget* widget = GetWidget(); | 280 Widget* widget = GetWidget(); |
| 280 return widget ? widget->GetFocusManager() : NULL; | 281 return widget ? widget->GetFocusManager() : NULL; |
| 281 } | 282 } |
| 282 | 283 |
| 283 bool View::HasFocus() { | 284 bool View::HasFocus() { |
| 284 FocusManager* focus_manager = GetFocusManager(); | 285 FocusManager* focus_manager = GetFocusManager(); |
| 285 if (focus_manager) | 286 if (focus_manager) |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 possible_drag = false; | 1489 possible_drag = false; |
| 1489 start_pt = gfx::Point(); | 1490 start_pt = gfx::Point(); |
| 1490 } | 1491 } |
| 1491 | 1492 |
| 1492 void View::DragInfo::PossibleDrag(const gfx::Point& p) { | 1493 void View::DragInfo::PossibleDrag(const gfx::Point& p) { |
| 1493 possible_drag = true; | 1494 possible_drag = true; |
| 1494 start_pt = p; | 1495 start_pt = p; |
| 1495 } | 1496 } |
| 1496 | 1497 |
| 1497 } // namespace | 1498 } // namespace |
| OLD | NEW |