| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/view.h" | 5 #include "chrome/views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #ifndef NDEBUG | 9 #ifndef NDEBUG |
| 10 #include <iostream> | 10 #include <iostream> |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 } | 1483 } |
| 1484 | 1484 |
| 1485 bool View::IsParentOwned() const { | 1485 bool View::IsParentOwned() const { |
| 1486 return is_parent_owned_; | 1486 return is_parent_owned_; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 std::string View::GetClassName() const { | 1489 std::string View::GetClassName() const { |
| 1490 return kViewClassName; | 1490 return kViewClassName; |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 View* View::GetAncestorWithClassName(const std::string& name) { |
| 1494 for (View* view = this; view; view = view->GetParent()) { |
| 1495 if (view->GetClassName() == name) |
| 1496 return view; |
| 1497 } |
| 1498 return NULL; |
| 1499 } |
| 1500 |
| 1493 gfx::Rect View::GetVisibleBounds() { | 1501 gfx::Rect View::GetVisibleBounds() { |
| 1494 if (!IsVisibleInRootView()) | 1502 if (!IsVisibleInRootView()) |
| 1495 return gfx::Rect(); | 1503 return gfx::Rect(); |
| 1496 gfx::Rect vis_bounds(0, 0, width(), height()); | 1504 gfx::Rect vis_bounds(0, 0, width(), height()); |
| 1497 gfx::Rect ancestor_bounds; | 1505 gfx::Rect ancestor_bounds; |
| 1498 View* view = this; | 1506 View* view = this; |
| 1499 int root_x = 0; | 1507 int root_x = 0; |
| 1500 int root_y = 0; | 1508 int root_y = 0; |
| 1501 while (view != NULL && !vis_bounds.IsEmpty()) { | 1509 while (view != NULL && !vis_bounds.IsEmpty()) { |
| 1502 root_x += view->GetX(APPLY_MIRRORING_TRANSFORMATION); | 1510 root_x += view->GetX(APPLY_MIRRORING_TRANSFORMATION); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 } | 1610 } |
| 1603 | 1611 |
| 1604 void View::DragInfo::PossibleDrag(int x, int y) { | 1612 void View::DragInfo::PossibleDrag(int x, int y) { |
| 1605 possible_drag = true; | 1613 possible_drag = true; |
| 1606 start_x = x; | 1614 start_x = x; |
| 1607 start_y = y; | 1615 start_y = y; |
| 1608 } | 1616 } |
| 1609 | 1617 |
| 1610 } // namespace | 1618 } // namespace |
| 1611 | 1619 |
| OLD | NEW |